特权添加时间
parent
dea7c12ded
commit
965f9c19e9
|
@ -291,31 +291,31 @@ function EveryDayGift:OnDestroy()
|
|||
end
|
||||
end
|
||||
|
||||
-- --特权商城专属
|
||||
-- function EveryDayGift:SpecialTime(t)
|
||||
-- if not t or t < 0 then
|
||||
-- return Language[11749]
|
||||
-- end
|
||||
-- local _sec = t % 60
|
||||
-- local allMin = math.floor(t / 60)
|
||||
-- local _min = allMin % 60
|
||||
-- local allHour = math.floor(t / 3600)
|
||||
-- local _hour = allHour % 24
|
||||
-- local allDays = math.floor(t / 86400)
|
||||
--特权商城专属
|
||||
function EveryDayGift:SpecialTime(t)
|
||||
if not t or t < 0 then
|
||||
return Language[11749]
|
||||
end
|
||||
local _sec = t % 60
|
||||
local allMin = math.floor(t / 60)
|
||||
local _min = allMin % 60
|
||||
local allHour = math.floor(t / 3600)
|
||||
local _hour = allHour % 24
|
||||
local allDays = math.floor(t / 86400)
|
||||
|
||||
-- if allDays>=1 then
|
||||
-- return string.format(Language[11750],allDays),allDays
|
||||
-- else
|
||||
-- if _hour>=1 then
|
||||
-- return string.format(Language[11751], _hour), _hour
|
||||
-- else
|
||||
-- if _min>=1 then
|
||||
-- return string.format(Language[11752], _min), _min
|
||||
-- else
|
||||
-- return "1分"
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
-- return Language[11749]
|
||||
-- end
|
||||
if allDays>=1 then
|
||||
return string.format(Language[11703],allDays),allDays
|
||||
else
|
||||
if _hour>=1 then
|
||||
return string.format(Language[11704], _hour), _hour
|
||||
else
|
||||
if _min>=1 then
|
||||
return string.format(Language[11705], _min), _min
|
||||
else
|
||||
return Language[12152]
|
||||
end
|
||||
end
|
||||
end
|
||||
return Language[11749]
|
||||
end
|
||||
return EveryDayGift
|
|
@ -255,9 +255,26 @@ function GiftPre:SetIcon(_itemdata)
|
|||
self.icon.gameObject:SetActive(false)
|
||||
end
|
||||
self.price.text = _itemdata.data.price
|
||||
self.buyInfo.text = self.isCanBuy == 2 and "" or _itemdata.data.buyInfo
|
||||
if self.isCanBuy == 2 then
|
||||
self.icon.gameObject:SetActive(false)
|
||||
self.price.text = "已购买"
|
||||
if self.data.DataType == DataType.Direct and self.data.buyType == DirectBuyType.FINDTREASURE_GIFT then
|
||||
if self.time then
|
||||
self.time:Stop()
|
||||
self.time = nil
|
||||
end
|
||||
local fresh = _itemdata.data.endTime - GetTimeStamp()
|
||||
self.buyInfo.text = Language[10469]..self.parent:SpecialTime(fresh)
|
||||
self.time = Timer.New(function()
|
||||
if fresh <= 0 then
|
||||
self.parent:RefreshData()
|
||||
return
|
||||
end
|
||||
self.buyInfo.text = Language[10469]..self.parent:SpecialTime(fresh)
|
||||
end,1,-1,true)
|
||||
self.time:Start()
|
||||
end
|
||||
end
|
||||
if _itemdata.data.finalNum == 0 and self.isCanBuy == 0 then
|
||||
self.redPoint.gameObject:SetActive(true)
|
||||
|
@ -266,10 +283,13 @@ function GiftPre:SetIcon(_itemdata)
|
|||
end
|
||||
Util.SetGray(self.btnBuy, (self.isCanBuy == 2))
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self.btnBuy.transform)
|
||||
self.buyInfo.text = self.isCanBuy == 2 and "" or _itemdata.data.buyInfo
|
||||
end
|
||||
|
||||
function GiftPre:OnClose()
|
||||
if self.time then
|
||||
self.time:Stop()
|
||||
self.time = nil
|
||||
end
|
||||
DynamicActivityManager.SetSelectIndex(0,{})
|
||||
for k,v in pairs(self.itemList) do
|
||||
SubUIManager.Close(v)
|
||||
|
|
Loading…
Reference in New Issue