local UIGuildSalaryPop = UIViewClass() local Salary_Bonus_Tab_Data function UIGuildSalaryPop:GetTitle2Content() if Localization.IsAllChinese() then return UIUtils.GetLocalizedTxt(Const_IDS[DataSheetManager.GuildJob:GetDataByID(MDL.Guild.JobEnum.RenshiElder).JobName]) .. "/" .. UIUtils.GetLocalizedTxt(Const_IDS[DataSheetManager.GuildJob:GetDataByID(MDL.Guild.JobEnum.NeishiElder).JobName]) .. "/" .. UIUtils.GetLocalizedTxt(Const_IDS[DataSheetManager.GuildJob:GetDataByID(MDL.Guild.JobEnum.JunshiElder).JobName]) else return UIUtils.GetLocalizedTxt(Const_IDS[DataSheetManager.GuildJob:GetDataByID(MDL.Guild.JobEnum.RenshiElder).JobName]) .. "\n" .. UIUtils.GetLocalizedTxt(Const_IDS[DataSheetManager.GuildJob:GetDataByID(MDL.Guild.JobEnum.NeishiElder).JobName]) .. "\n" .. UIUtils.GetLocalizedTxt(Const_IDS[DataSheetManager.GuildJob:GetDataByID(MDL.Guild.JobEnum.JunshiElder).JobName]) end end function UIGuildSalaryPop:OnOpened(context) Salary_Bonus_Tab_Data = { [1] = { title = UIUtils.GetLocalizedTxt(Const_IDS[DataSheetManager.GuildJob:GetDataByID(MDL.Guild.JobEnum.Leader).JobName]), jobIDDic = { [MDL.Guild.JobEnum.Leader] = true } }, [2] = { title = self:GetTitle2Content(), jobIDDic = { [MDL.Guild.JobEnum.RenshiElder] = true, [MDL.Guild.JobEnum.NeishiElder] = true, [MDL.Guild.JobEnum.JunshiElder] = true, } } } self:RegistSystemEvent(EventID.UI_Guild_FamousInfoRefresh, self.InitTabs) self:InitDataArr() MDL.Guild.GetGuildSalaryInfoReq() end function UIGuildSalaryPop:InitDataArr() self.Data_Arr = {} for i = DataSheetManager.GuildSalaryBonus:GetDataCount(), 1, -1 do table.insert(self.Data_Arr, DataSheetManager.GuildSalaryBonus:GetDataByID(i)) end end function UIGuildSalaryPop:InitTabs() self.jobTitleID = MDL.Guild.GetGuildSalaryJobID() UIUtils.SetLabelText(self.UICommonPopUpTab.txt_Title, Const_IDS["IDS_RewardPreview"]) if self.UICommonPopUpTab.loop_Tab.Count > 0 then self.UICommonPopUpTab.loop_Tab:ClearCells() end for i, v in ipairs(Salary_Bonus_Tab_Data) do self.UICommonPopUpTab.loop_Tab:AddData(v, 2) end self.contributeScore = MDL.Guild.GetMyGuildContributeScore() UIUtils.SetLabel(self.group_GSReward.lab_Info, string.FormatByIdsId(Const_IDS["IDS_GuildSalary_SalaryIntro"], self.contributeScore)) self.UICommonPopUpTab.loop_Tab:SelectIndex(0) end function UIGuildSalaryPop:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUpTab.btn_Close) end function UIGuildSalaryPop:OnButtonClicked(comp) if comp == self.UICommonPopUpTab.btn_Close then self:CloseView() end end function UIGuildSalaryPop:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.UICommonPopUpTab.loop_Tab then cellTable.state_ArrowState:SetState(0) UIUtils.SetLabel(cellTable.txt_Name_Nomal, data.title) UIUtils.SetLabel(cellTable.txt_Name_Selected, data.title) UIUtils.SetActive(cellTable.group_SignState.gameObject, data.jobIDDic[self.jobTitleID] == true) UIUtils.SetActive(cellTable.group_SignStateS.gameObject, data.jobIDDic[self.jobTitleID] == true) cellTable.UIState:SetState(2) cellTable.UIStateS:SetState(2) UIUtils.SetLabelText(cellTable.txt_Fire, Const_IDS["IDS_OfficialPosition_Post"]) UIUtils.SetLabelText(cellTable.txt_FireS, Const_IDS["IDS_OfficialPosition_Post"]) else if data.GuildActiveRequireMax == 0 then UIUtils.SetActive(cellTable.group_Now.gameObject, self.isMyJobTab and self.contributeScore >= data.GuildActiveRequireMin) UIUtils.SetLabel(cellTable.txt_Num, string.FormatByIdsId(Const_IDS["IDS_DemonGod_UI_40"], data.GuildActiveRequireMin)) else UIUtils.SetActive(cellTable.group_Now.gameObject, self.isMyJobTab and self.contributeScore >= data.GuildActiveRequireMin and self.contributeScore <= data.GuildActiveRequireMax) UIUtils.SetLabel(cellTable.txt_Num, string.FormatByIdsId(Const_IDS["IDS_DemonGod_UI_41"], data.GuildActiveRequireMin, data.GuildActiveRequireMax)) end local rewardTb_ID = self.selectTabIndex == 0 and data.GuildActiveBonusRewardForOwner or data.GuildActiveBonusRewardForManagement local rewardTb = DataSheetManager.GuildSalaryRewardRepeat:GetDataByAttrRepeatID(rewardTb_ID).Item_Table for i, rewardData in ipairs(rewardTb) do local contentItem = cellTable.content[i] if not contentItem then contentItem = self:InstantiateCellCollection(cellTable.cell.gameObject, cellTable.content, self.group_GSReward.UIItem.gameObject) end contentItem.ItemID = rewardData.ItemID UTL.Item.SetItemCell(contentItem.item, rewardData.ItemID, rewardData.ItemNum) UIUtils.SetActive(contentItem.gameObject, true) end for i = #rewardTb + 1, #cellTable.content do UIUtils.SetActive(cellTable.content[i].gameObject, false) end end end function UIGuildSalaryPop:OnCellSelect(scrollRect, index, cellTable, data) if scrollRect == self.UICommonPopUpTab.loop_Tab then self.selectTabIndex = index self.isMyJobTab = data.jobIDDic[self.jobTitleID] or false self.group_GSReward.loop_Reward:ReloadAll(self.Data_Arr) end end function UIGuildSalaryPop:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.group_GSReward.loop_Reward then for i, v in ipairs(cellTable.content) do if target == v.item.event_Click then UTL.ItemTips.ShowCommonTipsById(cellTable.content[i].ItemID) break end end end end return UIGuildSalaryPop