【家园】提交

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)
function HomeLand:InitComponent()
self.spLoader = SpriteLoader.New()
if not self.playerInfoView then
self.playerInfoView = SubUIManager.Open(SubUIConfig.PlayerInfoView, self.transform)
end
-- if not self.playerInfoView then
-- self.playerInfoView = SubUIManager.Open(SubUIConfig.PlayerInfoView, self.transform)
-- end
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
function HomeLand:BindEvent()
@ -13,10 +35,28 @@ function HomeLand:BindEvent()
-- UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.HomeLand, self.helpPosition.x,self.helpPosition.y)
-- end)
-- Util.AddClick(self.BtnBack, function()
-- PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
-- self:ClosePanel()
-- end)
Util.AddClick(self.btnBack, function()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
self:ClosePanel()
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
function HomeLand:AddListener()
@ -29,7 +69,7 @@ end
--待功能扩展(试图打开某个状态)
function HomeLand:OnOpen()
self.UpView:OnOpen({ showType = UpViewOpenType.ShowRight, panelType = PanelType.XiuXing })
self.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.XiuXing })
end
@ -37,20 +77,23 @@ function HomeLand:OnSortingOrderChange()
end
function HomeLand:OnShow()
self.playerInfoView:OnShow()
-- self.playerInfoView:OnShow()
end
function HomeLand:OnClose()
for j = 1, 6 do
self.mapData[j].Btns:SetActive(false)
end
end
function HomeLand:OnDestroy()
self.spLoader:Destroy()
SubUIManager.Close(self.UpView)
self.UpView = nil
if self.playerInfoView then
SubUIManager.Close(self.playerInfoView)
self.playerInfoView = nil
end
-- if self.playerInfoView then
-- SubUIManager.Close(self.playerInfoView)
-- self.playerInfoView = nil
-- end
end
return HomeLand