| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599 |
- local UIRuneShopExploreView = require("UIRuneShop/UIRuneShopExploreView_Generate")
- function UIRuneShopExploreView:OnAwake(data)
- self.controller = require("UIRuneShop/UIRuneShopExploreCtr"):new()
- self.controller:Init(self)
- self.controller:SetData(data)
- end
- function UIRuneShopExploreView:AddEventListener()
- ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.ROCOIN_CHANGED, self, self.OnRoCoinChanged)
- ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.COIN_CHANGED, self, self.OnCoinChanged)
- ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.DIAMOND_CHANGED, self, self.OnDiamondChanged)
- ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.VIP_LV_CHANGED, self, self.OnVipLvChanged)
- ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.RUNE_SHOP_REWARDS_DATA_CHANGED, self, self.OnRuneShopRewardsDataChanged)
- ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.UI_CLOSEED_TASK_PAGE, self, self.OnCloseTask)
- ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.UI_TASK_JUMP, self, self.OnCloseAirShip)
- end
- function UIRuneShopExploreView:FillContent(data, uiBase)
- self.uiBase = uiBase
- local gameObject = self.uiBase:GetRoot()
- if gameObject ~= nil then
- self.gameObject = gameObject
- self.transform = gameObject.transform
- end
- self:InitGenerate(self.transform, data)
- self:Init()
- end
- function UIRuneShopExploreView:Init()
- self.controller:InitData()
- self.textBox.text.text = string.formatbykey('DscClub04')
- self:RefreshRoCoinView()
- self:RefreshCoinView()
- self:RefreshGoldView()
- self:RefreshVipView()
- self.rewardsBoxItem.scrollView.loopGridView:InitGridView(0, function(loopGridView, itemIdx, row, column)
- return self:GetItemByRowColumnRewards(loopGridView, itemIdx, row, column)
- end, nil, nil)
- self:RefreshRewardsView()
- end
- function UIRuneShopExploreView:RemoveEventListener()
- ManagerContainer.LuaEventMgr:Unregister(self.uiData.name)
- end
- function UIRuneShopExploreView:AddUIEventListener()
- self.uiBase:AddButtonUniqueEventListener(self.btnClose.button, self, self.OnClickCloseBtn)
- self.uiBase:AddButtonUniqueEventListener(self.btnVIP.button, self, self.OnClickVipBtn)
- self.uiBase:AddButtonUniqueEventListener(self.rewardsBoxItem.btnPlayRule.button, self, self.OnClickPlayRuleBtn)
- self.uiBase:AddButtonUniqueEventListener(self.rewardsBoxItem.btnBuyMore.button, self, self.OnClickBuyAdvancedRewardsBtn)
- self.uiBase:AddButtonUniqueEventListener(self.btnTaskExp.button, self, self.OnClickTaskExpBtn)
- end
- function UIRuneShopExploreView:OnHide()
- end
- function UIRuneShopExploreView:OnShow(data)
- self.controller:SetData(data)
- end
- function UIRuneShopExploreView:OnClose()
- end
- function UIRuneShopExploreView:OnDispose()
- self:DisposeRefreshTimer()
- if self.rewardsBoxItem then
- self.rewardsBoxItem.scrollView.loopGridView:Dispose()
- end
- self.controller:OnDispose()
- end
- function UIRuneShopExploreView:OnClickCloseBtn()
- ManagerContainer.LuaUIMgr:OpenSourceUI(self)
- end
- function UIRuneShopExploreView:OnClickVipBtn()
- ManagerContainer.LuaUIMgr:Open(Enum.UIPageName.UIVip)
- end
- function UIRuneShopExploreView:OnClickPlayRuleBtn()
- ManagerContainer.LuaUIMgr:Open(Enum.UIPageName.UIPlayRule, {'PlayExplainTitle', 'AirshipText'})
- end
- function UIRuneShopExploreView:OnClickTaskExpBtn()
- ManagerContainer.DataMgr.TaskDataNew:OpenTaskPanel();
- end
- function UIRuneShopExploreView:OnClickBuyAdvancedRewardsBtn()
- ManagerContainer.LuaUIMgr:Open(Enum.UIPageName.UIRewardsBuyTips)
- end
- function UIRuneShopExploreView:OnClickGetAdvancedRewardBtn()
- if self.rewardsBaseData:GetMaxRewardsNum() > 0 then
- ManagerContainer.NetManager:SendMessage(ProtoMsgId.CS_EXPLORE_EXTRA_REWARD_REQ)
- end
- end
- function UIRuneShopExploreView:OnCloseTask()
- ManagerContainer.NetManager:SendMessage(ProtoMsgId.CS_EXPLORE_INFO_REQ)
- end
- function UIRuneShopExploreView:OnCloseAirShip()
- ManagerContainer.LuaUIMgr:Close(Enum.UIPageName.UIRuneShopExplore)
- end
- function UIRuneShopExploreView:OnRoCoinChanged()
- self:RefreshRoCoinView()
- end
- function UIRuneShopExploreView:OnCoinChanged()
- self:RefreshCoinView()
- end
- function UIRuneShopExploreView:OnDiamondChanged()
- self:RefreshGoldView()
- end
- function UIRuneShopExploreView:OnVipLvChanged()
- self:RefreshVipView()
- end
- function UIRuneShopExploreView:OnRuneShopRewardsDataChanged()
- self:RefreshRewardsView()
- end
- function UIRuneShopExploreView:RefreshRoCoinView()
- self.ro.number.text.text = CommonUtil.FormatNumber(self.controller:GetOwnResCountByItemId(Enum.ItemType.ROCoin))
- end
- function UIRuneShopExploreView:RefreshCoinView()
- self.coin.number.text.text = CommonUtil.FormatNumber(self.controller:GetOwnResCountByItemId(Enum.ItemType.Coin))
- end
- function UIRuneShopExploreView:RefreshGoldView()
- self.gold.number.text.text = CommonUtil.FormatNumber(self.controller:GetOwnResCountByItemId(Enum.ItemType.Diamond))
- end
- function UIRuneShopExploreView:RefreshVipView()
- local curVipLv = self.controller:GetCurVipLv()
- local vipCfg = ManagerContainer.CfgMgr:GetVipCfgById(curVipLv)
- self.vipIcon.image.sprite = nil
- self.vipIcon.image.enabled = false
- self.vipFrame.image.sprite = nil
- self.vipFrame.image.enabled = false
- if not vipCfg then
- self.vipNameTxt.text.text = ''
- return
- end
- CommonUtil.LoadIcon(self, vipCfg.BigIcon, function(sprite)
- if sprite then
- self.vipIcon.image.sprite = sprite
- self.vipIcon.image.enabled = true
- end
- end)
- CommonUtil.LoadIcon(self, vipCfg.BigFrame, function(sprite)
- if sprite then
- self.vipFrame.image.sprite = sprite
- self.vipFrame.image.enabled = true
- end
- end)
- self.vipNameTxt.text.text = string.formatbykey(vipCfg.Name)
- end
- --悬赏战令页面
- function UIRuneShopExploreView:RefreshRewardsView()
- if not self.rewardsBoxItem then return end
- if ManagerContainer.DataMgr.RuneShopDataMgr.isRewardsDataDirty then
- self.rewardsBoxItem:SetActive(false)
- return
- end
- self.rewardsBoxItem:SetActive(true)
- self.rewardsBaseData = self.controller:GetRewardsBaseData()
- local showGoodsDatas = self.rewardsBaseData:GetShowRewardsData()
- local curLv = self.rewardsBaseData:GetShowRewardsCurLv()
- local curExp = self.rewardsBaseData:GetShowRewardsCurExp()
- local curCfg = self.rewardsBaseData:GetRewardsCurRoundCfg()
- if not curCfg then
- self.rewardsBoxItem:SetActive(false)
- return
- end
- self.isShowAirShip = false
- local length = (showGoodsDatas and #showGoodsDatas or 0)
- ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.RED_POINT_MGR_NOTICE, Enum.RPNotifyType.RuneShopRewards, false)
- --页面下方关于当前等级的信息展示
- local nextlv = curLv + 1
- if nextlv > length then
- nextlv = length
- end
- if curLv == length then
- self.rewardsmax:SetActive(true)
- self.numexp.text.text = tostring(curExp)..'/'.. tostring(curCfg.ExpCost)
- self.expSlider.slider.value = curExp/curCfg.ExpCost
- else
- self.rewardsmax:SetActive(false)
- self.curLvData = self.controller:GetShowRewardsDataByIdx(nextlv)
- self.numexp.text.text = tostring(curExp)..'/'.. tostring(self.curLvData.cfgData.Exp)
- self.expSlider.slider.value = curExp/self.curLvData.cfgData.Exp
- end
- self.rewardslv.text.text = tostring(curLv)
- self.rewardsBoxItem.btnBuyMore.num.text.text = tostring(curCfg.MissonExpUp)..'%'
- self.expUpBlue.num.text.text = tostring(curCfg.MissonExpUp)..'%'
- --根据等级经验 刷新小游艇
- local newLv =length - curLv
- --因为多一个开始节点和结束最终奖励节点,所以+2
- self.rewardsBoxItem.scrollView.loopGridView:RecycleAllItem()
- if self.isInited then
- self.rewardsBoxItem.scrollView.loopGridView:RefreshListByIndex(length+2 )
- else
- self.rewardsBoxItem.scrollView.loopGridView:RefreshListByIndex(length+2 , newLv)
- end
- self.rewardsBoxItem.scrollView.loopGridView.mOnBeginDragAction = function(gridView)
- self:RefreshBigRewardsFloatTips(gridView)
- end
- self.rewardsBoxItem.scrollView.loopGridView.mOnDragingAction = function(gridView)
- self:RefreshBigRewardsFloatTips(gridView)
- end
- self.rewardsBoxItem.scrollView.loopGridView.mOnEndDragAction = function(gridView)
- self:RefreshBigRewardsFloatTips(gridView)
- end
-
-
- self.isInited = true
- local isCash = self.rewardsBaseData:GetRewardsIsCash()
- if isCash == 1 then
- self.rewardsBoxItem.btnBuyMore:SetActive(false)
- self.rewardsBoxItem.labelUnLocked:SetActive(true)
- self.expUpBlue:SetActive(true)
- else
- self.rewardsBoxItem.btnBuyMore:SetActive(true)
- self.rewardsBoxItem.labelUnLocked:SetActive(false)
- self.expUpBlue:SetActive(false)
- end
-
- local endTime = self.rewardsBaseData:RefreshRewaradsRemainTime()
- if endTime then
- self:StartRefreshTimer(self.rewardsBoxItem, true)
- if endTime < 0 then endTime = 0 end
- self:RefreshBigRewardsFloatTips(nil)
- self.rewardsBoxItem.timeBox:SetActive(true)
- self.rewardsBoxItem.timeBox.textTime.text.text = string.formatbykey('AirshipTime', DateTimeUtil.convertSeconds2TimeStr1(endTime, true, true, false))
- else
- self:StopRefreshTimer(self.rewardsBoxItem)
- self.rewardsBoxItem.timeBox:SetActive(false)
- end
-
- end
- --大奖标签跳转
- function UIRuneShopExploreView:JumpToTarget(button , params)
- local data = clone(params[0])
- self.rewardsBoxItem.scrollView.loopGridView:RefreshListByIndex(#self.controller:GetShowRewardsData()+2 , data.targetid)
- self:RefreshBigRewardsFloatTips()
- end
- --设置悬赏单个对象
- function UIRuneShopExploreView:UpdateRewardsItem(itemLua, idx, data, isEnd)
- local curExp = self.rewardsBaseData:GetShowRewardsCurExp()
- local curLv = self.rewardsBaseData:GetShowRewardsCurLv()
- --最终奖励宝箱
- if isEnd then
- self.uiBase:AddButtonUniqueEventListener(itemLua.btnBuyMore.button, self, self.OnClickGetAdvancedRewardBtn)
- local costExp = ManagerContainer.CfgMgr:GetRuneShopExploreCfgByRound(self.rewardsBaseData:GetShowRewardsRoundData()).ExpCost
- if self.rewardsBaseData:GetMaxRewardsNum() > 0 then
- itemLua.chestAnim.animator:Play('Open')
- itemLua.redPoint:SetActive(true)
- itemLua.btnBuyMore.num.text.text = tostring(self.rewardsBaseData:GetMaxRewardsNum())
- ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.RED_POINT_MGR_NOTICE, Enum.RPNotifyType.RuneShopRewards, true)
- else
- itemLua.chestAnim.animator:Play('Close')
- itemLua.redPoint:SetActive(false)
- end
- if self.rewardsBaseData:GetRewardsIsMax() then
- itemLua.airShip:SetActive(true)
- itemLua.levelSlider.slider.value = 1
- else
- if curLv == #self.rewardsBaseData:GetShowRewardsData() then
- itemLua.airShip:SetActive(true)
- itemLua.levelSlider.slider.value = curExp/costExp
- else
- itemLua.airShip:SetActive(false)
- end
- end
- itemLua.dsc.text.text.text = string.formatbykey("DscRewardsMax",tostring(costExp),'1')
- --通用item
- else
- --0级开始
- if idx == 0 then
- itemLua.startItem:SetActive(true)
- itemLua.rewardsBox2:SetActive(false)
- itemLua.levelBox2:SetActive(false)
- if curLv == 0 and curExp/self.curLvData.cfgData.Exp < 0.15 then
- itemLua.startItem.airShip:SetActive(true)
- else
- itemLua.startItem.airShip:SetActive(false)
- end
- --常规等级
- else
- CommonUtil.UpdateItemPrefab(self, itemLua, data, Enum.ItemIEnterType.Bag, self, nil)
- --self.tempItemLua = itemLua
- itemLua.numlv.text.text = idx
-
- itemLua.startItem:SetActive(false)
- itemLua.rewardsBox2:SetActive(true)
- itemLua.levelBox2:SetActive(true)
- itemLua.rewardsBox2.bgyellow:SetActive(false)
- if data.cfgData.RewardSign > 0 then
- itemLua.rewardsBox2.bgyellow:SetActive(true)
- end
-
- if data.isReward then
- --0为 默认状态
- if data.isReward == 0 then
- itemLua.rewardsLeft.arrived:SetActive(false)
- itemLua.rewardsLeft.received:SetActive(false)
-
- --1为已领取
- elseif data.isReward == 1 then
- itemLua.rewardsLeft.arrived:SetActive(false)
- itemLua.rewardsLeft.received:SetActive(true)
- --可领取
- elseif data.isReward == 2 then
- itemLua.rewardsLeft.arrived:SetActive(true)
- itemLua.rewardsLeft.received:SetActive(false)
- end
- else
- itemLua.rewardsLeft.arrived:SetActive(false)
- itemLua.rewardsLeft.received:SetActive(false)
- end
- if data.isCashReward and self.rewardsBaseData:GetRewardsIsCash()==1 then
- --0为 默认状态
- if data.isCashReward == 0 then
- itemLua.rewardsRight.arrived:SetActive(false)
- itemLua.rewardsRight.received:SetActive(false)
-
- --1为已领取
- elseif data.isCashReward == 1 then
- itemLua.rewardsRight.arrived:SetActive(false)
- itemLua.rewardsRight.received:SetActive(true)
- --可领取
- elseif data.isCashReward == 2 then
- itemLua.rewardsRight.arrived:SetActive(true)
- itemLua.rewardsRight.received:SetActive(false)
- end
- else
- itemLua.rewardsRight.arrived:SetActive(false)
- itemLua.rewardsRight.received:SetActive(false)
- end
-
- itemLua.activity:SetActive(false)
- --直接根据等级判断,小于当前等级的直接拉满,大于当前等级的则为空
- if curLv+1 > idx then
- itemLua.levelSlider.slider.value = 1
- itemLua.activity:SetActive(true)
- elseif curLv < idx+1 then
- itemLua.levelSlider.slider.value = 0
- end
-
- --左侧经验条slider,因遮挡问题,只有经验超出10%,小飞机才会飞到下一级
- if curLv == #self.rewardsBaseData:GetShowRewardsData() then
- itemLua.airShip:SetActive(false)
- else
- if curLv+1 == idx and curExp/self.curLvData.cfgData.Exp > 0.15 then
- itemLua.airShip:SetActive(true)
- --LogError('aaacc'..curExp.."aac"..self.curLvData.cfgData.Exp)
- itemLua.levelSlider.slider.value = curExp/self.curLvData.cfgData.Exp
- self.isShowAirShip = true
- else
- if curLv == idx and not self.isShowAirShip then
- itemLua.airShip:SetActive(true)
- --itemLua.levelSlider.slider.value = self.controller:GetShowRewardsCurExp()/self.curLvData.cfgData.Exp
- else
- itemLua.airShip:SetActive(false)
- end
-
- end
- end
-
- end
- end
- end
- function UIRuneShopExploreView:RefreshBigRewardsFloatTips(gridView)
- --通过content高度计算当前处于哪个位置
- local py = self.rewardsBoxItem.scrollView.content.transform.localPosition.y
- local mid = #self.rewardsBaseData:GetShowRewardsData() - self:Toint(py/240)
- --下方的大奖小图标
- local minid = self.controller:GetShowReardsNearMinCashReward(mid -3)
- if minid then
- self.rewardsBoxItem.btnGotoDown:SetActive(true)
- local logicData ={}
- local rdata=self.controller:GetShowRewardsDataByIdx(minid)
- if rdata.cfgData.RewardSign == 1 then
- logicData = {cfgId = rdata.cfgData.Reward[1][1],num = rdata.cfgData.Reward[1][2] , targetid = #self.controller:GetShowRewardsData()-minid}
- elseif rdata.cfgData.RewardSign == 2 then
- logicData = {cfgId = rdata.cfgData.CashReward[1][1],num = rdata.cfgData.CashReward[1][2] , targetid = #self.controller:GetShowRewardsData()-minid}
- end
-
- CommonUtil.UpdateItemPrefab(self, self.rewardsBoxItem.btnGotoDown.iconSmallItem, logicData, Enum.ItemIEnterType.Bag, self, self.JumpToTarget)
- else
- self.rewardsBoxItem.btnGotoDown:SetActive(false)
- end
- --上方的大奖小图标
- local maxid = self.controller:GetShowReardsNearMaxCashReward(mid +3)
- if maxid then
- self.rewardsBoxItem.btnGotoUp:SetActive(true)
- local logicData ={}
- local rdata=self.controller:GetShowRewardsDataByIdx(maxid)
- if rdata.cfgData.RewardSign == 1 then
- logicData = {cfgId = rdata.cfgData.Reward[1][1],num = rdata.cfgData.Reward[1][2] , targetid = #self.controller:GetShowRewardsData()-maxid}
- elseif rdata.cfgData.RewardSign == 2 then
- logicData = {cfgId = rdata.cfgData.CashReward[1][1],num = rdata.cfgData.CashReward[1][2] , targetid = #self.controller:GetShowRewardsData()-maxid}
- end
-
- CommonUtil.UpdateItemPrefab(self, self.rewardsBoxItem.btnGotoUp.iconSmallItem, logicData, Enum.ItemIEnterType.Bag, self, self.JumpToTarget)
- else
- self.rewardsBoxItem.btnGotoUp:SetActive(false)
- end
- end
- function UIRuneShopExploreView:Toint(n)
- local s = tostring(n)
- local i,j = s:find('%.')
- if i then
- return tonumber(s:sub(1,i-1))
- else
- return n
- end
- end
- function UIRuneShopExploreView:GetItemByRowColumnRewards(loopGridView, itemIdx, row, column)
- --通用等级奖励
- local item
- if itemIdx == 0 then
- item = loopGridView:NewListViewItem('CloudTop')
- local itemEndLua = CommonUtil.BindGridViewItem2Lua(self, 'CloudTop', item.gameObject)
- self:UpdateRewardsItem(itemEndLua , itemIdx , data ,true)
- else
- item = loopGridView:NewListViewItem('RuneShopRewardsItem')
- local itemLua = CommonUtil.BindGridViewItem2Lua(self, 'RuneShopRewardsItem', item.gameObject)
- local data
- local showGoodsDatas = self.controller:GetShowRewardsData()
- local length = (showGoodsDatas and #showGoodsDatas or 0)
- if itemIdx-1 < length then
- data = self.controller:GetShowRewardsDataByIdx(length-(itemIdx-1))
- end
- self:UpdateRewardsItem(itemLua , length-(itemIdx-1) , data)
- end
- return item
- end
- function UIRuneShopExploreView:RefreshCurrenyItem(itemLua, itemCfgId, itemNum, ignoreIcon)
- if not itemCfgId or not itemNum then
- itemLua:SetActive(false)
- return
- end
- itemLua.number.text.text = CommonUtil.FormatNumber(itemNum)
- itemLua:SetActive(true)
- if ignoreIcon then return end
- itemLua.icon.image.sprite = nil
- itemLua.icon.image.enabled = false
- local itemCfgData = ManagerContainer.CfgMgr:GetItemById(itemCfgId)
- if itemCfgData then
- CommonUtil.LoadIcon(self, itemCfgData.MiniIcon, function(sprite)
- if sprite then
- itemLua.icon.image.sprite = sprite
- itemLua.icon.image.enabled = true
- end
- end)
- end
- end
- function UIRuneShopExploreView:StartRefreshTimer(itemLua, goodsData)
- local timer = self.refreshTimer
- if not timer then
- timer = Timer.New(slot(self.RefreshTimer, self), 1, -1)
- self.refreshTimer = timer
- end
- local updateItemMap = timer.updateItemMap
- if not updateItemMap then
- updateItemMap = {}
- timer.updateItemMap = updateItemMap
- end
- updateItemMap[itemLua] = goodsData
- if not timer.running then
- timer:Start()
- end
- end
- function UIRuneShopExploreView:StopRefreshTimer(itemLua)
- local timer = self.refreshTimer
- if timer then
- local updateItemMap = timer.updateItemMap
- if updateItemMap then
- updateItemMap[itemLua] = nil
- end
- if not updateItemMap or table_is_empty(updateItemMap) then
- timer:Stop()
- end
- end
- end
- function UIRuneShopExploreView:StopAndClearRefreshTimer()
- if self.refreshTimer then
- self.refreshTimer:Stop()
- self.refreshTimer.time = 1
- self.refreshTimer.duration = 1
- self.refreshTimer.updateItemMap = nil
- end
- end
- function UIRuneShopExploreView:DisposeRefreshTimer()
- self:StopAndClearRefreshTimer()
- self.refreshTimer = nil
- end
- function UIRuneShopExploreView:RefreshTimer()
- local timer = self.refreshTimer
- if not timer then return end
- local updateItemMap = timer.updateItemMap
- if not updateItemMap or table_is_empty(updateItemMap) then
- timer:Stop()
- return
- end
- local minRemainTime = nil
- local endTime = self.controller:GetRewardsRemainTime()
- if endTime then
- if endTime < 0 then
- endTime = 0
- end
- if endTime <= 0 then
- timer.updateItemMap = nil
- if ManagerContainer.LuaUIMgr:HasOpenPage(Enum.UIPageName.UIRewardsBuyTips) then
- ManagerContainer.LuaUIMgr:ClosePage(Enum.UIPageName.UIRewardsBuyTips)
- end
- ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.RED_POINT_MGR_NOTICE, Enum.RPNotifyType.RuneShopRewards, false)
- ManagerContainer.CfgMgr.RuneShopExploreRewardCfg =nil
- ManagerContainer.CfgMgr.RuneShopRoundMap = nil
- self.rewardsToggle:SetActive(false)
- end
- self.rewardsBoxItem.timeBox:SetActive(true)
- self.rewardsBoxItem.timeBox.textTime.text.text = string.formatbykey('AirshipTime', DateTimeUtil.convertSeconds2TimeStr1(endTime, true, true, false))
- else
- self.rewardsBoxItem.timeBox:SetActive(false)
- timer.updateItemMap = nil
- end
- if endTime and endTime > 0 then
- if not minRemainTime or minRemainTime > endTime then
- minRemainTime = endTime
- end
- end
- if not minRemainTime or minRemainTime <= 0 then
- self:StopRefreshTimer()
- else
- -- 降低刷新频率
- if self.refreshTimer then
- local validTime = nil
- if minRemainTime >= 86400 then
- validTime = minRemainTime % 3600
- if validTime == 0 then validTime = 3600 end
- elseif minRemainTime >= 3600 then
- validTime = minRemainTime % 60
- if validTime == 0 then validTime = 60 end
- else
- validTime = 1
- end
- if validTime then
- self.refreshTimer.duration = validTime
- else
- self:StopRefreshTimer()
- end
- end
- end
- end
- return UIRuneShopExploreView
|