【家园】提交

dev_chengFeng
ZhangBiao 2021-12-21 18:11:12 +08:00
parent 8eb6abec8e
commit d2efbd920c
2 changed files with 4463 additions and 436924 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,32 @@
local HomeLand = quick_class("HomeLand", BasePanel) local HomeLand = quick_class("HomeLand", BasePanel)
function HomeLand:InitComponent() function HomeLand:InitComponent()
self.spLoader = SpriteLoader.New() self.spLoader = SpriteLoader.New()
if not self.playerInfoView then -- if not self.playerInfoView then
self.playerInfoView = SubUIManager.Open(SubUIConfig.PlayerInfoView, self.transform) -- self.playerInfoView = SubUIManager.Open(SubUIConfig.PlayerInfoView, self.transform)
end -- end
self.UpView = SubUIManager.Open(SubUIConfig.UpView, self.transform) self.UpView = SubUIManager.Open(SubUIConfig.UpView, self.transform)
self.btnBack = Util.GetGameObject(self.gameObject,"btnBack")
self.map = Util.GetGameObject(self.gameObject,"Map")
self.Grid = Util.GetGameObject(self.map,"Grid")
self.Bg = Util.GetGameObject(self.map,"Bg")
self.Privi = Util.GetGameObject(self.map,"Privi")
self.RightUp = Util.GetGameObject(self.map,"RightUp")
self.RightDown = Util.GetGameObject(self.map,"RightDown")
self.mapData = {}
for i = 1, 6 do
self.mapData[i] = {}
self.mapData[i].Obj = Util.GetGameObject(self.Bg,"Map ("..i..")")
self.mapData[i].Name = Util.GetGameObject(self.mapData[i].Obj,"Title/Text"):GetComponent("Text")
self.mapData[i].Icon = Util.GetGameObject(self.mapData[i].Obj,"Title/Image"):GetComponent("Image")
self.mapData[i].Btns = Util.GetGameObject(self.mapData[i].Obj,"Btns")
self.mapData[i].btnDetail = Util.GetGameObject(self.mapData[i].Btns,"Detail")
self.mapData[i].btnUpgrade = Util.GetGameObject(self.mapData[i].Btns,"Upgrade")
self.mapData[i].btnCancel = Util.GetGameObject(self.mapData[i].Btns,"Cancel")
self.mapData[i].btnSpeedUp = Util.GetGameObject(self.mapData[i].Btns,"SpeedUp")
end
self.curSelect = 0
end end
function HomeLand:BindEvent() function HomeLand:BindEvent()
@ -13,10 +35,28 @@ function HomeLand:BindEvent()
-- UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.HomeLand, self.helpPosition.x,self.helpPosition.y) -- UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.HomeLand, self.helpPosition.x,self.helpPosition.y)
-- end) -- end)
-- Util.AddClick(self.BtnBack, function() Util.AddClick(self.btnBack, function()
-- PlaySoundWithoutClick(SoundConfig.Sound_UICancel) PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
-- self:ClosePanel() self:ClosePanel()
-- end) end)
for i = 1, 6 do
Util.AddOnceClick(self.mapData[i].Obj,function ()
if self.curSelect ~= i then
self.curSelect = i
for j = 1, 6 do
self.mapData[j].Btns:SetActive(false)
end
self.mapData[i].Btns:SetActive(true)
PlayUIAnim(self.mapData[i].Btns)
end
end)
end
Util.AddClick(self.Bg, function()
self.curSelect = 0
for j = 1, 6 do
self.mapData[j].Btns:SetActive(false)
end
end)
end end
function HomeLand:AddListener() function HomeLand:AddListener()
@ -29,7 +69,7 @@ end
--待功能扩展(试图打开某个状态) --待功能扩展(试图打开某个状态)
function HomeLand:OnOpen() function HomeLand:OnOpen()
self.UpView:OnOpen({ showType = UpViewOpenType.ShowRight, panelType = PanelType.XiuXing }) self.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.XiuXing })
end end
@ -37,20 +77,23 @@ function HomeLand:OnSortingOrderChange()
end end
function HomeLand:OnShow() function HomeLand:OnShow()
self.playerInfoView:OnShow() -- self.playerInfoView:OnShow()
end end
function HomeLand:OnClose() function HomeLand:OnClose()
for j = 1, 6 do
self.mapData[j].Btns:SetActive(false)
end
end end
function HomeLand:OnDestroy() function HomeLand:OnDestroy()
self.spLoader:Destroy() self.spLoader:Destroy()
SubUIManager.Close(self.UpView) SubUIManager.Close(self.UpView)
self.UpView = nil self.UpView = nil
if self.playerInfoView then -- if self.playerInfoView then
SubUIManager.Close(self.playerInfoView) -- SubUIManager.Close(self.playerInfoView)
self.playerInfoView = nil -- self.playerInfoView = nil
end -- end
end end
return HomeLand return HomeLand