miduo_client/Assets/ManagedResources/~Lua/Modules/TreasureStore/TreasureStoreSeason2.lua

85 lines
2.8 KiB
Lua
Raw Normal View History

require("Base/BasePanel")
local TreasureStoreSeason2 = Inherit(BasePanel)
local _DayTipImageFormat = "p_piaomialzhilv_paizi%2d"
local _DayItemFormat = "第%s天"
local _DayNum = 7
--初始化组件(用于子类重写)
function TreasureStoreSeason2:InitComponent()
Log("TreasureStoreSeason2:InitComponent")
self.helpBtn = Util.GetGameObject(self.gameObject, "helpBtn")
self.dayTip = Util.GetGameObject(self.gameObject, "curDayTipImage/curDayTip"):GetComponent("Image")
self.dayList = Util.GetGameObject(self.gameObject, "dayList")
self.dayPre = Util.GetGameObject(self.gameObject, "dayList/headImage")
self.dayPre:SetActive(false)
-- self.dayScroll = SubUIManager.Open(SubUIConfig.ScrollCycleView,self.dayList.transform, self.dayPre, nil,
-- Vector2.New(self.dayList.transform.rect.width, self.dayList.transform.rect.height), 2, 1, Vector2.New(10,0))
self.taskList = Util.GetGameObject(self.gameObject, "taskList")
self.taskPre = Util.GetGameObject(self.gameObject, "taskList/MissionPre")
self.taskPre:SetActive(false)
-- self.taskScroll = SubUIManager.Open(SubUIConfig.ScrollCycleView,self.dayList.transform, self.dayPre, nil,
-- Vector2.New(self.dayList.transform.rect.width, self.dayList.transform.rect.height), 2, 1, Vector2.New(10,0))
end
--绑定事件(用于子类重写)
function TreasureStoreSeason2:BindEvent()
Log("TreasureStoreSeason2:BindEvent")
end
--添加事件监听(用于子类重写)
function TreasureStoreSeason2:AddListener()
Log("TreasureStoreSeason2:AddListener")
end
--移除事件监听(用于子类重写)
function TreasureStoreSeason2:RemoveListener()
Log("TreasureStoreSeason2:RemoveListener")
end
--界面打开时调用(用于子类重写)
function TreasureStoreSeason2:OnOpen()
Log("TreasureStoreSeason2:OnOpen")
self.CurDay = 1
end
--
function TreasureStoreSeason2:OnFirstCreate()
self.dayItems = {}
self.taskItems = {}
coroutine.start(function()
for i = 1, _DayNum do
self.dayItems[i] = newObjToParent(self.dayPre, self.dayList)
local day = Util.GetGameObject(self.dayItems[i], "name"):GetComponent("Text")
day.text = string.format(_DayItemFormat, NumToChinese[i])
local btn = self.dayItems[i]:GetComponent("Text")
btn.interactable = self.CurDay ~= i
coroutine.wait(0.1)
end
end)
end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function TreasureStoreSeason2:OnShow()
Log("TreasureStoreSeason2:OnShow")
end
--界面关闭时调用(用于子类重写)
function TreasureStoreSeason2:OnClose()
Log("TreasureStoreSeason2:OnClose")
end
--界面销毁时调用(用于子类重写)
function TreasureStoreSeason2:OnDestroy()
Log("TreasureStoreSeason2:OnDestroy")
end
return TreasureStoreSeason2