local UIClimbTowerEntry = UIViewClass() local IMAGE_PREFIX = "zr_msz_%s.png" function UIClimbTowerEntry:OnOpened(context) self:RegistSystemEvent(EventID.UI_UpdateClimbTowerInfo, self.RefreshTowerInfo) -- 爬塔信息刷新 self:RegistSystemEvent(CTL.RedPoint.RedPointKey.ClimbTowerEntry_ClimbMain, self.RefreshTowerRed) -- 爬塔信息刷新 self:RegistSystemEvent(EventID.FunctionUnlockUpdate, self.CheckIfFuncUnlock) -- GMS self:RegistSystemEvent(EventID.UI_UpdateNationClimbTowerInfo, self.RefreshPanel) -- 四国数据刷新 self:RegistSystemEvent(CTL.RedPoint.RedPointKey.ClimbTowerEntry_Challenge, self.RefreshTowerRed) -- 可挑战红点 self:RegistSystemEvent(CTL.RedPoint.RedPointKey.ClimbTowerEntry_Progress, self.RefreshTowerRed) -- 历程红点 self:RegistSystemEvent(CTL.RedPoint.RedPointKey.ClimbTowerEntry_LineUp, self.RefreshTowerRed) -- 布阵红点 UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS['IDS_NewClimbTower_Rank']) self.nationUIGroup = { [1] = self.group_Wei, [2] = self.group_Shu, [3] = self.group_Wu, [4] = self.group_Qun } self:RefreshPanel() self:UIAdjustRegion() UTL.UIRender.AdaptiveImageSizeFit(self.img_Bottom, true) end function UIClimbTowerEntry:CheckIfFuncUnlock(funcId, isUnlock) if funcId and funcId == MDL.Unlock.FunctionType.ClimbTower and not MDL.Unlock.IsUnlock(funcId) then CTL.NationClimbTower.CloseAllClimbView() elseif funcId and funcId == MDL.Unlock.FunctionType.NationClimbTower then self:RefreshNationTowerInfo() end end function UIClimbTowerEntry:RefreshPanel() self.openType, self.openLevel = MDL.NationClimbTower.GetTowerOpenInfo() self:RefreshNationTowerInfo() self:RefreshTowerInfo() self:RefreshAllPassRewards() self:RefreshTowerRed() end -- 爬塔信息 function UIClimbTowerEntry:RefreshTowerInfo() local nextConfig = CTL.ClimbTower.GetNextLevelConfig() if nextConfig then UIUtils.SetLabel(self.group_ClimbTower.txt_Level, CTL.ClimbTower.GetClimbTowerLevelCoundText(nextConfig)) else UIUtils.SetLabel(self.group_ClimbTower.txt_Level,nil) end end -- 四国爬塔按钮信息 function UIClimbTowerEntry:RefreshNationTowerInfo() -- 四国解锁信息 local isUnlock = MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.FourNationClimbTower) local timeInfo = CTL.ClimbTower.GetOpenTimeDesc() self.group_ClimbTower.txt_TimeInfo.text = timeInfo UIUtils.SetActive(self.group_ClimbTower.group_TimeInfo, not string.isNilOrEmpty(timeInfo)) if not isUnlock then UIUtils.SetLabel(self.txt_TitleInfo, CTL.NationClimbTower.GetNationClimbTowerUnlockDes()) else if not GameAppInfo.IsOverseaPackage() then UIUtils.SetActive(self.group_ClimbTower.group_TimeInfo, false) self.txt_TitleInfo.text = timeInfo else self.txt_TitleInfo.text = CTL.NationClimbTower.GetOpenTimeDesc() end end for towerType, col in ipairs(self.nationUIGroup) do UIUtils.SetLocalizationImage(col.img_Icon, string.format(IMAGE_PREFIX, towerType)) if isUnlock then UIUtils.SetActive(col.txt_Time, true) UIUtils.SetActive(col.txt_Level, true) UIUtils.SetActive(col.effect_Light, towerType == self.openType) col.UIState_Open:SetState(towerType == self.openType and 1 or 0) local _, openDayDes = CTL.NationClimbTower.GetOpenDayDiff(towerType, self.openType) if not CTL.NationClimbTower.IsDuringOpenTime() and towerType == self.openType then UIUtils.SetLabelText(col.txt_Time, Const_IDS["IDS_NationClimbTower_Closeing"]) else UIUtils.SetLabel(col.txt_Time, openDayDes) end UIUtils.SetLabel(col.txt_Level, string.FormatByIdsId(Const_IDS["IDS_NationClimbTower_HistoryLevel"], MDL.NationClimbTower.GetNextLevelNumberShow(towerType))) else UIUtils.SetActive(col.effect_Light, false) UIUtils.SetActive(col.txt_Time, false) UIUtils.SetActive(col.txt_Level, false) col.UIState_Open:SetState(0) end end end function UIClimbTowerEntry:RefreshTowerRed() for towerType, col in ipairs(self.nationUIGroup) do if towerType == self.openType then col.btn_Click:SetRedPoint(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.ClimbTowerEntry_Challenge) or CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.ClimbTowerEntry_LineUp)) else col.btn_Click:SetRedPoint(false) end end -- 爬塔红点 self.group_ClimbTower.sprite_Activities:SetRedPoint(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.ClimbTowerEntry_ClimbMain)) -- 历程红点 self.btn_Progress:SetRedPoint(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.ClimbTowerEntry_Progress)) end -- 全通奖励领取信息 function UIClimbTowerEntry:RefreshAllPassRewards() local progress = CTL.NationClimbTower.GetAllPassRewardsProgress() self.allPassConfig = MDL.NationClimbTower.GetCurAllPassNationRewardsData() self.receivedID = MDL.NationClimbTower.GetMaxAllPassRewardID() local finalRewardID = DataSheetManager.NationClimbTowerThroughTower:GetDataCount() -- 奖励为高档且已领取, 中间过程没有此状态 local totalAllPassCount = MDL.NationClimbTower.nationCount local isReceived = self.allPassConfig.ID == finalRewardID and self.receivedID == self.allPassConfig.ID UIUtils.SetActive(self.group_Gift.img_GotReward, isReceived) -- 已领取 UIUtils.SetActive(self.group_Gift.effect_RewardHigh, progress >= totalAllPassCount and not isReceived) -- 可领取 UIUtils.SetActive(self.group_Gift.Handle, progress > 0) UIUtils.SetLabel(self.group_Gift.txt_TotalPoint, string.FormatByIdsId(Const_IDS["IDS_NationClimbTower_Progress2"], progress, totalAllPassCount)) self.group_Gift.slider_Score.value = progress / totalAllPassCount UIUtils.SetLabel(self.group_Gift.lab_Score, string.FormatByIdsId(Const_IDS["IDS_NationClimbTower_Progress1"], self.allPassConfig.ThroughTowerNum)) end function UIClimbTowerEntry:LoadAllPassRewardsItem() local rewards = DataSheetManager.NationClimbTowerRankReward:GetDataByAttrRepeatID(self.allPassConfig.ThroughTowerReward) self.group_Gift.ChestRewardScroll:ReloadAll(rewards.Item_Table) end function UIClimbTowerEntry:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.group_Gift.ChestRewardScroll then UTL.Item.SetItemCell(cellTable.item, data.ItemID, data.ItemNum) end end function UIClimbTowerEntry:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.group_Gift.ChestRewardScroll then UTL.ItemTips.ShowCommonTipsById(data.ItemID) end end function UIClimbTowerEntry:OnBackButtonPressed() self:OnButtonClicked(self.UITemplateTitlePanel.btn_close) end function UIClimbTowerEntry:OnButtonClicked(comp) if comp == self.btn_Rank then CTL.Rank.OpenRankPanelByType(MDL.Rank.RankType.ClimbTower) elseif comp == self.btn_Progress then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UINationClimbTowerProgress) -- 历程 elseif comp == self.UITemplateTitlePanel.btn_close then -- 返回按钮 self:CloseView() elseif comp == self.UITemplateTitlePanel.btn_Home then CTL.HomeMain.CloseViewBackHomeMain() elseif comp == self.UITemplateTitlePanel.btn_Info then -- 玩法说明 UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonNoteView, {id = LuaConst.NoteID.ClimbTower}) elseif comp == self.btn_Shop then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIShopMain, {TabEnum = CTL.PayMall.ShopMainTabEnum.WuDao}) -- 跳转跳转武道商店 elseif comp == self.group_ClimbTower.sprite_Activities then CTL.ClimbTower.OpenNormalClimbTower() elseif comp == self.group_Gift.event_Reward then if CTL.NationClimbTower.IsAllPassRewardsAvailable() then -- 领取奖励 MDL.NationClimbTower.NationTowerGetAllPassAwardReq(self.allPassConfig.ID) return end UIUtils.SetActive(self.group_Gift.info_Reward.gameObject, true) self:LoadAllPassRewardsItem() elseif comp == self.group_Gift.btn_Close then UIUtils.SetActive(self.group_Gift.info_Reward.gameObject, false) else for towerType, col in ipairs(self.nationUIGroup) do if comp == col.btn_Click then -- 解锁和GMS弹出相同提示 if not MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.FourNationClimbTower) then CTL.Tips.AddTipsMsg(CTL.NationClimbTower.GetNationClimbTowerUnlockDes()) return end -- 当日未开启该塔 if towerType ~= MDL.NationClimbTower.GetTowerOpenInfo() then local _, openDayDes = CTL.NationClimbTower.GetOpenDayDiff(towerType, self.openType) CTL.Tips.AddTipsMsg(openDayDes) return end -- 四国爬塔未在活开启时间内 if not CTL.NationClimbTower.IsDuringOpenTime() then CTL.Tips.AddTipsMsg(CTL.NationClimbTower.GetOpenTimeDesc()) return end MDL.FreeLineUp.FreeLineUpGetInfoRequest(MDL.FreeLineUp.FuncType.NationClimbTower) UIManager.OpenAndPushAll( Const_UI_Lua.UIEnum.UINationClimbTowerMainPanel, {towerType = towerType}, "ClimbTower/UIClimbTowerMainPanel" ) return end end end end function UIClimbTowerEntry:UIAdjustRegion() UIUtils.SetActive(self.btn_Shop, not GameAppInfo.IsVietnamPackage()) end return UIClimbTowerEntry