【月卡】月卡界面关闭后报错修改
parent
02be5bb730
commit
bad91c3b25
|
@ -1,8 +1,8 @@
|
|||
|
||||
local MonthCardPage = {}
|
||||
local cardData = {
|
||||
[1] = { curState = 0 ,cardType = MONTH_CARD_TYPE.MONTHCARD,time = nil},
|
||||
[2] = { curState = 0 ,cardType = MONTH_CARD_TYPE.LUXURYMONTHCARD,time = nil}
|
||||
[1] = { curState = 0 ,cardType = MONTH_CARD_TYPE.MONTHCARD},
|
||||
[2] = { curState = 0 ,cardType = MONTH_CARD_TYPE.LUXURYMONTHCARD}
|
||||
}
|
||||
local sortingOrder = 0
|
||||
local addTimeNum = 30 * 24 * 60 * 60
|
||||
|
@ -24,6 +24,7 @@ local offSetX = {
|
|||
function MonthCardPage:InitComponent()
|
||||
self.grid = Util.GetGameObject(self.gameObject, "grid")
|
||||
self.cardPres = {}
|
||||
self.timerList = {}
|
||||
for i= 1 ,self.grid.transform.childCount do
|
||||
self.cardPres[i] = {}
|
||||
self.cardPres[i].go = self.grid.transform:GetChild(i - 1).gameObject
|
||||
|
@ -119,7 +120,7 @@ function MonthCardPage:SetCardShow(i)
|
|||
if dayNum > 0 then
|
||||
self.cardPres[i].time:GetComponent("Text").text = Language[10480] .. dayNum ..Language[10017]
|
||||
else
|
||||
self:SetMonthCardTimes(residueTimeNum,cardData[i].time,self.cardPres[i].time,i)
|
||||
self:SetMonthCardTimes(residueTimeNum,self.cardPres[i].time,i)
|
||||
end
|
||||
if self.curAllMonthCardData[cardData[i].cardType].state == 0 then
|
||||
Util.SetGray(self.cardPres[i].month,false)
|
||||
|
@ -133,24 +134,24 @@ function MonthCardPage:SetCardShow(i)
|
|||
end
|
||||
end
|
||||
|
||||
function MonthCardPage:SetMonthCardTimes(timeNums,timer,timeCom,index)
|
||||
if timer then
|
||||
timer:Stop()
|
||||
timer = nil
|
||||
function MonthCardPage:SetMonthCardTimes(timeNums,timeCom,index)
|
||||
if self.timerList[index] then
|
||||
self.timerList[index]:Stop()
|
||||
self.timerList[index] = nil
|
||||
end
|
||||
timeCom:GetComponent("Text").text = Language[10023]..TimeStampToDateStr3(timeNums)
|
||||
timer = Timer.New(function()
|
||||
self.timerList[index] = Timer.New(function()
|
||||
timeCom:GetComponent("Text").text = Language[10023]..TimeStampToDateStr3(timeNums)
|
||||
if timeNums < 0 then
|
||||
OperatingManager.RefreshMonthCardEnd()
|
||||
self.curAllMonthCardData = OperatingManager.GetMonthCardData()
|
||||
self:SetCardShow(index)
|
||||
timer:Stop()
|
||||
timer = nil
|
||||
self.timerList[index]:Stop()
|
||||
self.timerList[index] = nil
|
||||
end
|
||||
timeNums = timeNums - 1
|
||||
end, 1, -1, true)
|
||||
timer:Start()
|
||||
self.timerList[index]:Start()
|
||||
end
|
||||
|
||||
--界面关闭时调用(用于子类重写)
|
||||
|
@ -160,11 +161,12 @@ end
|
|||
--界面销毁时调用(用于子类重写)
|
||||
function MonthCardPage:OnDestroy()
|
||||
self.cardPres = {}
|
||||
for i = 1, #cardData do
|
||||
if cardData[i].time then
|
||||
cardData[i].time:Stop()
|
||||
cardData[i].time = nil
|
||||
for index = 1, #self.timerList do
|
||||
if self.timerList[index] then
|
||||
self.timerList[index]:Stop()
|
||||
self.timerList[index] = nil
|
||||
end
|
||||
end
|
||||
self.timerList = {}
|
||||
end
|
||||
return MonthCardPage
|
Loading…
Reference in New Issue