local UISpecialTeamApplyPopUp = UIViewClass() function UISpecialTeamApplyPopUp:OnOpened(context) self:RegistSystemEvent(EventID.UI_SpecialTeam_ApplyInfoHandle, self.UpdateApplyTeamList) self:RegistSystemEvent(EventID.UI_SpecialTeam_CloseAll, self.OnBackButtonPressed) self.toggle_Skip.isOn = not CTL.SpecialTeam.IsAutoPopUpApply() self:UpdateApplyTeamList() end function UISpecialTeamApplyPopUp:OnClosed() CTL.SpecialTeam.SetAutoApplePopUpValue(not self.toggle_Skip.isOn) end function UISpecialTeamApplyPopUp:OnBackButtonPressed() self:OnButtonClicked(self.btn_Close) end function UISpecialTeamApplyPopUp:OnButtonClicked(comp) if comp == self.btn_Close then self:CloseView() elseif comp == self.btn_IgnoreAll then MDL.SpecialTeam.ClearApplyTeamList() self:CloseView() end end function UISpecialTeamApplyPopUp:InitApplyTeamList() local applyList = MDL.SpecialTeam.GetApplyTeamList() if #applyList > 0 then for i, v in ipairs(applyList) do self.loopScroll_ApplyTeamList:AddData(v, 0) end UIUtils.SetActive(self.group_Empty, false) UIUtils.SetActive(self.btn_IgnoreAll, true) else UIUtils.SetActive(self.group_Empty, true) UIUtils.SetActive(self.btn_IgnoreAll, false) end end function UISpecialTeamApplyPopUp:UpdateApplyTeamList() local applyList = MDL.SpecialTeam.GetApplyTeamList() self.loopScroll_ApplyTeamList:ReloadAll(applyList) if self.loopScroll_ApplyTeamList.Count > 0 then UIUtils.SetActive(self.group_Empty, false) UIUtils.SetActive(self.btn_IgnoreAll, true) else UIUtils.SetActive(self.group_Empty, true) UIUtils.SetActive(self.btn_IgnoreAll, false) end end function UISpecialTeamApplyPopUp:OnCellInit(scrollRect, index, cellTable, data) local baseInfo = data.playerShowInfo CTL.Character.SetPortraitAndFrame(cellTable.UIHeroHead, baseInfo.PortraitId, baseInfo.FrameId, baseInfo.level, baseInfo.acid) UIUtils.SetCanvasSortingOrderByMainCanvas(cellTable.UIHeroHead.effectUpCanvas, cellTable.UpCanvas, CTL.Character.UpOrder.Common) cellTable.lab_RoleName.text = baseInfo.name if CTL.SpecialTeam.IsShowPlayerGs() then UIUtils.SetActive(cellTable.ico_CE, true) cellTable.lab_CE.text = baseInfo.gsSum or baseInfo.power else UIUtils.SetActive(cellTable.ico_CE, false) UIUtils.SetLabel(cellTable.lab_CE, UIUtils.GetLocalizedTxt(Const_IDS.IDS_TeamFairTournamen_3v3Point) .. baseInfo.SyncTvTEloScore) end CTL.Player.OperateGenderImage(cellTable.image_Gender, baseInfo.sex) CTL.Guild.SetGuildEmblem(cellTable.img_GuildMark, cellTable.txt_GuildInitiate, baseInfo.EmblemFrame, baseInfo.EmblemContent) if not string.isNilOrEmpty(baseInfo.guildName) then --同势力显示不同颜色工会名字 if MDL.Guild.IsSameGuild(baseInfo.guildId) then UIUtils.SetLabel(cellTable.lab_GuildName, UTL.Color.FormatTextByColor(UTL.Color.ModelNameColor.Blue, baseInfo.guildName)) else UIUtils.SetLabel(cellTable.lab_GuildName, baseInfo.guildName) end else cellTable.lab_GuildName.text = nil end end function UISpecialTeamApplyPopUp:OnCellClicked(scrollRect, index, cellTable, target, data) if target == cellTable.btn_Ignore then MDL.SpecialTeam.TeamWarApplyHandleReq(data.applyPlayerId, false) elseif target == cellTable.btn_Accept then MDL.SpecialTeam.TeamWarApplyHandleReq(data.applyPlayerId, true) elseif target == cellTable.UIHeroHead.img_PlayerAvatarBg then CTL.PlayerInteract.OpenFriendInteractView(data.playerShowInfo.acid) end end return UISpecialTeamApplyPopUp