-- 势力工资 local UIGuildSalary = UIViewClass() local Const_First_Day = 3 local Const_Second_Day = 7 function UIGuildSalary:OnOpened(context) self:RegistSystemEvent(EventID.UI_Guild_FamousInfoRefresh, self.RefreshPanel) UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS["IDS_GuildSalary_FunctionName"]) UIUtils.SetActive(self.UITemplateTitlePanel.btn_Info, true) MDL.Guild.GetGuildSalaryInfoReq() end function UIGuildSalary:UpdateTimerFunc() self:StopRepeatFunc(self.UpdateTimerFunc) local times = MDL.Guild.GetHasBalanceNums() if times <= 1 then local customStr, customType, refreshInterval = CTL.Guild.GetPeakParam(Const_IDS.IDS_GuildSalary_SalaryDesc1) self.txt_Time:SetCustomString(customStr, 1, customType) local _, leftTime = MDL.Guild.GetGuildBalanceTime() self.txt_Time:ResetAndBeginTimer(false, leftTime) if refreshInterval > 0 then self:StartRepeatFunc(self.UpdateTimerFunc, refreshInterval + 1, 1) end else self.txt_Time:EndTimer() local param1, param2 = UTL.Time.GetDateDescAndTime({[1] = DataSheetManager.ConstData:GetDataByID("GuildLeaderInspireRankTime").IntValue}) self.txt_Time:SetCDLabel(string.FormatByIdsId(Const_IDS.IDS_GuildSalary_SalaryDesc1, string.Concat(param1, param2))) end end function UIGuildSalary:RefreshPanel() self.famousInfo = MDL.Guild.GetMyFamousInfo() self.loop_SalaryReward:ClearCells() for i, v in ipairs(MDL.Guild.GetSalaryRewards()) do self.loop_SalaryReward:AddData(v, 0) end UIUtils.SetActive(self.group_Box.btn_Get, false) if self.famousInfo.hasRewardSalary then -- 已领取 self.group_Box.effect_Available:StopUIEffect() UIUtils.SetActive(self.group_Box.img_LightDec, false) self:UpdateTimerFunc() else -- 未领取 if self.famousInfo.hasFirstBalance then -- 首次结算之后 self.group_Box.effect_Available:PlayUIEffect() UIUtils.SetActive(self.group_Box.img_LightDec, true) UIUtils.SetActive(self.group_Box.btn_Get, true) self:StopRepeatFunc(self.UpdateTimerFunc) self.txt_Time:EndTimer() self.txt_Time:SetCDLabel(UIUtils.GetLocalizedTxt(Const_IDS.IDS_GuildSalary_SalaryDesc2)) else self.group_Box.effect_Available:StopUIEffect() UIUtils.SetActive(self.group_Box.img_LightDec, false) self:UpdateTimerFunc() end end -- 领取红点 self.group_Box.btn_Get:SetRedPoint(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.Guild_Welfare_Salary)) -- 工资预览放大镜 UIUtils.SetActive(self.btn_Reward, MDL.Guild.GetSalaryIsFamousGuild() and MDL.Guild.IsGuildSalaryManagement()) local totalValue = 0 if self.famousInfo.hasFirstBalance == false or self.famousInfo.hasRewardSalary then --显示当期数据 if MDL.Guild.GetHasBalanceNums() < 2 then totalValue = Const_First_Day * DataSheetManager.ConstData:GetDataByID("GuildDailyContributionRequirement").IntValue else totalValue = Const_Second_Day * DataSheetManager.ConstData:GetDataByID("GuildDailyContributionRequirement").IntValue end else --显示上期数据 local num = MDL.Guild.GetHasBalanceNums() - 1 if num < 2 then totalValue = Const_First_Day * DataSheetManager.ConstData:GetDataByID("GuildDailyContributionRequirement").IntValue else totalValue = Const_Second_Day * DataSheetManager.ConstData:GetDataByID("GuildDailyContributionRequirement").IntValue end end if self.famousInfo.contribute >= totalValue then if MDL.Guild.GetSalaryIsFamousGuild() then -- 自己是名门 self.state_icon_reward:SetState(1) else -- 自己不是名门 self.state_icon_reward:SetState(0) end else self.state_icon_reward:SetState(2) end if self.famousInfo.hasRewardSalary then self.txt_Info.text = string.FormatByIdsId(Const_IDS.IDS_GuildLeaderInspire_MoreReward2, self.famousInfo.contribute .. "/" .. totalValue) else if self.famousInfo.contribute >= totalValue then self.txt_Info.text = string.FormatByIdsId(Const_IDS.IDS_GuildLeaderInspire_MoreReward2, UTL.Color.FormatGreenColor(self.famousInfo.contribute) .. "/" .. totalValue) else self.txt_Info.text = string.FormatByIdsId(Const_IDS.IDS_GuildLeaderInspire_MoreReward2, UTL.Color.FormatRedColor(self.famousInfo.contribute) .. "/" .. totalValue) end end end function UIGuildSalary:OnBackButtonPressed() self:OnButtonClicked(self.UITemplateTitlePanel.btn_close) end function UIGuildSalary:OnButtonClicked(comp) if comp == self.btn_Rank then CTL.Rank.OpenRankPanelByType(MDL.Rank.RankType.Guild) elseif comp == self.UITemplateTitlePanel.btn_close then self:CloseView() elseif comp == self.UITemplateTitlePanel.btn_Home then CTL.HomeMain.CloseViewBackHomeMain() elseif comp == self.group_Box.btn_Get then MDL.Guild.RewardSalaryReq() elseif comp == self.btn_Info then UIManager.OpenView(Const_UI_Lua.UIEnum.UIGuildFamousPop) elseif comp == self.btn_Reward then UIManager.OpenView(Const_UI_Lua.UIEnum.UIGuildSalaryPop) elseif comp == self.UITemplateTitlePanel.btn_Info then UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonNoteView, { id = LuaConst.NoteID.GuildSalary }) elseif comp == self.btn_go then CTL.Guild.OpenGuildMain({ selectIndex = 2 }) end end function UIGuildSalary:OnCellInit(scrollRect, index, cellTable, data) UTL.Item.SetItemCell(cellTable.item, data.itemId, data.itemNum) UIUtils.SetActive(cellTable.item.group_txt_Elite.gameObject, not data.isBase) UIUtils.SetLabelText(cellTable.item.txt_Elite, Const_IDS["IDS_TAG_Name_10001_Active"]) end function UIGuildSalary:OnCellClicked(scrollRect, index, cellTable, target, data) UTL.ItemTips.ShowCommonTipsById(data.itemId) end return UIGuildSalary