礼包整理
This commit is contained in:
parent
d4b477410d
commit
51dfbf1528
@ -43,7 +43,8 @@ end
|
||||
function CoinSellCell:refresh()
|
||||
local actGiftId = DataManager.ShopData:getValidCoinGiftId()
|
||||
if actGiftId and actGiftId > 0 then
|
||||
local cfgInfo = ConfigManager:getConfig("act_gift")[actGiftId]
|
||||
self.actGiftId = actGiftId -- 记录当前金币礼包ID
|
||||
local cfgInfo = ConfigManager:getConfig("act_gift")[self.actGiftId]
|
||||
-- 超值
|
||||
self.offText:setText(tostring(cfgInfo.value) .. "%")
|
||||
-- 限购
|
||||
@ -77,8 +78,13 @@ function CoinSellCell:refresh()
|
||||
self:refreshTime()
|
||||
|
||||
self.clickArea:addClickListener(function()
|
||||
self:onClickGift(actGiftId)
|
||||
self:onClickGift(self.actGiftId)
|
||||
end)
|
||||
else -- 倒计时结束的情况
|
||||
if self.actGiftId then
|
||||
DataManager.ShopData:setDirty()
|
||||
self.actGiftId = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -100,9 +106,8 @@ end
|
||||
|
||||
function CoinSellCell:refreshTime()
|
||||
local remainTime = 0
|
||||
local actId = DataManager.ShopData:getValidCoinGiftId()
|
||||
if actId > 0 then
|
||||
local cfgInfo = DataManager.ShopData:getActGiftConfig()[actId]
|
||||
if self.actGiftId and self.actGiftId > 0 then
|
||||
local cfgInfo = DataManager.ShopData:getActGiftConfig()[self.actGiftId]
|
||||
local triggerTime = DataManager.ShopData:getCoinGiftTriggerTime()
|
||||
remainTime = triggerTime + (cfgInfo.limit_time or 0) * 3600 - Time:getServerTime()
|
||||
if remainTime <= 0 then
|
||||
@ -112,4 +117,12 @@ function CoinSellCell:refreshTime()
|
||||
self.timeText:setText(Time:formatNumTimeStr(remainTime))
|
||||
end
|
||||
|
||||
function CoinSellCell:getCellCount()
|
||||
if self.actGiftId and self.actGiftId > 0 then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
return CoinSellCell
|
||||
@ -39,9 +39,12 @@ function GrowSellCell:refreshTime()
|
||||
end
|
||||
end
|
||||
|
||||
function GrowSellCell:getCellCount()
|
||||
return self.actGifts and #self.actGifts or 0
|
||||
end
|
||||
|
||||
function GrowSellCell:getCellHeight()
|
||||
local cellCount = self.actGifts and #self.actGifts or 0
|
||||
return BASE_CELL_HEIGHT * cellCount
|
||||
return BASE_CELL_HEIGHT * self:getCellCount()
|
||||
end
|
||||
|
||||
function GrowSellCell:getIsOpen()
|
||||
|
||||
@ -181,6 +181,7 @@ function GiftPopUI:updateTime()
|
||||
remainTime = triggerTime + (cfgInfo.limit_time or 0) * 3600 - Time:getServerTime()
|
||||
if remainTime <= 0 then
|
||||
remainTime = 0
|
||||
self:checkNextPopGiftOrClose()
|
||||
end
|
||||
self.timeText:setText(GFunc.getTimeStr(remainTime))
|
||||
end
|
||||
@ -194,6 +195,7 @@ function GiftPopUI:updateTime()
|
||||
remainTime = triggerTime + (cfgInfo.limit_time or 0) * 3600 - Time:getServerTime()
|
||||
if remainTime <= 0 then
|
||||
remainTime = 0
|
||||
self:checkNextPopGiftOrClose()
|
||||
end
|
||||
self.timeText:setText(GFunc.getTimeStr(remainTime))
|
||||
end
|
||||
|
||||
@ -135,12 +135,24 @@ function ShopComp:refreshTime()
|
||||
if self.hotSellCell and self.hotSellCell:getIsOpen() then
|
||||
self.hotSellCell:refreshTime()
|
||||
end
|
||||
local coinCellCount = 0
|
||||
if self.coinSellCell and self.coinSellCell:getIsOpen() then
|
||||
coinCellCount = self.coinSellCell:getCellCount()
|
||||
self.coinSellCell:refreshTime()
|
||||
end
|
||||
if self.coinCellCount ~= coinCellCount then
|
||||
self.coinCellCount = coinCellCount
|
||||
DataManager.ShopData:setDirty()
|
||||
end
|
||||
local growCellCount = 0
|
||||
if self.growSellCell and self.growSellCell:getIsOpen() then
|
||||
growCellCount = self.growSellCell:getCellCount()
|
||||
self.growSellCell:refreshTime()
|
||||
end
|
||||
if self.growCellCount ~= growCellCount then
|
||||
self.growCellCount = growCellCount
|
||||
DataManager.ShopData:setDirty()
|
||||
end
|
||||
end
|
||||
|
||||
function ShopComp:refreshDiscountPage()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user