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