local UIClimbTowerEarningsInfo = UIViewClass() local EventSystem = require('Event/EventSystem') function UIClimbTowerEarningsInfo:OnOpened(context) self.silverItem = { Id = MDL.Currency.CurrencyType.SilverCoin, Count = 0, } self:RegistSystemEvent(EventID.UI_UpdateClimbTowerInfo, self.UpdateInfo) self.freshInternal = DataSheetManager.ConstData:GetDataByID("ClimbTowerRewardTime").IntValue UIUtils.SetLabelText(self.lab_Info, Const_IDS.IDS_OfficialPrivilege_OfficialGain) self:UpdateInfo() end function UIClimbTowerEarningsInfo:OnClosed() self.cdTimer:EndTimer() MDL.ClimbTower.SetHasNoticeAward(true) EventSystem.Dispatch(EventID.UI_RefreshClimbTowerNoticeAwardRed) end function UIClimbTowerEarningsInfo:UpdateInfo() --当前官职,策划笃定爬塔之前官职已经开放,不用判断是否有无官职 local titleData = MDL.OfficialPosition.GetCurTitleData() if titleData then UIUtils.SetActive(self.txt_Position, true) self.txt_Position.text = string.FormatByIdsId(Const_IDS.IDS_OfficialPrivilege_CurrentOfficialPosition,UTL.Color.FormatQualityText(UIUtils.GetLocalizedTxt(Const_IDS[titleData.Name1]), titleData.QualityColor)) end local totalTime = MDL.ClimbTower.GetTotalDuration() local duration = MDL.ClimbTower.GetHangUpDuration() if duration >= totalTime then self.cdTimer:SetCDLabel(UTL.Color.FormatRedColor(UTL.Time.FormatTimeClockBySeconds(totalTime))) else self.cdTimer:SetAndContinueTimer(true, duration, totalTime) end UIUtils.SetActive(self.txt_Limit, true) self.txt_Limit.text = string.FormatByIdsId(Const_IDS.IDS_OfficialPrivilege_UpperLimit,UTL.Time.TransToHours(totalTime)) UIUtils.SetActive(self.txt_Reward, true) self.txt_Reward.text = string.FormatByIdsId(Const_IDS.IDS_OfficialPrivilege_Addition,MDL.OfficialPosition.GetProfitParam("ClimbTowerProfit")) self.btn_Get:SetRedPoint(CTL.ClimbTower.CheckAwardRed()) if CTL.ClimbTower.IsCanGetAward() then self.btn_Get:SetGray(false) local awardGoods = MDL.ClimbTower.GetAwardGoods() if (awardGoods and #awardGoods > 0) or MDL.ClimbTower.GetAwardSilverCoin() > 0 then UIUtils.SetActive(self.ConditionScroll_Item.gameObject, true) UIUtils.SetActive(self.lab_Tips.gameObject, false) self.ConditionScroll_Item:ReloadAll(awardGoods) if MDL.ClimbTower.GetAwardSilverCoin() > 0 then self.silverItem.Count = MDL.ClimbTower.GetAwardSilverCoin() self.ConditionScroll_Item:InsertData(0, self.silverItem, 0) end else local freshMin = self.freshInternal / UTL.Time.TotalSecondsOneMinute UIUtils.SetActive(self.lab_Tips.gameObject, true) UIUtils.SetActive(self.ConditionScroll_Item.gameObject, false) self.lab_Tips.text = string.FormatByIdsId(Const_IDS.IDS_ClimbTower_NoReward, freshMin) end else local freshMin = self.freshInternal / UTL.Time.TotalSecondsOneMinute UIUtils.SetActive(self.lab_Tips.gameObject, true) UIUtils.SetActive(self.ConditionScroll_Item.gameObject, false) self.lab_Tips.text = string.FormatByIdsId(Const_IDS.IDS_ClimbTower_NoReward, freshMin) self.btn_Get:SetGray(true, true) end end function UIClimbTowerEarningsInfo:OnCellInit(scrollRect, index, cellTable, data) if type(data) == "number" then UTL.Item.SetItemCell(cellTable.UIItem, data, 1) else UTL.Item.SetItemCell(cellTable.UIItem, data.Id, data.Count) end end function UIClimbTowerEarningsInfo:OnCellClicked(scrollRect, index, cellTable, target, data) if type(data) == "number" then UTL.ItemTips.ShowCommonTipsById(data) else UTL.ItemTips.ShowCommonTipsById(data.Id) end end function UIClimbTowerEarningsInfo:OnBackButtonPressed() self:OnButtonClicked(self.btn_Close) end function UIClimbTowerEarningsInfo:OnButtonClicked(comp) if comp == self.btn_Get then if CTL.ClimbTower.IsCanGetAward() then MDL.ClimbTower.GetHangUpRewardsReq() else CTL.Tips.AddTipsMsg(Const_IDS["IDS_ClimbTower_NoRewardTip"]) end elseif comp == self.btn_Close then self:CloseView() end end return UIClimbTowerEarningsInfo