local UISpecialTeamInvited = UIViewClass() function UISpecialTeamInvited:OnOpened(context) self:RegistSystemEvent(EventID.UI_SpecialTeam_InviteInfoHandle, self.UpdateInviteTeamList) self:RegistSystemEvent(EventID.UI_SpecialTeam_CloseAll, self.OnBackButtonPressed) self.toggle_Skip.isOn = not CTL.SpecialTeam.IsAutoPopUpInvited() self:UpdateInviteTeamList() end function UISpecialTeamInvited:OnClosed() CTL.SpecialTeam.SetAutoInvitedPopUpValue(not self.toggle_Skip.isOn) end function UISpecialTeamInvited:OnBackButtonPressed() self:OnButtonClicked(self.btn_Close) end function UISpecialTeamInvited:OnButtonClicked(comp) if comp == self.btn_Close then self:CloseView() elseif comp == self.btn_IgnoreAll then MDL.SpecialTeam.ClearInviteList() self:CloseView() end end function UISpecialTeamInvited:UpdateInviteTeamList() local inviteList = MDL.SpecialTeam.GetInviteList() self.loop_TeamList:ReloadAll(inviteList) if self.loop_TeamList.Count > 0 then UIUtils.SetActive(self.img_Empty, false) UIUtils.SetActive(self.btn_IgnoreAll, true) else UIUtils.SetActive(self.img_Empty, true) UIUtils.SetActive(self.btn_IgnoreAll, false) end end function UISpecialTeamInvited:RefreshSingleMember(memberInfo, cell) local baseInfo = memberInfo.playerShowInfo CTL.Character.SetPortraitAndFrame(cell.UIHeroHead190, baseInfo.PortraitId, baseInfo.FrameId) UIUtils.SetCanvasSortingOrderByMainCanvas(cell.UIHeroHead190.effectUpCanvas, cell.UpCanvas, CTL.Character.UpOrder.Common) UIUtils.SetActive(cell.ico_Leader, memberInfo.type == MDL.Team.MemberType.Leader) cell.lab_RoleName.text = baseInfo.name CTL.Guild.SetGuildEmblem(cell.img_GuildMark, cell.txt_GuildInitiate, baseInfo.EmblemFrame, baseInfo.EmblemContent) if CTL.SpecialTeam.IsShowPlayerGs() then UIUtils.SetActive(cell.img_CEIcon, true) cell.txt_NumCE.text = baseInfo.gsSum else UIUtils.SetActive(cell.img_CEIcon, false) if GameAppInfo.IsJapanesePackage() then cell.txt_NumCE.text = baseInfo.SyncTvTEloScore else UIUtils.SetLabel(cell.txt_NumCE, UIUtils.GetLocalizedTxt(Const_IDS.IDS_TeamFairTournamen_3v3Point) .. baseInfo.SyncTvTEloScore) end end end function UISpecialTeamInvited:OnCellInit(scrollRect, index, cellTable, data) local teamInfo = data.teamInfo cellTable.txt_TeamName.text = teamInfo.teamName cellTable.txt_Server.text = CTL.CrossServer.GetFormatServerShow(teamInfo.members[1].playerShowInfo.ShowServerId) for i, v in ipairs(cellTable.group_Head) do if teamInfo.members[i] then self:RefreshSingleMember(teamInfo.members[i], v) UIUtils.SetActive(v.group_Hero, true) else CTL.Character.SetHeadEmpty(v.UIHeroHead190) UIUtils.SetActive(v.group_Hero, false) end end end function UISpecialTeamInvited:OnCellClicked(scrollRect, index, cellTable, target, data) if target == cellTable.btn_Accept then CTL.SpecialTeam.AcceptInvitation(data) self:CloseView() elseif target == cellTable.btn_Ignore then MDL.SpecialTeam.TeamWarInviteHandleReq(data.teamInfo.teamId, false) else for k, v in ipairs(data.teamInfo.members) do if target == cellTable.group_Head[k].UIHeroHead190.img_PlayerAvatarBg then CTL.PlayerInteract.OpenFriendInteractView(v.playerShowInfo.acid) break end end end end return UISpecialTeamInvited