local UIGuildWelfare = UIViewClass() local Image_Path = ConstAssetPathConfig.ImagePath local GuildCultivationFunctionId = 414 function UIGuildWelfare:OnOpened(context) self.timeIntervals = {} local list = CTL.Guild.GetWelfareList() for i,v in ipairs(list) do self.loop_Entrance:AddData(v,0) end self.sourceDataList = list self:RegistSystemEvent(EventID.UI_Guild_WelfareRefresh, self.Refresh) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.Guild_Welfare_Cultivation, self.RefreshCultivation) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.Guild_Welfare_Salary, self.RefreshSalary) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.Guild_Welfare_LeaderReward, self.RefreshLeaderReward) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.Guild_Welfare, self.Refresh) end function UIGuildWelfare:OpenWelfareWindow(WelfareID) if WelfareID == CTL.Guild.WelfareType.Contribute then UIManager.OpenView(Const_UI_Lua.UIEnum.UIGuildContribute) elseif WelfareID == CTL.Guild.WelfareType.Allies then CTL.RedPoint.RemoveRedPoint(CTL.RedPoint.RedPointKey.Guild_Welfare_Allies) UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIGuildAlliesMapView) elseif WelfareID == CTL.Guild.WelfareType.Shop then UIManager.OpenView(Const_UI_Lua.UIEnum.UIShopMain, {TabEnum = CTL.PayMall.ShopMainTabEnum.ShiLi}) elseif WelfareID == CTL.Guild.WelfareType.Cultivation then CTL.GuildCultivation.OpenGuildCultivation() elseif WelfareID == CTL.Guild.WelfareType.Salary then -- 势力工资 UIManager.OpenView(Const_UI_Lua.UIEnum.UIGuildSalary) elseif WelfareID == CTL.Guild.WelfareType.LeaderReward then CTL.Guild.OpenLeaderManagement() end end function UIGuildWelfare:RefreshCultivation() self:RefreshCells(GuildCultivationFunctionId) end function UIGuildWelfare:RefreshSalary() self:RefreshCells(MDL.Unlock.FunctionType.GuildSalary) end function UIGuildWelfare:RefreshLeaderReward() self:RefreshCells(CTL.Guild.WelfareType.LeaderReward) end function UIGuildWelfare:RefreshCells(id) for i, v in ipairs(self.sourceDataList) do if v.FunctionId == id or v.ID == id then self.loop_Entrance:UpdateIndex(i - 1) break end end end function UIGuildWelfare:Refresh() self.loop_Entrance:RefreshCells(false) end function UIGuildWelfare:OnCellInit(scrollRect, index, cellTable, data) UIUtils.SetImageByAssetBundle(cellTable.img_Scene, data.Image) UIUtils.SetLabelText(cellTable.txt_Title,Const_IDS[data.Name]) UIUtils.SetLabelText(cellTable.txt_Info,Const_IDS[data.DescText]) if not MDL.Unlock.IsUnlock(data.FunctionId) then cellTable.group_Locked.gameObject:SetActive(true) if CTL.Guild.UnOpenGuildWelfare[data.FunctionId] then -- 敬请期待活动 cellTable.state_Lock:SetState(0) else cellTable.state_Lock:SetState(1) local unlockInfo = DataSheetManager.FuctionUnlock:GetDataByFucID(data.FunctionId).Unlock_Table local _, tmpContent = MDL.Unlock.IsComplete(unlockInfo[1].UnlockCondition, unlockInfo[1].UnlockConditionParam, "IDS_GuildActivity_ReptUnlock") self:SetLockText(_, cellTable.txt_FameUnlock, tmpContent) if unlockInfo[2] then local _, tmpContent = MDL.Unlock.IsComplete(unlockInfo[2].UnlockCondition, unlockInfo[2].UnlockConditionParam,"IDS_GuildActivity_PersonalUnlock") self:SetLockText(_, cellTable.txt_LevelUnlock, tmpContent) end end UIUtils.SetGray(cellTable.img_Scene,true) else cellTable.group_Locked.gameObject:SetActive(false) UIUtils.SetGray(cellTable.img_Scene,false) end if data.ActivityId ~= -1 then cellTable.cell:SetRedPoint(CTL.Guild.GetRedPointById(data.ActivityId)) else if data.FunctionId == GuildCultivationFunctionId then cellTable.cell:SetRedPoint(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.Guild_Welfare_Cultivation)) elseif data.FunctionId == MDL.Unlock.FunctionType.GuildSalary then cellTable.cell:SetRedPoint(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.Guild_Welfare_Salary)) elseif data.ID == CTL.Guild.WelfareType.LeaderReward then cellTable.cell:SetRedPoint(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.Guild_Welfare_LeaderReward)) end end end function UIGuildWelfare:SetLockText(isUnlock, txt, str) if isUnlock then UIUtils.SetActive(txt, false) else UIUtils.SetActive(txt, true) txt.text = str end end function UIGuildWelfare:OnCellClicked(scrollRect, index, cellTable, target, data) if data.FunctionId ~= -1 and not MDL.Unlock.IsUnlock(data.FunctionId) then if CTL.Guild.UnOpenGuildWelfare[data.FunctionId] then -- 敬请期待活动 CTL.Tips.AddTipsMsg(Const_IDS["IDS_NowNotOpen"]) else CTL.Tips.AddTipsMsg(Const_IDS["IDS_Formation_RelationShip_Closed"]) -- 未解锁活动 end else self:OpenWelfareWindow(data.ID) end end function UIGuildWelfare:Refresh() self.loop_Entrance:RefreshCells(false) end return UIGuildWelfare