local UIPlayerInteractionView = UIViewClass() local EventSystem = require('Event/EventSystem') function UIPlayerInteractionView:OnOpened(context) self.friendDetailData = context.msgResp.HeadInfo self.isJoinTeam = false if context.extraParameter then self.isJoinTeam = context.extraParameter.isJoinTeam -- 从组队邀请弹窗或申请组队弹窗打开玩家详情隐藏加入队伍和邀请组队选项 end CTL.Character.SetPortraitAndFrame(self.UIHeroHead190, self.friendDetailData.PortraitId, self.friendDetailData.FrameId, self.friendDetailData.level) local server = "" if CTL.CrossServer.IsInCrossServerScene() then server = CTL.CrossServer.GetServerShowStr(self.friendDetailData.ShowServerId, CTL.CrossServer.IsSameServer(self.friendDetailData.MergeServerId)) end self.txt_PlayerName.text = self.friendDetailData.name .. server self.txt_LegionName.text = self.friendDetailData.guildName self.txt_NumCE.text = self.friendDetailData.gsSum self.BtnList = {} if context.msgResp.offlineBtns then self:InitOfflineBtns(context.msgResp.offlineBtns) else self:InitBtns() end CTL.Player.OperateGenderImage(self.image_Gender, self.friendDetailData.sex) if self.friendDetailData.CountryId > 0 then UIUtils.SetActive(self.img_CountryBg, true) if self.Loc_Country.CurState == 0 then self.group_CountryState:SetState(self.friendDetailData.CountryId - 1) end CTL.Country.SetCountryJob(self.img_Title, self.img_CountryBg, self.friendDetailData.CountryId, self.friendDetailData.CountryOfficial) CTL.Country.SetOverseasCountryImage(self.Loc_Country.CurState, self.lab_CountryTC, self.friendDetailData.CountryId, self.friendDetailData.CountryOfficial) else UIUtils.SetActive(self.img_CountryBg, false) end if string.isNilOrEmpty(context.msgResp.TeamWarID) then UIUtils.SetActive(self.group_Team, false) UIUtils.SetActive(self.txt_TeamScore, false) else UIUtils.SetActive(self.group_Team, true) self.txt_TeamNum.text = string.FormatByIdsId(Const_IDS.IDS_HeroMatch3v3_PlayerTeamNum, context.msgResp.TeamWarMemberCnt) if CTL.TeamFairChampionship.IsShowEntry() then UIUtils.SetActive(self.txt_TeamScore, true) UIUtils.SetLabel(self.txt_TeamScore, UIUtils.GetLocalizedTxt(Const_IDS.IDS_TeamFairTournamen_3v3Point) .. self.friendDetailData.SyncTvTEloScore) else UIUtils.SetActive(self.txt_TeamScore, false) end end end function UIPlayerInteractionView:InitOfflineBtns(btns) -- body for i,v in ipairs(btns) do table.insert(self.BtnList, v) end for i = 1, #self.BtnList do self.BtnScroll:AddData(self.BtnList[i], 0) end end --初始化需要显示哪些按钮 function UIPlayerInteractionView:InitBtns() local isCheckPlayerInfo = MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.CheckPlayerInfo) local isFriendUnlock = MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.Friend) local isCrossFriendUnlock = MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.FriendsCross) local isFriend = MDL.Friend.IsPlayerFriend(self.friendDetailData.acid) local isBlack = MDL.Friend.IsPlayerBlack(self.friendDetailData.acid) local isTeamUnlock = MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.Team) local isRival = MDL.Friend.IsPlayerRival(self.friendDetailData.acid) local isSameGuild = MDL.Guild.IsSameGuild(self.friendDetailData.guildId) local isCountryShutUp = MDL.Country.IsHasShutUp(self.friendDetailData.CountryId, self.friendDetailData.CountryOfficial) local isCross = self.friendDetailData.IsCross local isSameWarZone = self.context.msgResp.IsSameWarZone if isFriendUnlock then if isRival then table.insert(self.BtnList, MDL.PlayerInteract.InteractType.DeleteRival) else if (not isCross and not isSameGuild) or (isCross and isSameWarZone) then table.insert(self.BtnList, MDL.PlayerInteract.InteractType.AddRival) end end end if isCheckPlayerInfo then table.insert(self.BtnList, MDL.PlayerInteract.InteractType.CheckPlayerInfo) end if ((isFriendUnlock and not isCross) or (isCrossFriendUnlock and isCross)) and not isFriend and not isBlack then table.insert(self.BtnList, MDL.PlayerInteract.InteractType.AddFriend) end if isFriend then table.insert(self.BtnList, MDL.PlayerInteract.InteractType.DeleteFriend) end if isBlack then table.insert(self.BtnList, MDL.PlayerInteract.InteractType.DeleteBlock) else table.insert(self.BtnList, MDL.PlayerInteract.InteractType.AddBlock) end if isFriendUnlock and not isBlack then table.insert(self.BtnList, MDL.PlayerInteract.InteractType.SendMsg) end if self.context.msgResp.TargetOpenTeam and isTeamUnlock and not isBlack then if not self.isJoinTeam then if CTL.Team.IsInTeam() or not IsServerDataNotNil(self.context.msgResp.TeamInfo) then table.insert(self.BtnList, MDL.PlayerInteract.InteractType.InviteJoinTeam) end if not CTL.Team.IsInTeam() and IsServerDataNotNil(self.context.msgResp.TeamInfo) then table.insert(self.BtnList, MDL.PlayerInteract.InteractType.JoinTeam) end end end if string.isNilOrEmpty(self.friendDetailData.guildName) and not isCross then if MDL.Guild.IsInvitePlayer() then local config = DataSheetManager.FuctionUnlock:GetDataByFucID(MDL.Unlock.FunctionType.Guild) MDL.Unlock.IsComplete(config) table.insert(self.BtnList, MDL.PlayerInteract.InteractType.InviteLegion) elseif MDL.Guild.IsHasGuild() then table.insert(self.BtnList, MDL.PlayerInteract.InteractType.GuildRecommend) end end if isCountryShutUp then if self.context.msgResp.IsCountryMute then table.insert(self.BtnList, MDL.PlayerInteract.InteractType.CountryReleaseShutUp) else table.insert(self.BtnList, MDL.PlayerInteract.InteractType.CountryShutUp) end end if self.context.msgResp.IsCountryMute then UIUtils.SetLabelText(self.txt_Muted, Const_IDS.IDS_Country_Muting) else self.txt_Muted.text = nil end MDL.PlayerInteract.AddBtnsByOccasion(self.BtnList,self.context.msgResp.Occasion,self.friendDetailData.acid) --按照枚举值排序显示 table.sort(self.BtnList) --职权相关的按钮,排在最后 CTL.OfficialPrivilege.AddOptBtn(self.BtnList, self.friendDetailData.OfficialId, self.friendDetailData.SoloFightRank, self.friendDetailData.ShowServerId) CTL.SpecialTeam.TryAddOptBtn(self.BtnList, self.context.msgResp) for i = 1, #self.BtnList do self.BtnScroll:AddData(self.BtnList[i], 0) end end function UIPlayerInteractionView:OnCellInit(scrollRect, index, cellTable, data) local ids = MDL.PlayerInteract.SetBtnText(cellTable.txt_Btn, data) end function UIPlayerInteractionView:OnCellClicked(scrollRect, index, cellTable, target, data) if target == cellTable.cell_Btn then self:CloseView() MDL.PlayerInteract.Execute(data, self.context.msgResp, self.context.extraParameter) end end function UIPlayerInteractionView:OnButtonClicked(obj) if obj == self.TipWindow then EventSystem.Dispatch(EventID.UI_Close_PlayerInteract) self:CloseView() end end return UIPlayerInteractionView