local UISpecialTeamInteractive = UIViewClass() local ActionType = { ChangeLeader = 1, CheckInfo = 2, KickOutMember = 3, TeamChat = 4, } function UISpecialTeamInteractive:OnOpened(context) self:RegistSystemEvent(EventID.UI_SpecialTeam_CloseAll, self.OnBackButtonPressed) local x = context.x local y = context.y self.group_Interactive.gameObject.transform:SetLocalPosition(x, y, 0) self:InitEvents() end function UISpecialTeamInteractive:OnBackButtonPressed() self:OnButtonClicked(self.Bottom) end function UISpecialTeamInteractive:InitEvents() local isLeader = MDL.SpecialTeam.IsSelfLeader() if isLeader then self.eventList = { ActionType.ChangeLeader, ActionType.CheckInfo, ActionType.KickOutMember, ActionType.TeamChat, } else self.eventList = { ActionType.CheckInfo, ActionType.TeamChat, } end local index = 0 for _, v in ipairs(self.eventList) do if v == ActionType.ChangeLeader and self.context.memberInfo.state == MDL.Team.MemberState.Leave then --需要判断队员是否在线 else index = index + 1 local comp = self.group_Interactive[index] if not comp then self:InstantiateCollection(self.group_Interactive, self.group_Interactive[1].gameObject) comp = self.group_Interactive[index] end comp.actionType = v UIUtils.SetActive(comp.gameObject, true) self:SetEventLabel(comp.labLocal_Action, v) end end end function UISpecialTeamInteractive:SetEventLabel(label, type) if type == ActionType.ChangeLeader then UIUtils.SetLabelText(label, Const_IDS.IDS_HeroMatch3v3_SetTeamLeader) elseif type == ActionType.CheckInfo then UIUtils.SetLabelText(label, Const_IDS.IDS_HeroMatch3v3_CheckInformation) elseif type == ActionType.KickOutMember then UIUtils.SetLabelText(label, Const_IDS.IDS_HeroMatch3v3_GetOutTeam) elseif type == ActionType.TeamChat then UIUtils.SetLabelText(label, Const_IDS.IDS_HeroMatch3v3_TeamChat) end end function UISpecialTeamInteractive:OnButtonClicked(comp) if comp == self.Bottom then self:CloseView() else for i, v in ipairs(self.group_Interactive) do if v.event_Action == comp then local actionType = v.actionType self:OnClickEvent(actionType) self:CloseView() break end end end end function UISpecialTeamInteractive:OnClickEvent(actionType) if actionType == ActionType.ChangeLeader then CTL.SpecialTeam.TryChangeLeader(self.context.memberInfo.memberId) elseif actionType == ActionType.CheckInfo then MDL.PlayerInteract.CheckPlayerInfoByAcid(self.context.memberInfo.memberId) elseif actionType == ActionType.KickOutMember then CTL.SpecialTeam.TryKickOutMember(self.context.memberInfo.memberId) elseif actionType == ActionType.TeamChat then CTL.SpecialTeam.OpenMyTeamChat() end end return UISpecialTeamInteractive