local UIHeroLightEffectTool = require "View/Common/UIHeroLightEffectTool" local HERO_RENDER_ID = 1000002 local UISpecialTeamMyTeam = UIViewClass() local ConstLightPath = ConstAssetPathConfig.LightLeft function UISpecialTeamMyTeam:OnOpened(context) self:RegistSystemEvent(EventID.UI_SpecialTeam_TeamInfoChange, self.RefreshMyTeamPanel) self:RegistSystemEvent(EventID.UI_SpecialTeam_MemberInfoChange, self.RefreshMyTeamPanel) self:RegistSystemEvent(EventID.UI_SpecialTeam_ApplyInfoHandle, self.RefreshApplyButtonRedPoint) self:RegistSystemEvent(EventID.UI_SpecialTeam_TeamMemberFull, self.OnRefreshBtnRed) MDL.SpecialTeam.UpdateMyMembersInfo() self:RefreshApplyButtonRedPoint() self:RefreshMyTeamPanel() self:SetShoutCountdown(CTL.SpecialTeam.GetShutTimeCD()) self:OnRefreshBtnRed() UIUtils.SetActive(self.btn_Array, CTL.SpecialTeam.IsCanEditorFreeline()) end function UISpecialTeamMyTeam:OnRefreshBtnRed() if CTL.SpecialTeam.IsHasSpecialTeamFullRedKey() then self.btn_Array:SetRedPoint(true) else self.btn_Array:SetRedPoint(false) end end function UISpecialTeamMyTeam:OnCreated() self.heroLightEffectDatas = UIHeroLightEffectTool.CreateHeroLightEffectDatas(true) UIUtils.SetLabelText(self.lab_Info, CTL.SpecialTeam.GetMyTeamCreateTip()) end function UISpecialTeamMyTeam:RefreshApplyButtonRedPoint() self.btn_ApplyList:SetRedPoint(MDL.SpecialTeam.IsHasMemberApply()) end function UISpecialTeamMyTeam:OnClickShout(channelType) if channelType == MDL.ChannelChat.ChannelCfgId.Legion then if MDL.Guild.IsHasGuild() == false then CTL.Tips.AddTipsMsg(Const_IDS.IDS_Chat_ConditionLegion) return end end local cdTime = CTL.SpecialTeam.GetShutTimeCD() self:SetShoutCountdown(cdTime) if cdTime == 0 then CTL.SpecialTeam.ShutRecruitMsg(false, channelType) self:SetShoutCountdown(CTL.SpecialTeam.GetShutTimeCD()) end end function UISpecialTeamMyTeam:SetShoutCountdown(cdTime) if cdTime > 0 then self.txt_ShoutCountTime:ResetAndBeginCustomTimer(false, cdTime, 0, UIUtils.GetLocalizedTxt(Const_IDS["IDS_TeamUI_Myteam_RecruitingTime"]), 1) self.event_Shout:SetGray(true) self:StartRepeatFunc(self.OnUpdateFun, cdTime) else self.txt_ShoutCountTime:EndTimer() self.event_Shout:SetGray(false) self:StopRepeatFunc(self.OnUpdateFun) end end function UISpecialTeamMyTeam:OnUpdateFun(deltaTime, timeSinceUpdate) self:SetShoutCountdown(CTL.SpecialTeam.GetShutTimeCD()) end function UISpecialTeamMyTeam:OnButtonClicked(comp) if comp == self.btn_ApplyList then CTL.SpecialTeam.OpenTeamApplyPopUp() elseif comp == self.btn_Array then CTL.SpecialTeam.OpenFormatSetting() CTL.SpecialTeam.RemoveSpecialTeamFullRedKey() elseif comp == self.btn_Leave then CTL.SpecialTeam.TryQuitTeam() elseif comp == self.event_Shout then UIUtils.SetActive(self.img_ChannelBg, true) UIUtils.SetActive(self.btn_WarZoneChannel, CTL.SpecialTeam.IsShowWarZoneButton()) elseif comp == self.btn_RecruitChannel then UIUtils.SetActive(self.img_ChannelBg, false) self:OnClickShout(MDL.ChannelChat.ChannelCfgId.ZhaoMu) elseif comp == self.btn_GuildChannel then UIUtils.SetActive(self.img_ChannelBg, false) self:OnClickShout(MDL.ChannelChat.ChannelCfgId.Legion) elseif comp == self.btn_WarZoneChannel then UIUtils.SetActive(self.img_ChannelBg, false) self:OnClickShout(MDL.ChannelChat.ChannelCfgId.WarZone) elseif comp == self.img_ChannelBg then UIUtils.SetActive(self.img_ChannelBg, false) else for i, v in ipairs(self.group_TeammateInfo) do if comp == v.img_Empty then CTL.SpecialTeam.OpenTeamInviteInPopUp() return elseif comp == v.group_Info then local px, py = comp.transform.parent:GetAnchoredPosition() CTL.SpecialTeam.OpenTeamInteractive(MDL.SpecialTeam.GetAllMembersInfo()[i], px, py) return end end end end function UISpecialTeamMyTeam:RefreshMyTeamPanel() local teammateInfo = MDL.SpecialTeam.GetAllMembersInfo() self.txt_TeamName.text = MDL.SpecialTeam.GetMyTeamName() for i, v in ipairs(self.group_TeammateInfo) do self:RefreshPlayerInfo(teammateInfo[i] or nil, v) end local showInfo1 = (teammateInfo[1] and teammateInfo[1].detailInfo) and CTL.Player.TeamMemberDetailInfoToCommonRoleInfo(teammateInfo[1].detailInfo) local showInfo2 = (teammateInfo[2] and teammateInfo[2].detailInfo) and CTL.Player.TeamMemberDetailInfoToCommonRoleInfo(teammateInfo[2].detailInfo) local showInfo3 = (teammateInfo[3] and teammateInfo[3].detailInfo) and CTL.Player.TeamMemberDetailInfoToCommonRoleInfo(teammateInfo[3].detailInfo) local playerShowInfos = { [1] = teammateInfo[1] and teammateInfo[1].playerShowInfo, [2] = teammateInfo[2] and teammateInfo[2].playerShowInfo, [3] = teammateInfo[3] and teammateInfo[3].playerShowInfo, } self:LoadTeamModel(showInfo1, showInfo2, showInfo3, playerShowInfos) end function UISpecialTeamMyTeam:LoadTeamModel(showInfo1, showInfo2, showInfo3, playerShowInfos) if self.renderHandle then UTL.UIRender.DisposeModelComponentData(self.renderHandle) end self.renderHandle = UTL.UIRender.CreateModelComponentDatas(self.obj_Model) local showParams = CTL.SpecialTeam.GetTeamPlayerModelPos() local showInfos = { [1] = showInfo1, [2] = showInfo2, [3] = showInfo3, } local lightPath = ConstLightPath UTL.UIRender.CreateRTSceneTrans(self.renderHandle, lightPath) self.renderEntityList = UTL.UIRender.CreateMultiPlayerRTRenderModel(self.renderHandle, showInfos, showParams, HERO_RENDER_ID, playerShowInfos) --播放光效 if showInfo1 and showInfo1.lightEffectIds then for _, lightEffectID in ipairs(showInfo1.lightEffectIds) do UIHeroLightEffectTool.PlayHeroLightEffect(self.heroLightEffectDatas, self, 0, UIHeroLightEffectTool.PlayLightEffectFuncEnum.CountryOfficial, lightEffectID, { renderEntityIndex = 1 }) end end if showInfo2 and showInfo2.lightEffectIds then for _, lightEffectID in ipairs(showInfo2.lightEffectIds) do UIHeroLightEffectTool.PlayHeroLightEffect(self.heroLightEffectDatas, self, 0, UIHeroLightEffectTool.PlayLightEffectFuncEnum.CountryOfficial, lightEffectID, { renderEntityIndex = 2 }) end end if showInfo3 and showInfo3.lightEffectIds then for _, lightEffectID in ipairs(showInfo3.lightEffectIds) do UIHeroLightEffectTool.PlayHeroLightEffect(self.heroLightEffectDatas, self, 0, UIHeroLightEffectTool.PlayLightEffectFuncEnum.CountryOfficial, lightEffectID, { renderEntityIndex = 3 }) end end end function UISpecialTeamMyTeam:CountryOfficialPlayModelEffect(path, param) local renderEntity = self.renderEntityList[param.renderEntityIndex] return AuxUtil.PlayPsEffect(path, renderEntity.Transform, LuaConst.Layer.Character) end function UISpecialTeamMyTeam:RefreshPlayerInfo(memberInfo, cell) if memberInfo then UIUtils.SetActive(cell.img_Empty, false) UIUtils.SetActive(cell.group_Info, true) local baseInfo = memberInfo.playerShowInfo if memberInfo.state == MDL.Team.MemberState.Leave then UIUtils.SetActive(cell.group_Leave, true) else UIUtils.SetActive(cell.group_Leave, false) end cell.lab_RoleName.text = MDL.SpecialTeam.GetMemberNameById(memberInfo.memberId) --有工会,显示势力名、徽记 if not string.isNilOrEmpty(baseInfo.guildName) then UIUtils.SetActive(cell.txt_GuildName, true) UIUtils.SetLabel(cell.txt_GuildName, baseInfo.guildName) UIUtils.SetLabel(cell.txt_GuildInitiate, baseInfo.EmblemContent) --有可能刚开始消息还没推过来,所以存在为0的情况 if baseInfo.EmblemFrame > 0 then UTL.Item.SetAtlasSprite(cell.img_GuildMark, "UI_Guild", DataSheetManager.GuildEmblem:GetDataByID(baseInfo.EmblemFrame).Image) end UIUtils.SetActive(cell.txt_GuildInitiate, true) UIUtils.SetActive(cell.img_GuildMark, true) UIUtils.SetActive(cell.group_Guild, true) else UIUtils.SetActive(cell.txt_GuildName, false) UIUtils.SetActive(cell.txt_GuildInitiate, false) UIUtils.SetActive(cell.img_GuildMark, false) UIUtils.SetActive(cell.group_Guild, false) end --同工会显示不同颜色势力名字 if MDL.Guild.IsSameGuild(baseInfo.guildId) then UIUtils.SetLabel(cell.txt_GuildName, UTL.Color.FormatTextByColor(UTL.Color.ModelNameColor.Blue, baseInfo.guildName)) end local isCaptain = MDL.SpecialTeam.IsTeamLeader(memberInfo.memberId) UIUtils.SetActive(cell.ico_Leader, isCaptain) if CTL.SpecialTeam.IsShowPlayerGs() then UIUtils.SetActive(cell.ico_CE, true) cell.lab_CE.text = baseInfo.gsSum else UIUtils.SetActive(cell.ico_CE, false) UIUtils.SetLabel(cell.lab_CE, UIUtils.GetLocalizedTxt(Const_IDS.IDS_TeamFairTournamen_3v3Point) .. baseInfo.SyncTvTEloScore) end CTL.Player.OperateGenderImage(cell.group_Gender, baseInfo.sex) else UIUtils.SetActive(cell.img_Empty, true) UIUtils.SetActive(cell.group_Info, false) end end function UISpecialTeamMyTeam:OnClosed() MDL.SpecialTeam.ClearRecommendTeamList() UIHeroLightEffectTool.StopHeroLightEffect(self.heroLightEffectDatas) self.heroLightEffectDatas = nil if self.renderHandle then UTL.UIRender.DisposeModelComponentData(self.renderHandle) end end return UISpecialTeamMyTeam