-- 排行榜界面 local UIHeroLightEffectTool = require "View/Common/UIHeroLightEffectTool" local UIRankListPanel = UIViewClass() local Common2DScenePrefab = ConstAssetPathConfig.Common2DScenePrefab local bgTexturePath = ConstAssetPathConfig.bgTexturePath1 local CellType = { Main = 1, Sub = 2, } local PlayerName = "%s%s" local GroupStrCfg = "%s%s" local LuaBit = require 'bit' -------------------- --[[ 界面内变量含义所管事情 self.clickRankIndex 选中的排行index,显示名片和弹窗 self.context.selectRankIndex 记录默认选中的index,其他界面跳转索引 self.lastSelectedIndex 用于更新选中态的index,点击新的排行榜玩家需要更新选中态 ]]-- function UIRankListPanel:OnCreated() self.selectedData = {} self.clickRankIndex = -1 self.lastSelectedIndex = 0 self.selectedCallBack = nil -- 切换页签时注册,回调刷新页签的时候执行一次 self.maxKudosNumDaily = DataSheetManager.ConstData:GetDataByID("KudosNumDaily").IntValue self.lastSelectRankType = nil -- 记录BOSS挑战子页签选择记录 self.selectBossSeasonId = 0 self.heroLightEffectDatas = UIHeroLightEffectTool.CreateHeroLightEffectDatas(true) end -- {rankType = rankType, sortType = sortType, toggleSwitchType = toggleSwitchType , paramTable = paramTable} function UIRankListPanel:OnOpened(context) self:RegistSystemEvent(EventID.UI_RefreshRankInfo, self.RefreshUI) self:RegistSystemEvent(EventID.UI_CommonShow_RefreshRoleInfo, self.ShowPlayerUI) self:RegistSystemEvent(EventID.WarZone_State_Change, self.RefreshLeftTabs) UIUtils.SetActive(self.UITemplateTitlePanel.btn_Info, false) UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS.IDS_3v3Rank) -- 排行榜标题 local inputSortType = context and context.sortType if inputSortType == CTL.Rank.SortType.AllServer and not CTL.Rank.IsAllServerSortTypeUnlock() then logging.error(LTAG.ERROR, "全服排行已锁上,请检查从外部传参的逻辑,这里视为无效数据") inputSortType = nil end self.sortType = inputSortType and inputSortType or CTL.Rank.SortType.MyServer if context.paramTable then self.selectBossSeasonId = context.paramTable.seasonId end self.isCountry = false -- 控制战力榜国家 self:ShowSortState() self:RefreshLeftTabs(self.sortType) --创建Handle self.modelComponentDataHandle = UTL.UIRender.CreateModelComponentDatas(self.obj_Model) -- 加载背景 UTL.UIRender.Create2DSceneTrans(self.modelComponentDataHandle, Common2DScenePrefab, 1600, 0, 1600, bgTexturePath, false) UIManager.ActiveUIModle(false, "UIRankListPanel") end function UIRankListPanel:OnClosed() --还原UI2DCommonScene设置的节点transform UTL.UIRender.SetCameraParentTransform(self.modelComponentDataHandle, UTL.UIRender.CameraParentPosAndRot.Default) UTL.UIRender.SetBlackPlaneTransform(self.modelComponentDataHandle, UTL.UIRender.BlackPlanePosAndRot.Default) UTL.UIRender.DisposeModelComponentData(self.modelComponentDataHandle) UIUtils.SetActive(self.UITemplateTitlePanel.btn_Info, true) UIManager.ActiveUIModle(true, "UIRankListPanel") self:StopHeroLightEffect(true) end function UIRankListPanel:OnButtonClicked(comp) if comp == self.UITemplateTitlePanel.btn_close then self:CloseView(true) elseif comp == self.UITemplateTitlePanel.btn_Home then CTL.HomeMain.CloseViewBackHomeMain() elseif comp == self.btn_Before then local sortType = self.sortType local maxType = CTL.Rank.IsAllServerSortTypeUnlock() and CTL.Rank.SortType.AllServer or CTL.Rank.SortType.WarZone if sortType > CTL.Rank.SortType.None + 1 then sortType = sortType - 1 else sortType = maxType end if not CTL.WarZone.IsWarZoneOpen() and sortType == CTL.Rank.SortType.WarZone then sortType = sortType - 1 end self.sortType = sortType self:ChangeSortState() if self.notFindRankData then --这儿原本改了刷刷了改的逻辑写得太乱了。考虑到性价比,先单独处理下从1往左跳到3的时候不要又重置回1,而是往左走了一格 if sortType == CTL.Rank.SortType.AllServer then self:OnButtonClicked(self.btn_Before) else self:ResetSortState() end end elseif comp == self.btn_Next then local sortType = self.sortType local maxType = CTL.Rank.IsAllServerSortTypeUnlock() and CTL.Rank.SortType.AllServer or CTL.Rank.SortType.WarZone sortType = sortType % maxType + 1 if not CTL.WarZone.IsWarZoneOpen() and sortType == CTL.Rank.SortType.WarZone then sortType = sortType % maxType + 1 end self.sortType = sortType self:ChangeSortState() if self.notFindRankData then self:ResetSortState() end elseif comp == self.btn_Info then --四国战力tips self:ShowFightGsRankTips(true) elseif comp == self.btn_Close_Tip then self:ShowFightGsRankTips(false) elseif comp == self.btn_Close_HeroCE then self:ShowNationFightGsRankDetail() elseif comp == self.group_Own.group_4.btn_CE then --国别排行榜,底下我的前6强头像 if CTL.Rank.IsNationFightGsRank(self.context.rankType) then self:ShowNationFightGsRankDetail(MDL.Rank.GetMyRankInfo().heroInfo, self.group_Own) end elseif comp == self.btn_1 then CTL.Activities.OpenActivityWindowByID(LuaConst.ActivityType.GuildSalary) elseif comp == self.btn_2 then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIGuildAuctionBase) elseif comp == self.btn_3 then CTL.Guild.OpenLeaderManagement() end end function UIRankListPanel:ResetSortState() self.sortType = CTL.Rank.SortType.MyServer self:ChangeSortState() self.notFindRankData = false end function UIRankListPanel:ShowSortState() if self.sortType == CTL.Rank.SortType.MyServer then --本服 UIUtils.SetLabelText(self.txt_SortType,Const_IDS.IDS_MyServer) elseif self.sortType == CTL.Rank.SortType.WarZone then --战区 UIUtils.SetLabelText(self.txt_SortType,Const_IDS.IDS_WarZone_Title_1) else UIUtils.SetLabelText(self.txt_SortType,Const_IDS.IDS_FairPlay_Rank_AllServer) end end function UIRankListPanel:ChangeSortState() if self.sortType == CTL.Rank.SortType.MyServer then --本服 UIUtils.SetLabelText(self.txt_SortType,Const_IDS.IDS_MyServer) self.isSwitchOper = true self:RefreshLeftTabs(CTL.Rank.SortType.MyServer) elseif self.sortType == CTL.Rank.SortType.WarZone then --战区 UIUtils.SetLabelText(self.txt_SortType,Const_IDS.IDS_WarZone_Title_1) self.isSwitchOper = true self:RefreshLeftTabs(CTL.Rank.SortType.WarZone) else UIUtils.SetLabelText(self.txt_SortType,Const_IDS.IDS_FairPlay_Rank_AllServer) self.isSwitchOper = true self:RefreshLeftTabs(CTL.Rank.SortType.AllServer) end end function UIRankListPanel:OnBackButtonPressed() self:OnButtonClicked(self.UITemplateTitlePanel.btn_close) end --region ******************** Loop ************************* function UIRankListPanel:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.loop_RankTab then -- 左侧列表 if data.cellType == CellType.Main then UIUtils.SetLabel(cellTable.txt_Name_Nomal, data.MainTitle) UIUtils.SetLabel(cellTable.txt_Name_Selected, data.MainTitle) cellTable.obj_ArrowState:SetState(data.Menu == CTL.Rank.MenuLevel.Single and 1 or 0) UIUtils.SetActive(cellTable.img_RedDot, false) else UIUtils.SetLabel(cellTable.txt_Name_Nomal, data.SubTitle) UIUtils.SetLabel(cellTable.txt_Name_Selected, data.SubTitle) UIUtils.SetActive(cellTable.img_RedDot, false) end elseif scrollRect == self.LoopScroll_Properties then -- 右侧排行榜 local info = data.data local rankType = data.type local isShowCross = self.sortType == CTL.Rank.SortType.WarZone UIUtils.SetActive(cellTable.group_Select.gameObject, self.lastSelectedIndex == index) -- 选中态 UIUtils.SetActive(cellTable.group_5.gameObject, false) -- 隐藏服务器列 UIUtils.SetActive(cellTable.btn_ThumbsUp, false) -- 隐藏点赞列 UIUtils.SetActive(cellTable.group_Country.gameObject, false) -- 隐藏国家列 UIUtils.SetActive(cellTable.group_4.img_Line, false) -- 隐藏战力列的下划线 if rankType == MDL.Rank.RankType.FightGs or CTL.Rank.IsNationFightGsRank(rankType) then -- 战力榜 self:SetNameAndRank(cellTable, info.name, info.index) -- 排行和玩家名 self:SetGuildFameNum(cellTable.group_3, info.guildSingleInfo.emblemContent, info.guildSingleInfo.emblemFrame) -- 势力徽记 UIUtils.SetLabel(cellTable.group_3.txt_Info, info.guildSingleInfo.guildName) -- 势力名 UIUtils.SetLabel(cellTable.group_4.txt_Info, tostring(info.param1)) -- 战力 UIUtils.SetActive(cellTable.group_5.gameObject, isShowCross) --点赞逻辑做一下区分 if rankType == MDL.Rank.RankType.FightGs then if self.context.toggleSwitchType == 1 then -- 本国下屏蔽点赞 UIUtils.SetActive(cellTable.btn_ThumbsUp, false) else self:SetThumbsUp(cellTable, info.thumbsUpNum, rankType, info.acid, info.index) -- 点赞数量 UIUtils.SetActive(cellTable.btn_ThumbsUp, true) end else UIUtils.SetActive(cellTable.btn_ThumbsUp, false) --屏蔽点赞 UIUtils.SetActive(cellTable.group_4.img_Line, true) -- 显示战力列的下划线 end if isShowCross then -- 国家图标设置 CTL.Country.SetCountrySquareIconInRank(cellTable.group_Country, info.countryID) UIUtils.SetLabel(cellTable.group_5.txt_ServerNum, string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, info.serverId)) end elseif rankType == MDL.Rank.RankType.Level then -- 等级榜 self:SetNameAndRank(cellTable, info.name, info.index) self:SetGuildFameNum(cellTable.group_3, info.guildSingleInfo.emblemContent, info.guildSingleInfo.emblemFrame) UIUtils.SetLabel(cellTable.group_3.txt_Info, info.guildSingleInfo.guildName) UIUtils.SetLabel(cellTable.group_4.txt_Info, UTL.Item.GetNobilityByTeamLevel(info.param1))-- 等级 UIUtils.SetActive(cellTable.group_5.gameObject, isShowCross) if isShowCross then UIUtils.SetLabel(cellTable.group_5.txt_ServerNum, string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, info.serverId)) end elseif rankType == MDL.Rank.RankType.ClimbTower then -- 爬塔 self:SetNameAndRank(cellTable, info.name, info.index) UIUtils.SetLabel(cellTable.group_3.txt_Info, CTL.ClimbTower.GetClimbTowerProgressCountTextById(info.param1)) -- 通关关卡 UIUtils.SetLabel(cellTable.group_4.txt_Info, tostring(info.param2)) -- 战力 UIUtils.SetActive(cellTable.group_5.gameObject, isShowCross) if isShowCross then UIUtils.SetLabel(cellTable.group_5.txt_ServerNum, string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, info.serverId)) end elseif CTL.Rank.IsNationClimbTowerRank(rankType) then -- 四国爬塔 self:SetNameAndRank(cellTable, info.name, info.index) UIUtils.SetLabel(cellTable.group_3.txt_Info, CTL.NationClimbTower.GetProgressFinishProgressName(CTL.NationClimbTower.RankTypeIDIndexTower[rankType], info.param1)) -- 通关关卡 UIUtils.SetLabel(cellTable.group_4.txt_Info, tostring(info.param2)) -- 战力 UIUtils.SetActive(cellTable.group_5.gameObject, isShowCross) if isShowCross then UIUtils.SetLabel(cellTable.group_5.txt_ServerNum, string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, info.serverId)) end elseif rankType == MDL.Rank.RankType.Fair3V3 then -- 三军争霸 self:SetNameAndRank(cellTable, info.name, info.index) UIUtils.SetLabel(cellTable.group_3.txt_Info, CTL.FairPlay.ChangeScoreAndIndexToDanStr(rankType, info.param1, info.index)) -- 段位 UIUtils.SetLabel(cellTable.group_4.txt_Info, tostring(info.param1)) -- 积分 UIUtils.SetActive(cellTable.group_5.gameObject, isShowCross) if isShowCross then UIUtils.SetLabel(cellTable.group_5.txt_ServerNum, string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, info.serverId)) end elseif rankType == MDL.Rank.RankType.Fair3V3AllServer then -- 三军争霸 全服榜 self:SetNameAndRank(cellTable, info.name, info.index) UIUtils.SetLabel(cellTable.group_3.txt_Info, string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, info.serverId)) -- 所属服 UIUtils.SetLabel(cellTable.group_4.txt_Info, tostring(info.param1)) -- 积分 UIUtils.SetActive(cellTable.group_5.gameObject, false) elseif rankType == MDL.Rank.RankType.BossChallenge then -- 无双挑战 self:SetNameAndRank(cellTable, info.name, info.index) UIUtils.SetLabel(cellTable.group_3.txt_Info, tostring(info.param1)) -- 总积分 UIUtils.SetLabel(cellTable.group_4.txt_Info, string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, info.param2)) -- 所属服 elseif rankType == MDL.Rank.RankType.SyncSolo then -- 谁与争锋 self:SetNameAndRank(cellTable, info.name, info.index) UIUtils.SetLabel(cellTable.group_3.txt_Info, CTL.FairPlay.ChangeScoreAndIndexToDanStr(rankType, info.param1, info.index)) -- 段位 UIUtils.SetLabel(cellTable.group_4.txt_Info, tostring(info.param1)) -- 积分 UIUtils.SetActive(cellTable.group_5.gameObject, isShowCross) if isShowCross then UIUtils.SetLabel(cellTable.group_5.txt_ServerNum, string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, info.serverId)) end elseif rankType == MDL.Rank.RankType.SyncSoloAllServer then -- 谁与争锋 全服 self:SetNameAndRank(cellTable, info.name, info.index) UIUtils.SetLabel(cellTable.group_3.txt_Info, string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, info.serverId)) --所属服 UIUtils.SetLabel(cellTable.group_4.txt_Info, tostring(info.param1)) -- 积分 UIUtils.SetActive(cellTable.group_5.gameObject, false) elseif rankType == MDL.Rank.RankType.DemonGod then -- 魔神降世 self:SetNameAndRank(cellTable, info.name, info.index) UIUtils.SetLabel(cellTable.group_3.txt_Info, tostring(info.param1)) -- 伤害量 UIUtils.SetLabel(cellTable.group_4.txt_Info, string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, info.serverId)) -- 所属服 elseif rankType == MDL.Rank.RankType.ThreeTeamFight then self:SetNameAndRank(cellTable, info.name, info.index) UIUtils.SetLabel(cellTable.group_3.txt_Info, CTL.ThreeTeamFight.GetRankDesc(info.index, false, true)) UIUtils.SetLabel(cellTable.group_4.txt_Info, tostring(info.param1)) UIUtils.SetLabel(cellTable.group_5.txt_ServerNum, string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, info.serverId)) -- 所属服 UIUtils.SetActive(cellTable.group_5.gameObject, true) elseif rankType == MDL.Rank.RankType.Guild then -- 势力名望 -- 是否是名门势力 if MDL.Guild.GetMyFamousInfo().hasFirstBalance == false then self:SetNameAndRank(cellTable, info.guildName, info.index) else if info.famousGuild then self:SetNameAndRank(cellTable, info.guildName, info.index) cellTable.group_1.UIState:SetState(4) else self:SetNameAndRank(cellTable, info.guildName, info.index) end end self:SetGuildFameNum(cellTable.group_2, info.emblemContent, info.emblemFrame) self:SetGuildReputation(cellTable, info.param1, info.param2) UIUtils.SetLabel(cellTable.group_3.txt_Info, info.guildLeaderName) UIUtils.SetActive(cellTable.group_5.gameObject, isShowCross) if isShowCross then UIUtils.SetLabel(cellTable.group_5.txt_ServerNum, string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, info.ServerId)) end elseif rankType == MDL.Rank.RankType.GuildBoss then -- 魔将来袭 self:SetNameAndRank(cellTable, info.guildName, info.index) self:SetGuildFameNum(cellTable.group_2, info.emblemContent, info.emblemFrame) UIUtils.SetLabel(cellTable.group_3.txt_Info, info.guildLeaderName) UIUtils.SetLabel(cellTable.group_4.txt_Info, info.param1) UIUtils.SetActive(cellTable.group_5.gameObject, isShowCross) if isShowCross then UIUtils.SetLabel(cellTable.group_5.txt_ServerNum, string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, info.ServerId)) end elseif rankType == MDL.Rank.RankType.GuildWar then -- 势力争霸 self:SetNameAndRank(cellTable, info.guildName, info.index) self:SetGuildFameNum(cellTable.group_2, info.emblemContent, info.emblemFrame) UIUtils.SetLabel(cellTable.group_3.txt_Info, info.guildLeaderName) UIUtils.SetLabel(cellTable.group_4.txt_Info, self:GetGuildWarRank(info.param1, info.param2)) UIUtils.SetActive(cellTable.group_5.gameObject, isShowCross) if isShowCross then UIUtils.SetLabel(cellTable.group_5.txt_ServerNum, string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, info.ServerId)) end elseif rankType == MDL.Rank.RankType.GuildEscort then -- 势力运镖 self:SetNameAndRank(cellTable, info.guildName, info.index) self:SetGuildFameNum(cellTable.group_2, info.emblemContent, info.emblemFrame) UIUtils.SetLabel(cellTable.group_3.txt_Info, info.guildLeaderName) UIUtils.SetLabel(cellTable.group_4.txt_Info, tostring(info.param1)) UIUtils.SetActive(cellTable.group_5.gameObject, isShowCross) if isShowCross then UIUtils.SetLabel(cellTable.group_5.txt_ServerNum, string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, info.ServerId)) end elseif rankType == MDL.Rank.RankType.Country then -- 国家 self:SetNameAndRank(cellTable, nil, info.index) cellTable.group_3.txt_Info.text = info.GuildLeadName self:SetGuildFameNum(cellTable.group_3, info.emblemContent, info.emblemFrame) UIUtils.SetLabel(cellTable.group_4.txt_Info, info.dominating) CTL.Country.SetCountryInRank(cellTable.group_2.img_Guild, cellTable.group_2.txt_Guild, info.CountryId) UIUtils.SetActive(cellTable.group_2.img_Guild, true) end elseif scrollRect == self.loop_HeroCE then -- 四国战力排行榜下点击战力弹出的前6强头像 cellTable.state_Hero:SetState(data and 0 or 1) if data then --这里和武将列表类似,要设置背景和框,目前在UTL.Item没有统一设置的方法,就先复制武将列表的写法了。 UTL.Item.SetHeroIconByHeroId(cellTable.img_SelectedHero, data.heroId) local heroData = DataSheetManager.HeroNum:GetDataByID(data.heroId) UTL.Color.SetQualityImageByType(cellTable.img_QualityFrame, heroData.HeroQuality, UTL.Color.QualityType.HeroSelectFrame) UTL.Color.SetQualityImageByType(cellTable.img_QualityHead, heroData.HeroQuality, UTL.Color.QualityType.HeroSelectBg) UIUtils.SetLabel(cellTable.txt_BR,data.gs) end end end function UIRankListPanel:OnCellSelect(scrollRect, index, cellTable, data) if scrollRect == self.loop_RankTab then UIUtils.SetActive(self.Group_PeakPower, false) UIUtils.SetActive(self.txt_Times, true) self.txt_CountDown:EndTimer() -- 只有切换到不展示角色的排行榜时 在卸载模型 if CTL.Rank.GetShowUITypeByRankType(data.Type) == CTL.Rank.ShowType.Guild then UTL.UIRender.DisposePlayerModel(self.modelComponentDataHandle) UTL.UIRender.DisposeHorseOther(self.modelComponentDataHandle) -- Dsipose函数不会停止光效,所以这里需要手动停止,否则切换到一些没人的空榜时会出现模型没了但光效还在的情况 self:StopHeroLightEffect() end if data.Type == MDL.Rank.RankType.Guild and self.sortType == CTL.Rank.SortType.MyServer then self:UpdateGuildAttach() end self.IsCountry = false if data.cellType == CellType.Main then if data.Menu == CTL.Rank.MenuLevel.Single then if data.Type == MDL.Rank.RankType.DemonGod then data.GetServerDataFunc(data.Type, {isPreRank = false}, self.sortType) elseif data.Type == MDL.Rank.RankType.FightGs then data.GetServerDataFunc(data.Type, { isCountry = self.isCountry }, self.sortType) else data.GetServerDataFunc(data.Type, nil, self.sortType) end end else if data.Menu == CTL.Rank.MenuLevel.Double then if data.Type == MDL.Rank.RankType.BossChallenge then self.selectBossSeasonId = data.seasonId data.GetServerDataFunc(data.Type, {bossLevelId = data.bossLevelId, seasonId = data.seasonId}, self.sortType) elseif data.Type == MDL.Rank.RankType.Guild then data.GetServerDataFunc(data.Type, nil, self.sortType) elseif data.Type == MDL.Rank.RankType.ClimbTower or CTL.Rank.IsNationClimbTowerRank(data.Type) then -- 四国爬塔 data.GetServerDataFunc(data.Type, nil, self.sortType) elseif data.Type == MDL.Rank.RankType.FightGs or CTL.Rank.IsNationFightGsRank(data.Type) then data.GetServerDataFunc(data.Type, nil, self.sortType) elseif data.Type == MDL.Rank.RankType.Country then data.GetServerDataFunc(data.Type, nil, self.sortType) end elseif data.Menu == CTL.Rank.MenuLevel.SubItem then if data.Type == MDL.Rank.RankType.GuildBoss then self.sortType = CTL.WarZone.IsWarZoneOpen() and CTL.Rank.SortType.WarZone or CTL.Rank.SortType.MyServer data.GetServerDataFunc(data.Type, nil, self.sortType) elseif data.Type == MDL.Rank.RankType.GuildWar then self.sortType = CTL.GuildWar.IsCrossServerSettled() and CTL.Rank.SortType.WarZone or CTL.Rank.SortType.MyServer data.GetServerDataFunc(data.Type, nil, self.sortType) elseif data.Type == MDL.Rank.RankType.GuildEscort then self.sortType = CTL.WarZone.IsWarZoneOpen() and CTL.Rank.SortType.WarZone or CTL.Rank.SortType.MyServer data.GetServerDataFunc(data.Type, nil, self.sortType) elseif data.Type == MDL.Rank.RankType.GuildPower then self.sortType = CTL.WarZone.IsWarZoneOpen() and CTL.Rank.SortType.WarZone or CTL.Rank.SortType.MyServer data.GetServerDataFunc(data.Type, nil, self.sortType) end end end local isChangeType = self.context.rankType ~= data.Type self.context.rankType = data.Type self.clickRankIndex = -1 if isChangeType then self.selectedCallBack = function() self.LoopScroll_Properties:SelectIndex(0) end else self.selectedCallBack = function() self.LoopScroll_Properties:SelectIndex(self.context.selectRankIndex or 0) end end end end function UIRankListPanel:UpdateSelectState(cellTable, index, data) UIUtils.SetActive(cellTable.group_Select.gameObject, true) local tempLastIndex = self.lastSelectedIndex self.lastSelectedIndex = index if tempLastIndex < self.LoopScroll_Properties.Count then self.LoopScroll_Properties:UpdateIndex(tempLastIndex) end end function UIRankListPanel:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.loop_RankTab then self:RefreshTab(scrollRect, data) elseif scrollRect == self.LoopScroll_Properties then if target == cellTable.img_Nor or target == cellTable.img_Gold then if MDL.Rank.GetRemainingThumbsUpTimes() == 0 then CTL.Tips.AddTipsMsg(Const_IDS.IDS_Ranking_NoGood) else self.context.selectRankIndex = index MDL.Rank.ThumbsUpForWhomRequest(data.type, data.data.acid, self.sortType) end else -- 更新选中态 self:UpdateSelectState(cellTable, index, data) -- 更新模型及角色显示 if CTL.Rank.GetShowUITypeByRankType(data.type) == CTL.Rank.ShowType.Player then MDL.Rank.CommonShowGetInfoRequest(data.data.acid, data.type) elseif CTL.Rank.GetShowUITypeByRankType(data.type) == CTL.Rank.ShowType.Country then self:ShowCountryUI(data.data) else self:ShowGuildUI(data.data) end local ignoreInteractView if target == cellTable.group_4.btn_CE and CTL.Rank.IsNationFightGsRank(self.context.rankType) then local heroInfo = data.data.heroInfo self:ShowNationFightGsRankDetail(heroInfo, cellTable) --四国战力榜前6弹窗 ignoreInteractView = true --此弹窗优先级比玩家详情高 end if CTL.Rank.GetShowUITypeByRankType(data.type) == CTL.Rank.ShowType.Player then if self.clickRankIndex == index and not ignoreInteractView then CTL.PlayerInteract.OpenFriendInteractView(data.data.acid) end self.context.sortType = self.sortType self.context.selectRankIndex = index self.clickRankIndex = index elseif CTL.Rank.GetShowUITypeByRankType(data.type) == CTL.Rank.ShowType.Guild then if self.clickRankIndex == index then MDL.Country.CountryGetTargetGuildInfoReq(data.data.guildID) end self.context.sortType = self.sortType self.context.selectRankIndex = index self.clickRankIndex = index end end end end function UIRankListPanel:ShowFightGsRankTips(show) UIUtils.SetActive(self.tip_Notice, show) if show then local rankType = self.context.rankType if rankType >= MDL.Rank.RankType.FightGs_Wei and rankType <= MDL.Rank.RankType.FightGs_Qun then local colorCountryName = CTL.Country.GetCountryFullNameWithColor(rankType - MDL.Rank.RankType.FightGs_Wei + 1) UIUtils.SetLabel(self.lab_Notice1, string.FormatByIdsId(Const_IDS.IDS_4ContryHeroRank_tips1, colorCountryName)) end end end function UIRankListPanel:ShowNationFightGsRankDetail(heroInfo, cellTable) if heroInfo then UIUtils.SetActive(self.tip_HeroCE_obj, true) table.sort(heroInfo, function(a,b) return a.gs > b.gs end) self.loop_HeroCE:ClearCells() for _, v in ipairs(heroInfo) do self.loop_HeroCE:AddData(v, 0) end for i = #heroInfo, 6 do --不满6个武将用空白填充 self.loop_HeroCE:AddData(nil, 0) end --位置适配,列表上半区域的显示在选中条目的下方,反之亦然 local posAnchor if not cellTable.pos_Down then --我的排行,只会显示在上方 posAnchor = cellTable.pos_Up else local _,cellHeight = cellTable.cell.transform:GetSizeDelta() local _,cellPosY = cellTable.cell.transform:GetLocalPosition() local cellIndex = math.abs(cellPosY/cellHeight) posAnchor = cellIndex > 4 and cellTable.pos_Up or cellTable.pos_Down end local _, posY = posAnchor.transform:GetPosition() local posX = self.tip_HeroCE.transform:GetPosition() self.tip_HeroCE.transform:SetPosition(posX,posY) --位置适配结束 else UIUtils.SetActive(self.tip_HeroCE_obj, false) end end -------------------- function UIRankListPanel:ClearSelectedData() self.selectedData.mainData = nil self.selectedData.subDataList = {} end function UIRankListPanel:InitLeftLoop(sortType) self:ClearSelectedData() self.loop_RankTab:ClearCells() local rankType = self.context.rankType if not rankType then logging.error(LTAG.ERROR, "排行榜界面打开时没有传入参数,请检查…!") end -- 势力战 势力BOSS 势力押镖 类型特殊处理 if rankType == MDL.Rank.RankType.GuildBoss or rankType == MDL.Rank.RankType.GuildWar or rankType == MDL.Rank.RankType.GuildEscort then self.lastSelectRankType = rankType rankType = MDL.Rank.RankType.Guild elseif CTL.Rank.IsNationClimbTowerRank(rankType) then self.lastSelectRankType = rankType rankType = MDL.Rank.RankType.ClimbTower elseif CTL.Rank.IsNationFightGsRank(rankType) then self.lastSelectRankType = rankType rankType = MDL.Rank.RankType.FightGs end -- 确定排行榜分类 local sortTypeParam = CTL.Rank.GetRankSort(rankType) if self:CheckSortType(sortTypeParam,sortType) then self.sortType = sortType else logging.error(LTAG.ERROR, "排行榜界面打开时没有传入参数,请检查…!") end local selectIndex = -1 local index = 0 for i, v in ipairs(CTL.Rank.GetAllRankData()) do local tmpSortType = CTL.Rank.GetRankSort(v.Type) if self:CheckSortType(tmpSortType,self.sortType) then v.isUnfold = false v.cellType = CellType.Main v.mainTabIndex = index self.loop_RankTab:AddData(v, 0) if v.Type == rankType then selectIndex = v.mainTabIndex end index = index + 1 end end -- 设置选中的index if selectIndex < 0 then self.notFindRankData = true else self.notFindRankData = false --因为cellClick中执行了GetCellTableByIndex,未移动完成的时候执行会报空,所以把移动去掉了 --todo 这里不能调用moveindex 切记原因是move的时候 可能并不是一帧就会move结束GetCellTableByIndex 调用的时候下标错误 会报错 --正常不应该使用GetCellTableByIndex 这个方法 改动起来很麻烦 如果下次再有需求需要跳转 self.loop_RankTab:SelectIndex(selectIndex) end end function UIRankListPanel:CheckSortType(sortTypeParam,sortType) return sortTypeParam == sortType or (sortTypeParam == CTL.Rank.SortType.None and sortType ~= CTL.Rank.SortType.AllServer) end function UIRankListPanel:RefreshTab(scrollRect, mainData) if mainData.cellType ~= CellType.Main then return end if self.selectedData.mainData then for i = #self.selectedData.subDataList, 1, -1 do self.loop_RankTab:RemoveIndex(self.selectedData.mainData.mainTabIndex + 1) -- 永远移除下一个 table.remove(self.selectedData.subDataList) end local mainCell = scrollRect:GetCellTableByIndex(self.selectedData.mainData.mainTabIndex) UIUtils.SetActive(mainCell.img_Selected, false) end --当点击主Cell时,判断是否为重复点击,重复点击时取消选中,不加载子项 local mainCell = scrollRect:GetCellTableByIndex(mainData.mainTabIndex) if self.selectedData.mainData ~= mainData then self.selectedData.mainData = mainData -- 不同的主页签重置 self.isCountry = false UIUtils.SetActive(mainCell.img_Selected, true) UIUtils.SetActive(mainCell.img_UnSelected, false) if mainData.subData and not self.isSwitchOper then -- 切换刷新时不播放打开声音 CTL.Sound.PlayGameSound("UI_expand") end else --再次点击 主cell时,取消选中,不显示子项 if self.selectedData.mainData.subData then CTL.Sound.PlayGameSound("UI_fold") end self.selectedData.mainData = nil UIUtils.SetActive(mainCell.img_Selected, false) UIUtils.SetActive(mainCell.img_UnSelected, true) return end self.isSwitchOper = false if mainData.subData then local selectChildIndex local index = 1 for i, v in ipairs(mainData.subData) do local sortType = CTL.Rank.GetRankSort(v.Type) if self:CheckSortType(sortType,self.sortType) then table.insert(self.selectedData.subDataList, v) v.cellType = CellType.Sub if self.lastSelectRankType then if mainData.Type == MDL.Rank.RankType.BossChallenge and self.lastSelectRankType == v.seasonId then selectChildIndex = mainData.mainTabIndex + index elseif mainData.Type == MDL.Rank.RankType.Guild and self.lastSelectRankType == v.Type then selectChildIndex = mainData.mainTabIndex + index elseif mainData.Type == MDL.Rank.RankType.ClimbTower and self.lastSelectRankType == v.Type then selectChildIndex = mainData.mainTabIndex + index elseif mainData.Type == MDL.Rank.RankType.FightGs and self.lastSelectRankType == v.Type then selectChildIndex = mainData.mainTabIndex + index end end self.loop_RankTab:InsertData(mainData.mainTabIndex + index, v, 1) index = index + 1 end end scrollRect:SelectIndex(selectChildIndex or mainData.mainTabIndex + 1) -- 展开后默认选中子项第一个 local mainCell = scrollRect:GetCellTableByIndex(mainData.mainTabIndex) UIUtils.SetActive(mainCell.img_Selected, true) if self.lastSelectRankType then self.lastSelectRankType = nil end else if self.selectedData.mainData then local mainCell = scrollRect:GetCellTableByIndex(self.selectedData.mainData.mainTabIndex) UIUtils.SetActive(mainCell.img_Selected, true) end end end function UIRankListPanel:RefreshTitleUI(rankType, isCrossInfo) -- 无双挑战 比较特殊 已经有区服显示了 此处不现实区服信息 if rankType == MDL.Rank.RankType.BossChallenge then UIUtils.SetActive(self.goup_labLocal_SubTitle03.gameObject, false) -- 区服信息 else UIUtils.SetActive(self.goup_labLocal_SubTitle03.gameObject, isCrossInfo == true) -- 区服信息 end UIUtils.SetActive(self.goup_CountryTitle.gameObject, false) self:ShowFightGsRankTips(false) local isNationFightGsRank = CTL.Rank.IsNationFightGsRank(rankType) UIUtils.SetActive(self.group_Btn, isNationFightGsRank) if rankType == MDL.Rank.RankType.FightGs or isNationFightGsRank then -- 战力榜 self:SetRankLabTxt(Const_IDS.IDS_3v3Name, Const_IDS.IDS_Ranking_Guild, Const_IDS.IDS_Runk_Power) UIUtils.SetActive(self.goup_CountryTitle.gameObject, isCrossInfo) elseif rankType == MDL.Rank.RankType.Level then -- 等级榜 self:SetRankLabTxt(Const_IDS.IDS_3v3Name, Const_IDS.IDS_Ranking_Guild, Const_IDS.IDS_Runk_Lv) elseif rankType == MDL.Rank.RankType.ClimbTower then -- 爬塔 self:SetRankLabTxt(Const_IDS.IDS_3v3Name, Const_IDS.IDS_Runk_Customs, Const_IDS.IDS_Runk_Power) elseif CTL.Rank.IsNationClimbTowerRank(rankType) then -- 四国爬塔 self:SetRankLabTxt(Const_IDS.IDS_3v3Name, Const_IDS.IDS_Runk_Customs, Const_IDS.IDS_Runk_Power) elseif rankType == MDL.Rank.RankType.Fair3V3 or rankType == MDL.Rank.RankType.SyncSolo then -- 三军争霸 or 谁与争锋 self:SetRankLabTxt(Const_IDS.IDS_3v3Name, Const_IDS.IDS_3v3Level, Const_IDS.IDS_3v3Points) elseif rankType == MDL.Rank.RankType.Fair3V3AllServer or rankType == MDL.Rank.RankType.SyncSoloAllServer then -- 三军争霸 or 谁与争锋 全服 self:SetRankLabTxt(Const_IDS.IDS_3v3Name, Const_IDS.IDS_NewSetting_Basic_13, Const_IDS.IDS_3v3Points) elseif rankType == MDL.Rank.RankType.BossChallenge then -- 无双挑战 self:SetRankLabTxt(Const_IDS.IDS_3v3Name, Const_IDS.IDS_Rank_Score, Const_IDS.IDS_NewSetting_Basic_13) elseif rankType == MDL.Rank.RankType.Guild then -- 势力名望 self:SetRankLabTxt(Const_IDS.IDS_Ranking_GuildName, Const_IDS.IDS_Ranking_GuildOwner, Const_IDS.IDS_Ranking_GuildFame) elseif rankType == MDL.Rank.RankType.GuildBoss then -- 魔将来袭 self:SetRankLabTxt(Const_IDS.IDS_Ranking_GuildName, Const_IDS.IDS_Ranking_GuildOwner, Const_IDS.IDS_Ranking_GuildDPS) elseif rankType == MDL.Rank.RankType.GuildWar then -- 势力争霸 self:SetRankLabTxt(Const_IDS.IDS_Ranking_GuildName, Const_IDS.IDS_Ranking_GuildOwner, Const_IDS.IDS_Ranking_GuildRank) elseif rankType == MDL.Rank.RankType.GuildEscort then -- 势力运镖 self:SetRankLabTxt(Const_IDS.IDS_Ranking_GuildName, Const_IDS.IDS_Ranking_GuildOwner, Const_IDS.IDS_Escort_RankTitle) elseif rankType == MDL.Rank.RankType.GuildPower then -- 势力运镖 self:SetRankLabTxt(Const_IDS.IDS_Ranking_GuildName, Const_IDS.IDS_Ranking_GuildOwner, Const_IDS.IDS_Country_GuildPower) elseif rankType == MDL.Rank.RankType.DemonGod then -- 魔神降世 self:SetRankLabTxt(Const_IDS.IDS_3v3Name, Const_IDS.IDS_DemonGod_UI_20, Const_IDS.IDS_NewSetting_Basic_13) UIUtils.SetActive(self.goup_labLocal_SubTitle03.gameObject, false) elseif rankType == MDL.Rank.RankType.Country then self:SetRankLabTxt(Const_IDS.IDS_CHAT_Name_17_Country, Const_IDS.IDS_Country_CountryKing, Const_IDS.IDS_Country_NationPower) UIUtils.SetActive(self.goup_labLocal_SubTitle03.gameObject, false) elseif rankType == MDL.Rank.RankType.Storm then -- 暴风 self:SetRankLabTxt(Const_IDS.IDS_3v3Name, Const_IDS.IDS_GuildWar_HOFScore, Const_IDS.IDS_NewSetting_Basic_13) UIUtils.SetActive(self.goup_labLocal_SubTitle03.gameObject, false) elseif rankType == MDL.Rank.RankType.ThreeTeamFight then -- 群雄演武 self:SetRankLabTxt(Const_IDS.IDS_3v3Name, Const_IDS.IDS_3v3Level, Const_IDS.IDS_Runk_Power, Const_IDS.IDS_NewSetting_Basic_13) UIUtils.SetActive(self.goup_labLocal_SubTitle03.gameObject, true) end end function UIRankListPanel:RefreshUI(rankType, subData) self:ShowSortState() -- 是否展示区服信息 local isCrossInfo = subData and subData.isCross or false self:RefreshTitleUI(rankType, isCrossInfo) if self.LoopScroll_Properties.Count > 0 then self.LoopScroll_Properties:ClearCells() end UIUtils.SetActive(self.group_Toggle.gameObject, false) UIUtils.SetActive(self.group_Own.gameObject, true) UIUtils.SetActive(self.group_Own.group_Country.gameObject, false) self:ShowNationFightGsRankDetail() UIUtils.SetLabel(self.txt_Times, "") UIUtils.SetLabel(self.txt_FairTournamentPoint, nil) local rankInfo = MDL.Rank.GetRankInfoDataByType(rankType, subData) if rankInfo then if rankType == MDL.Rank.RankType.FightGs or CTL.Rank.IsNationFightGsRank(rankType) then --战力榜,包括个人和四国 self:SetTopToggleUI( Const_IDS.IDS_WarZone_Title_1, Const_IDS.IDS_Country_OwnCountry, isCrossInfo ) elseif rankType == MDL.Rank.RankType.Level then -- 个人榜_等级榜 self:RefreshLevelRankUI(rankInfo) elseif rankType == MDL.Rank.RankType.ClimbTower then -- 个人榜_爬塔 self: RefreshClimbTowerRankUI(rankInfo, rankType) elseif CTL.Rank.IsNationClimbTowerRank(rankType) then -- 四国爬塔 self:RefreshNationClimbTowerRankUI(rankInfo, rankType) elseif rankType == MDL.Rank.RankType.BossChallenge then -- 个人榜_无双挑战 self:RefreshBossRankUI(rankInfo) elseif rankType == MDL.Rank.RankType.Fair3V3 then --个人榜_ 三军争霸 self:RefreshPVPRankUI(rankInfo,rankType) elseif rankType == MDL.Rank.RankType.SyncSolo then -- 个人榜_谁与争锋 self:RefreshSyncSoloRankUI(rankInfo,rankType) elseif rankType == MDL.Rank.RankType.Fair3V3AllServer then --全服榜_ 三军争霸 self:RefreshPVPRankUI(rankInfo,rankType) elseif rankType == MDL.Rank.RankType.SyncSoloAllServer then -- 全服榜_谁与争锋 self:RefreshSyncSoloRankUI(rankInfo,rankType) elseif rankType == MDL.Rank.RankType.Guild then -- 势力榜_势力名望 if isCrossInfo == false then self:SetTopToggleUI( Const_IDS.IDS_DemonGod_UI_35, Const_IDS.IDS_DemonGod_UI_18, true ) else self:RefreshGuildRankUI(rankInfo) end elseif rankType == MDL.Rank.RankType.GuildBoss then -- 势力榜_魔将来袭 self:RefreshGuildBossRankUI(rankInfo) elseif rankType == MDL.Rank.RankType.GuildWar then -- 势力榜_势力争霸 self:RefreshGuildWarRankUI(rankInfo) elseif rankType == MDL.Rank.RankType.GuildEscort then -- 势力榜_势力运镖 self:RefreshGuildEscortRankUI(rankInfo) elseif rankType == MDL.Rank.RankType.GuildPower then -- 势力榜_势力运镖 self:RefreshGuildPowerRankUI(rankInfo) elseif rankType == MDL.Rank.RankType.DemonGod then -- 个人榜_魔神降世 self:RefreshDemonGodRankUI(rankInfo) elseif rankType == MDL.Rank.RankType.Country then -- 国家榜 self:SetTopToggleUI(Const_IDS.IDS_DemonGod_UI_35, Const_IDS.IDS_DemonGod_UI_18, true) elseif rankType == MDL.Rank.RankType.Storm then self:RefreshStormRankUI(rankInfo) -- 暴风 elseif rankType == MDL.Rank.RankType.ThreeTeamFight then self:RefreshThreeTeamFightRankUI(rankInfo) -- 暴风 end end if self.selectedCallBack then if self.LoopScroll_Properties.Count > 0 then self.selectedCallBack() else UTL.UIRender.DisposeHorseOther(self.modelComponentDataHandle) UTL.UIRender.DisposePlayerModel(self.modelComponentDataHandle) self:StopHeroLightEffect() self.obj_ShowState:SetState(2) end self.selectedCallBack = nil end end -- 需要使用toggle的榜单进行设置 function UIRankListPanel:SetTopToggleUI(idsLeft, idsRight, setShow) UIUtils.SetActive(self.group_Toggle.gameObject, setShow) UTL.Toggle.InitToggleGroupByIDS(self.toggle_Group, "lab_State",{ idsLeft, idsRight }) local selectIndex = self.context.toggleSwitchType or 0 self.toggle_Group:SelectIndex(selectIndex) end ---------- Start 排行榜中部UI展示 Start ----------- function UIRankListPanel:ShowGuildUI(info) self.obj_ShowState:SetState(1) if string.isNilOrEmpty(info.notice) then UIUtils.SetLabelText(self.group_Guild.labLocal_GuildDescribe, Const_IDS.IDS_Guild_InitialNotice) else UIUtils.SetLabel(self.group_Guild.labLocal_GuildDescribe, info.notice) end UIUtils.SetLabel(self.group_Guild.txt_GuildName, info.guildName) self:SetGuildFameNum(self.group_Guild, info.emblemContent, info.emblemFrame) end function UIRankListPanel:ShowCountryUI(info) self.obj_ShowState:SetState(3) UTL.UIRender.DisposeHorseOther(self.modelComponentDataHandle) UTL.UIRender.DisposePlayerModel(self.modelComponentDataHandle) self:StopHeroLightEffect() UIUtils.SetLabel(self.group_Country.txt_CountryName, MDL.Country.GetCountryTitle(info.reignTitle, info.CountryId)) UIUtils.SetLabel(self.group_Country.lab_CountryDescribe, MDL.Country.GetCountryAnnouncement(info.notice, info.CountryId)) CTL.Country.SetCountryImage(self.group_Country, info.CountryId) end function UIRankListPanel:ShowPlayerUI(headInfo) --排行榜视角特殊需求:设置UI2DCommonScene节点transform,调整位置角度 UTL.UIRender.SetCameraParentTransform(self.modelComponentDataHandle, UTL.UIRender.CameraParentPosAndRot.RankUI) UTL.UIRender.SetBlackPlaneTransform(self.modelComponentDataHandle, UTL.UIRender.BlackPlanePosAndRot.RankUI) self.obj_ShowState:SetState(0) -- 设置节点位置 -- 加载战骑 local isStandOnHorse, driverAnim, horseCfg if headInfo.horseAppearanceId > 0 then local appearanceData = MDL.WarHorse.GetAppearanceInfoByID(headInfo.horseAppearanceId) UTL.UIRender.CreateHorse3DModel(self.modelComponentDataHandle, headInfo.HorseID, headInfo.horseAppearanceId, UTL.UIRender.LayerActiveType.HorseShow) isStandOnHorse, driverAnim = UTL.UIRender.GetOnHorseAnim(appearanceData) horseCfg = appearanceData elseif headInfo.HorseID > 0 then local horseData = DataSheetManager.HorseData:GetDataByHorseID(headInfo.HorseID) UTL.UIRender.CreateHorse3DModel(self.modelComponentDataHandle, headInfo.HorseID, 0, UTL.UIRender.LayerActiveType.HorseShow) isStandOnHorse, driverAnim = UTL.UIRender.GetOnHorseAnim(horseData) horseCfg = horseData else UTL.UIRender.DisposeHorseOther(self.modelComponentDataHandle) UTL.UIRender.DisposePlayerModel(self.modelComponentDataHandle) end -- 加载人物 local resolutionRatio = UIUtils.GetScreenResolutionRatio() local heroLightEffects = headInfo.lightEffectIds self:StopHeroLightEffect() if headInfo.HorseID > 0 or headInfo.horseAppearanceId > 0 then UTL.UIRender.Create2DSceneTrans(self.modelComponentDataHandle, Common2DScenePrefab, 1600, 0, 1600, bgTexturePath, false) UTL.UIRender.StartRideHorse(self.modelComponentDataHandle, headInfo.HorseID, headInfo.HeroID, headInfo) if not isStandOnHorse then UTL.UIRender.DriverEntityPlayAnim(self.modelComponentDataHandle, "ride_idle_loop") else UTL.UIRender.DriverEntityPlayAnim(self.modelComponentDataHandle, LuaConst.Animation_idle_loop) end local modelRot = horseCfg.RankModelRot and horseCfg.RankModelRot or horseCfg.RankModelRot if resolutionRatio == LuaConst.ScreenResolutionRatio.RatioPad4_3 or resolutionRatio == LuaConst.ScreenResolutionRatio.RatioPadOther then local posX, posY, posZ = CTL.WarHorse.GetHorseRankModelXYZ(horseCfg, 0.6, -1.06, -0.6) UTL.UIRender.SetHeroParentPos(self.modelComponentDataHandle, posX, posY, posZ) UTL.UIRender.SetHeroParentRot(self.modelComponentDataHandle, 0, modelRot, 1.335) else local posX, posY, posZ = CTL.WarHorse.GetHorseRankModelXYZ(horseCfg, 0.6, -1.12, -0.25) UTL.UIRender.SetHeroParentPos(self.modelComponentDataHandle, posX, posY, posZ) UTL.UIRender.SetHeroParentRot(self.modelComponentDataHandle, 0, modelRot, 0) end UTL.UIRender.SetModelRootLocalScale(self.modelComponentDataHandle, 0.9, 0.9, 0.9) --播放光效 self:BeginHeroLightEffect(self, UIHeroLightEffectTool.PlayLightEffectFuncEnum.UI3DDriver, heroLightEffects) else UTL.UIRender.DisposeHorseOther(self.modelComponentDataHandle) UTL.UIRender.DisposePlayerModel(self.modelComponentDataHandle) UTL.UIRender.Create2DSceneTrans(self.modelComponentDataHandle, Common2DScenePrefab, 1600, 0, 1600, bgTexturePath, false) UTL.UIRender.CreatePlayerModel(self.modelComponentDataHandle, headInfo.HeroID, nil, nil, true) if resolutionRatio == LuaConst.ScreenResolutionRatio.RatioPad4_3 or resolutionRatio == LuaConst.ScreenResolutionRatio.RatioPadOther then UTL.UIRender.SetHeroParentPos(self.modelComponentDataHandle, 0.71, -1.13, -1) UTL.UIRender.SetHeroParentRot(self.modelComponentDataHandle, 0, -6, 1.335) else UTL.UIRender.SetHeroParentPos(self.modelComponentDataHandle, 0.9, -1.13, 0) UTL.UIRender.SetHeroParentRot(self.modelComponentDataHandle, 0, -6, 0) end --播放光效 self:BeginHeroLightEffect(self, UIHeroLightEffectTool.PlayLightEffectFuncEnum.LuaView, heroLightEffects) end -- 加载神兵铸魂天命 local weaponSoul = CTL.DivineWeaponForgeSoul.GetWeaponSoulSkillByProtoMap(headInfo.HeroID, headInfo.weaponSoul) if weaponSoul then UTL.UIRender.LoadPlayerWeaponSoul(self.modelComponentDataHandle, weaponSoul) end -- 设置称号 local titleData = headInfo.TitleID>0 and DataSheetManager.Title:GetDataByID(headInfo.TitleID) or nil if titleData then UIUtils.SetActive(self.UITitleShow.gameObject, true) CTL.Title.SetTitleShow(self.UITitleShow, titleData) UIUtils.SetActiveByScale(self.UITitleShow.gameObject, true) UIUtils.SetRectPosition(self.UITitleShow.gameObject, 1, 1) else UIUtils.SetActive(self.UITitleShow.gameObject, false) end -- 设置军团标记 if string.isNilOrEmpty(headInfo.EmblemContent) then UIUtils.SetActive(self.img_Guild, false) else UIUtils.SetActive(self.img_Guild, true) self:SetGuildFameNum(self, headInfo.EmblemContent, headInfo.EmblemFrame) end -- 设置名字 if headInfo.OfficialId > 0 then UIUtils.SetLabel(self.txt_Name, string.format(PlayerName, CTL.OfficialPosition.GetModelNameShow(headInfo.OfficialId), headInfo.name)) else UIUtils.SetLabel(self.txt_Name, headInfo.name) end end ---------- End 排行榜中部UI展示 End ----------- -- 返回势力争霸 组别排名(如果没有组别排名 就显示空) function UIRankListPanel:GetGuildWarRank(myTagId, rankIndex) local rankStr = "" if rankIndex ~= nil and rankIndex > 0 then local groupData = DataSheetManager.GuildWarGroup:GetDataByID(myTagId) if groupData then rankStr = string.format(GroupStrCfg, groupData.Color, UIUtils.GetLocalizedTxt(Const_IDS[groupData.GroupName]), string.FormatByIdsId(Const_IDS.IDS_BossChallenge_Reward_RankRange_OneNum, rankIndex)) end end return rankStr end --region ***************************** 设置显示信息 ****************************** -- 设置排行榜标题 function UIRankListPanel:SetRankLabTxt(nameIds, title1Ids, title2Ids) UIUtils.SetLabelText(self.labLocal_Name, nameIds) UIUtils.SetLabelText(self.labLocal_SubTitle01, title1Ids) UIUtils.SetLabelText(self.labLocal_SubTitle02, title2Ids) end -- 设置名字、排行等基础信息 function UIRankListPanel:SetNameAndRank(obj, name, rank, isBottom) UIUtils.SetLabel(obj.group_2.txt_Name, name) -- 设置排名 if rank == nil or rank <= 0 then UIUtils.SetLabelText(obj.group_1.txt_Rank, Const_IDS.IDS_Rank_Unranked) obj.group_1.UIState:SetState(3) else UIUtils.SetLabel(obj.group_1.txt_Rank, rank) obj.group_1.UIState:SetState(rank <= 3 and rank - 1 or 3) end -- 重置军团标记(恢复军团标记设置) UIUtils.SetActive(obj.group_2.img_Guild, false) UIUtils.SetActive(obj.group_3.img_Guild, false) -- 设置非底部列表UI if isBottom then obj.obj_groupState:SetState(0) else obj.UIState2:SetState(rank % 2) end -- 重置点赞、势力声望等级信息 UIUtils.SetActive(obj.group_4.txt_Info, true) UIUtils.SetActive(obj.group_4.obj_ThumbsUp, false) UIUtils.SetActive(obj.group_4.group_Fame , false) end -- 通用设置势力名望 function UIRankListPanel:SetGuildReputation(obj, fameLevel, fameValue) UIUtils.SetActive(obj.group_4.group_Fame, true) local totalValue = 0 local lastGuildReputationData = nil for i = 1, fameLevel do lastGuildReputationData = DataSheetManager.GuildReputation:GetDataByID(i) totalValue = totalValue + lastGuildReputationData.Value end local fameStr = CTL.Guild.GetGuildReputationInfo(fameLevel) UIUtils.SetLabel(obj.group_4.txt_Fame, fameStr) if lastGuildReputationData and lastGuildReputationData.Num > 0 then UIUtils.SetActiveByScale(obj.group_4.img_Icon, true) UIUtils.SetLabel(obj.group_4.txt_Lv, lastGuildReputationData.Num) else UIUtils.SetActiveByScale(obj.group_4.img_Icon, false) end UIUtils.SetLabel(obj.group_4.txt_Info, tostring(totalValue + fameValue)) end -- 通用设置军团标记 function UIRankListPanel:SetGuildFameNum(obj, emblemContent, emblemFrame) if not string.isNilOrEmpty(emblemContent) then UIUtils.SetLabel(obj.txt_Guild, emblemContent) UIUtils.SetActive(obj.img_Guild, true) local guildEmblemCfg = DataSheetManager.GuildEmblem:GetDataByID(emblemFrame) if guildEmblemCfg then UTL.Item.SetAtlasSprite(obj.img_Guild, "UI_Guild", guildEmblemCfg.Image) end end end -- 设置点赞信息 function UIRankListPanel:SetThumbsUp(obj, giveLikeNum, rankType, acid, rank) local isCross = self.sortType == CTL.Rank.SortType.WarZone UIUtils.SetActive(obj.txt_Info, false) UIUtils.SetActive(obj.obj_ThumbsUp, true) local kudosNum = CTL.Rank.GetKudosNumByRankType(rankType) UIUtils.SetActiveByScale(obj.btn_ThumbsUp, rank > 0 and rank <= kudosNum) if rank <= 0 or rank > kudosNum then return end -- 这是点赞次数(如果超过1w,则显示%sw) t UIUtils.SetLabel(obj.txt_ThumbsUpNum, UTL.String.GetCountStr(giveLikeNum)) local rp = CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.Rank_ThumbsUp) if MDL.Rank.GetRemainingThumbsUpTimes() == 0 then obj.obj_giveLike:SetState(0) obj.img_Nor:SetGray(true, true) obj.obj_btnColor:SetState(0) else obj.obj_giveLike:SetState(MDL.Rank.IsAlreadyThumbsUp(rankType, acid, isCross) and 1 or 0) obj.img_Nor:SetGray(false, true) obj.obj_btnColor:SetState(1) end obj.img_Nor:SetRedPoint(rp) obj.img_Gold:SetRedPoint(rp) end function UIRankListPanel:SetRankLoop(dataList, rankType, emptyIds) if #dataList <= 0 then UIUtils.SetActive(self.obj_Rank.gameObject, true) UIUtils.SetLabelText(self.labLocal_Empty, emptyIds) return end UIUtils.SetActive(self.obj_Rank.gameObject, false) for i, v in ipairs(dataList) do self.LoopScroll_Properties:AddData({data = v, type = rankType}, 0) end if self.context and self.context.selectRankIndex and not MDL.Rank.IsThumbsUpRefresh() then if self.context.selectRankIndex >= #dataList then self.LoopScroll_Properties:SelectIndex(0) else self.LoopScroll_Properties:SelectIndex(self.context.selectRankIndex, true) end end end --endregion ************************** 设置显示信息 ****************************** --region ***************************** 榜单信息 ****************************** -- 战力榜 function UIRankListPanel:RefreshFightGsRankUI(data, isToggleRightOption, isNationRank) if self.LoopScroll_Properties.Count > 0 then self.LoopScroll_Properties:ClearCells() end -- 自己的信息 local myRankInfo = MDL.Rank.GetMyRankInfo() local myCountryRankInfo = MDL.Rank.GetMyCountryRankInfo() -- 自己的国家处理 local isIncludeCountryInfo = self.sortType == CTL.Rank.SortType.WarZone UIUtils.SetActive(self.group_Own.gameObject, true) UIUtils.SetActive(self.group_Own.group_Country.gameObject, isIncludeCountryInfo) if isIncludeCountryInfo then local myInfo = isToggleRightOption and myCountryRankInfo or myRankInfo self:SetNameAndRank(self.group_Own, BattleDataGetter.GetPlayerName(), myInfo.index, true) local countryID = MDL.Country.GetMyCountryId() CTL.Country.SetCountrySquareIconInRank(self.group_Own.group_Country, countryID) if isToggleRightOption and countryID == nil then UIUtils.SetActive(self.group_Own.gameObject, false) end else self:SetNameAndRank(self.group_Own, BattleDataGetter.GetPlayerName(), myRankInfo.index, true) end UIUtils.SetLabel(self.group_Own.group_4.txt_Info, isNationRank and myRankInfo.param1 or MDL.Player.GetLineUpGs()) UIUtils.SetActive(self.group_Own.group_4.img_Line, isNationRank) local guildInfo = MDL.Guild.GetMyGuildInfo() UIUtils.SetLabel(self.group_Own.group_3.txt_Info, guildInfo.guildName) self:SetGuildFameNum(self.group_Own.group_3, guildInfo.emblemContent, guildInfo.emblemFrame) local rankType = self.context.rankType if isToggleRightOption then self:SetRankLoop(data, rankType, Const_IDS.IDS_Country_NotJoinCountry) UIUtils.SetLabel(self.txt_Times, "") else self:SetRankLoop(data, rankType, Const_IDS.IDS_Ranking_NoPlayer) UIUtils.SetLabel(self.txt_Times, isNationRank and "" or string.FormatByIdsId(Const_IDS.IDS_Ranking_Good, MDL.Rank.GetRemainingThumbsUpTimes(), self.maxKudosNumDaily)) end self:SetMyServerName() end function UIRankListPanel:RefreshLevelRankUI(data) -- 等级榜 UIUtils.SetLabel(self.group_Own.group_4.txt_Info, UTL.Item.GetNobilityByTeamLevel(MDL.HeroSelect.GetTeamLevel())) -- 自己的信息 local myRankInfo = MDL.Rank.GetMyRankInfo() self:SetNameAndRank(self.group_Own, BattleDataGetter.GetPlayerName(), myRankInfo.index, true) local guildInfo = MDL.Guild.GetMyGuildInfo() UIUtils.SetLabel(self.group_Own.group_3.txt_Info, guildInfo.guildName) self:SetGuildFameNum(self.group_Own.group_3, guildInfo.emblemContent, guildInfo.emblemFrame) self:SetRankLoop(data, MDL.Rank.RankType.Level, Const_IDS.IDS_Ranking_NoPlayer) self:SetMyServerName() end -- 爬塔 function UIRankListPanel:RefreshClimbTowerRankUI(data, rankType) -- 显示爬塔进度 x-xx if MDL.ClimbTower.GetPassFarthestId() > 0 then UIUtils.SetLabel(self.group_Own.group_3.txt_Info, CTL.ClimbTower.GetClimbTowerProgressCountTextById(MDL.ClimbTower.GetPassFarthestId())) else UIUtils.SetLabelText(self.group_Own.group_3.txt_Info, Const_IDS.IDS_BarrierNotPassed) end UIUtils.SetLabel(self.group_Own.group_4.txt_Info, tostring(MDL.Player.GetLineUpGs())) -- 自己的信息 local myRankInfo = MDL.Rank.GetMyRankInfo() self:SetNameAndRank(self.group_Own, BattleDataGetter.GetPlayerName(), myRankInfo.index, true) self:SetRankLoop(data, rankType, Const_IDS.IDS_Ranking_NoPlayer) self:SetMyServerName() end -- 四国爬塔(魏蜀吴群) function UIRankListPanel:RefreshNationClimbTowerRankUI(data, rankType) local myRankInfo = MDL.Rank.GetMyRankInfo() local towerType = CTL.NationClimbTower.RankTypeIDIndexTower[rankType] if myRankInfo.param1 <= 0 then UIUtils.SetLabelText(self.group_Own.group_3.txt_Info, Const_IDS.IDS_BarrierNotPassed) else UIUtils.SetLabel(self.group_Own.group_3.txt_Info, CTL.NationClimbTower.GetProgressFinishProgressName(towerType, myRankInfo.param1)) end UIUtils.SetLabel(self.group_Own.group_4.txt_Info, tostring(myRankInfo.param2)) self:SetNameAndRank(self.group_Own, BattleDataGetter.GetPlayerName(), myRankInfo.index, true) self:SetRankLoop(data, rankType, Const_IDS.IDS_Ranking_NoPlayer) end -- 无双挑战 function UIRankListPanel:RefreshBossRankUI(data) -- 自己的信息 local myRankInfo = MDL.Rank.GetMyRankInfo() self:SetNameAndRank(self.group_Own, BattleDataGetter.GetPlayerName(), myRankInfo.index, true) if myRankInfo.param1 <= 0 then UIUtils.SetLabelText(self.group_Own.group_3.txt_Info, Const_IDS.IDS_BarrierNotPassed) else UIUtils.SetLabel(self.group_Own.group_3.txt_Info, tostring(myRankInfo.param1)) end UIUtils.SetLabel(self.group_Own.group_4.txt_Info, string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, MDL.Login.GetServerShowId())) self:SetRankLoop(data, MDL.Rank.RankType.BossChallenge, Const_IDS.IDS_Ranking_NoPlayer) -- 无双挑战 不显示区服 UIUtils.SetActive(self.group_Own.group_5.gameObject, false) end -- 三军争霸 function UIRankListPanel:RefreshPVPRankUI(data,rankType) -- 自己的信息 local myRankInfo = MDL.Rank.GetMyRankInfo() self:SetNameAndRank(self.group_Own, BattleDataGetter.GetPlayerName(), myRankInfo.index, true) local score = myRankInfo.param1 MDL.SyncTeamPVP.SetEloScore(score) MDL.SyncTeamPVP.SetPVPRank(myRankInfo.index) local levelData = DataSheetManager.ThreeBattleLevelData:GetDataByLevelID(CTL.SyncTeamPVP.GetLevelRank()) if rankType == MDL.Rank.RankType.Fair3V3 then UIUtils.SetLabelText(self.group_Own.group_3.txt_Info, Const_IDS[levelData.LevelName]) else UIUtils.SetLabel(self.group_Own.group_3.txt_Info,string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, MDL.Login.GetServerShowId())) end UIUtils.SetLabel(self.group_Own.group_4.txt_Info, tostring(score)) self:SetRankLoop(data, rankType, Const_IDS.IDS_Ranking_NoPlayer) self:SetMyServerName() end -- 谁与争锋 function UIRankListPanel:RefreshSyncSoloRankUI(data,rankType) -- 自己的信息 local myRankInfo = MDL.Rank.GetMyRankInfo() self:SetNameAndRank(self.group_Own, BattleDataGetter.GetPlayerName(), myRankInfo.index, true) MDL.SyncSolo.SetSyncSoloEloPoint(myRankInfo.param1) MDL.SyncSolo.SetSyncSoloRank(myRankInfo.index) local levelData = DataSheetManager.SyncSoloData:GetDataByLevelID(CTL.SyncSolo.GetSyncSoloLevelRank()) if rankType == MDL.Rank.RankType.SyncSolo then --个人榜显示段位 UIUtils.SetLabelText(self.group_Own.group_3.txt_Info, Const_IDS[levelData.LevelName]) else --全服榜显示所属服 UIUtils.SetLabel(self.group_Own.group_3.txt_Info,string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, MDL.Login.GetServerShowId())) if data and #data > 0 then local advanceCount = CTL.FairSoloTournament.GetGroupPlayerCount() local count = math.min(#data, advanceCount) UIUtils.SetLabel(self.txt_Times, string.FormatByIdsId(Const_IDS.IDS_FairTournament_512Point, count, data[count].param1)) end end UIUtils.SetLabel(self.group_Own.group_4.txt_Info, tostring(myRankInfo.param1)) self:SetRankLoop(data, rankType, Const_IDS.IDS_Ranking_NoPlayer) self:SetMyServerName() end -- 势力名望 function UIRankListPanel:RefreshGuildRankUI(data, isToggleRightOption) if self.LoopScroll_Properties.Count > 0 then self.LoopScroll_Properties:ClearCells() end if isToggleRightOption then -- 本服状态下上期排行 local preGuildRankInfo = MDL.Rank.GetLastBalanceGuildInfo() self.group_Own.obj_groupState:SetState(1) UIUtils.SetActive(self.group_Own.gameObject, false) self:SetRankLoop(preGuildRankInfo, MDL.Rank.RankType.Guild, Const_IDS.IDS_Escort_RankNoData) else -- 本期排行 UIUtils.SetActive(self.group_Own.gameObject, true) local guildInfo = MDL.Guild.GetMyGuildInfo() if string.isNilOrEmpty(guildInfo.guildId) then self.group_Own.obj_groupState:SetState(1) else -- 自己的信息 local myRankInfo = MDL.Rank.GetMyRankInfo() if IsServerDataNotNil(myRankInfo) then self.group_Own.obj_groupState:SetState(0) self:SetNameAndRank(self.group_Own, guildInfo.guildName, myRankInfo.index, true) UIUtils.SetLabel(self.group_Own.group_3.txt_Info, guildInfo.leaderName) self:SetGuildReputation(self.group_Own, myRankInfo.param1, myRankInfo.param2) self:SetGuildFameNum(self.group_Own.group_2, guildInfo.emblemContent, guildInfo.emblemFrame) else self.group_Own.obj_groupState:SetState(1) UIUtils.SetActive(self.group_Own.gameObject, false) end end self:SetRankLoop(data, MDL.Rank.RankType.Guild, Const_IDS.IDS_Escort_RankNoData) end self.txt_Times.text = nil self:SetMyServerName() end -- 魔将来袭 function UIRankListPanel:RefreshGuildBossRankUI(data) local guildInfo = MDL.Guild.GetMyGuildInfo() if string.isNilOrEmpty(guildInfo.guildId) then self.group_Own.obj_groupState:SetState(1) else -- 自己的信息 local myRankInfo = MDL.Rank.GetMyRankInfo() if IsServerDataNotNil(myRankInfo) then self.group_Own.obj_groupState:SetState(0) self:SetNameAndRank(self.group_Own, guildInfo.guildName, myRankInfo.index, true) UIUtils.SetLabel(self.group_Own.group_3.txt_Info, guildInfo.leaderName) UIUtils.SetLabel(self.group_Own.group_4.txt_Info, tostring(myRankInfo.param1)) self:SetGuildFameNum(self.group_Own.group_2, guildInfo.emblemContent, guildInfo.emblemFrame) else self.group_Own.obj_groupState:SetState(1) end end self:SetRankLoop(data, MDL.Rank.RankType.GuildBoss, Const_IDS.IDS_Ranking_NoGuild) self:SetMyServerName() end -- 势力争霸 function UIRankListPanel:RefreshGuildWarRankUI(data) local guildInfo = MDL.Guild.GetMyGuildInfo() if string.isNilOrEmpty(guildInfo.guildId) then self.group_Own.obj_groupState:SetState(1) else -- 自己的信息 local myRankInfo = MDL.Rank.GetMyRankInfo() if IsServerDataNotNil(myRankInfo) then self.group_Own.obj_groupState:SetState(0) self:SetNameAndRank(self.group_Own, guildInfo.guildName, myRankInfo.index, true) UIUtils.SetLabel(self.group_Own.group_3.txt_Info, guildInfo.leaderName) UIUtils.SetLabel(self.group_Own.group_4.txt_Info, self:GetGuildWarRank(myRankInfo.param1, myRankInfo.param2)) self:SetGuildFameNum(self.group_Own.group_2, guildInfo.emblemContent, guildInfo.emblemFrame) else self.group_Own.obj_groupState:SetState(1) end end self:SetRankLoop(data, MDL.Rank.RankType.GuildWar, Const_IDS.IDS_Ranking_NoGuild) self:SetMyServerName() end -- 势力押镖 function UIRankListPanel:RefreshGuildEscortRankUI(data) local guildInfo = MDL.Guild.GetMyGuildInfo() if string.isNilOrEmpty(guildInfo.guildId) then else -- 自己的信息 local myRankInfo = MDL.Rank.GetMyRankInfo() if IsServerDataNotNil(myRankInfo) then self.group_Own.obj_groupState:SetState(0) self:SetNameAndRank(self.group_Own, guildInfo.guildName, myRankInfo.index, true) UIUtils.SetLabel(self.group_Own.group_3.txt_Info, guildInfo.leaderName) UIUtils.SetLabel(self.group_Own.group_4.txt_Info, tostring(myRankInfo.param1)) self:SetGuildFameNum(self.group_Own.group_2, guildInfo.emblemContent, guildInfo.emblemFrame) else self.group_Own.obj_groupState:SetState(1) end end self:SetRankLoop(data, MDL.Rank.RankType.GuildEscort, Const_IDS.IDS_Ranking_NoGuild) self:SetMyServerName() end -- 势力押镖 function UIRankListPanel:RefreshGuildPowerRankUI(data) local guildInfo = MDL.Guild.GetMyGuildInfo() if string.isNilOrEmpty(guildInfo.guildId) then else -- 自己的信息 local myRankInfo = MDL.Rank.GetMyRankInfo() if IsServerDataNotNil(myRankInfo) then self.group_Own.obj_groupState:SetState(0) self:SetNameAndRank(self.group_Own, guildInfo.guildName, myRankInfo.index, true) UIUtils.SetLabel(self.group_Own.group_3.txt_Info, guildInfo.leaderName) UIUtils.SetLabel(self.group_Own.group_4.txt_Info, tostring(myRankInfo.param1)) self:SetGuildFameNum(self.group_Own.group_2, guildInfo.emblemContent, guildInfo.emblemFrame) else self.group_Own.obj_groupState:SetState(1) end end self:SetRankLoop(data, MDL.Rank.RankType.GuildEscort, Const_IDS.IDS_Ranking_NoGuild) self:SetMyServerName() end -- 魔神降世 function UIRankListPanel:RefreshDemonGodRankUI(data) -- 自己的信息 local myRankInfo = MDL.Rank.GetMyRankInfo() self:SetNameAndRank(self.group_Own, BattleDataGetter.GetPlayerName(), myRankInfo.index, true) UIUtils.SetLabel(self.group_Own.group_3.txt_Info, myRankInfo.param1) UIUtils.SetLabel(self.group_Own.group_4.txt_Info, string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, MDL.Login.GetServerShowId())) self:SetRankLoop(data, MDL.Rank.RankType.DemonGod, Const_IDS.IDS_Ranking_NoPlayer) UIUtils.SetActive(self.group_Own.group_5.gameObject, false) end -- 暴风 function UIRankListPanel:RefreshStormRankUI(data) local myRankInfo = MDL.Rank.GetMyRankInfo() self:SetNameAndRank(self.group_Own, BattleDataGetter.GetPlayerName(), myRankInfo.index, true) UIUtils.SetLabel(self.group_Own.group_3.txt_Info, myRankInfo.param1) UIUtils.SetLabel(self.group_Own.group_4.txt_Info, string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, MDL.Login.GetServerShowId())) self:SetRankLoop(data, MDL.Rank.RankType.DemonGod, Const_IDS.IDS_Ranking_NoPlayer) UIUtils.SetActive(self.group_Own.group_5.gameObject, false) end -- 群雄演武 function UIRankListPanel:RefreshThreeTeamFightRankUI(data) local myRankInfo = MDL.Rank.GetMyRankInfo() local rank = myRankInfo.index if CTL.ThreeTeamFight.GetLevelRank(rank) == 0 then rank = nil end self:SetNameAndRank(self.group_Own, BattleDataGetter.GetPlayerName(), rank, true) UIUtils.SetLabel(self.group_Own.group_3.txt_Info, CTL.ThreeTeamFight.GetRankDesc(rank or 0, false, true)) UIUtils.SetLabel(self.group_Own.group_4.txt_Info, myRankInfo.param1) UIUtils.SetLabel(self.group_Own.group_5.txt_ServerNum, string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, MDL.Login.GetServerShowId())) self:SetRankLoop(data, MDL.Rank.RankType.ThreeTeamFight, Const_IDS.IDS_Ranking_NoPlayer) UIUtils.SetActive(self.group_Own.group_5.gameObject, true) end function UIRankListPanel:RefreshCountryRankUI(data, myRankInfo) if self.LoopScroll_Properties.Count > 0 then self.LoopScroll_Properties:ClearCells() end self:SetRankLoop(data, MDL.Rank.RankType.Country, Const_IDS.IDS_Escort_RankNoData) UIUtils.SetActive(self.group_Own.group_5.gameObject, false) if myRankInfo and myRankInfo.CountryId > 0 then self:SetNameAndRank(self.group_Own, nil, myRankInfo.index, true) CTL.Country.SetCountryInRank(self.group_Own.group_2.img_Guild, self.group_Own.group_2.txt_Guild, myRankInfo.CountryId) UIUtils.SetActive(self.group_Own.group_2.img_Guild, true) self.group_Own.group_3.txt_Info.text = myRankInfo.GuildLeadName self:SetGuildFameNum(self.group_Own.group_3, myRankInfo.emblemContent, myRankInfo.emblemFrame) UIUtils.SetLabel(self.group_Own.group_4.txt_Info, myRankInfo.dominating) UIUtils.SetActive(self.group_Own.gameObject, true) else UIUtils.SetActive(self.group_Own.gameObject, false) end if MDL.Country.GetCurStage() == MDL.Country.Stage.CountryReset then UIUtils.SetActive(self.group_Toggle, false) UIUtils.SetLabelText(self.txt_Times, Const_IDS.IDS_Country_CountryRankCeremonyIntro) else local weekIds = DataSheetManager.ConstData:GetDataByID("CountryDominatingRankingTime").IntListValue self.txt_Times.text = string.FormatByIdsId(Const_IDS.IDS_Country_CountryRankIntro, UTL.Time.GetDateDescAndTime(weekIds)) end end function UIRankListPanel:RefreshLeftTabs(sortType) if sortType then self.sortType = sortType end self:ShowSortState() if not CTL.WarZone.IsWarZoneOpen() and self.sortType == CTL.Rank.SortType.WarZone then self.sortType = CTL.Rank.SortType.MyServer end local sortTypeParam = CTL.Rank.GetRankSort(self.context.rankType) if not self:CheckSortType(sortTypeParam,self.sortType) then if self.sortType ~= CTL.Rank.SortType.AllServer then self.context.rankType = MDL.Rank.RankType.FightGs else self.context.rankType = MDL.Rank.RankType.SyncSoloAllServer end end if self.context.rankType == MDL.Rank.RankType.BossChallenge then self.lastSelectRankType = self.selectBossSeasonId else self.lastSelectRankType = self.context.rankType end self:InitLeftLoop(self.sortType) end function UIRankListPanel:SetMyServerName() UIUtils.SetActive(self.group_Own.group_5.gameObject, false) if self.sortType == CTL.Rank.SortType.WarZone then UIUtils.SetActive(self.group_Own.group_5.gameObject, true) UIUtils.SetLabel(self.group_Own.group_5.txt_ServerNum, string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, MDL.Login.GetServerShowId())) end end --endregion ************************** 榜单信息 ****************************** function UIRankListPanel:OnValueChanged(comp, index) if comp == self.toggle_Group then local isDifferentToggle = self.context.toggleSwitchType ~= index self.lastSelectedIndex = 0 -- 用于更更新节点的选中态 local rankType = self.context.rankType self.context.toggleSwitchType = index local curIndex = self.clickRankIndex self.clickRankIndex = -1 if index == 0 or not self.toggle_Group.gameObject.activeInHierarchy then self:RefreshWarZoneToggleShow(rankType) elseif index == 1 then self:RefreshCountryToggleShow(rankType) end -- 每次切换或者保持在当前界面内进行刷新,先更新选中记录的INDEX,再Select if self.LoopScroll_Properties.Count > 0 then -- 重置选中的index,防止切换toggle 选中时点开名片 if isDifferentToggle then self.LoopScroll_Properties:SelectIndex(0, true) else self.LoopScroll_Properties:SelectIndex(curIndex) end end end end -- toggle为0时的处理 function UIRankListPanel:RefreshWarZoneToggleShow(rankType) local rankInfo = MDL.Rank.GetRankInfoDataByType(rankType, nil) local isNationFightGsRank = CTL.Rank.IsNationFightGsRank(rankType) if rankType == MDL.Rank.RankType.FightGs or isNationFightGsRank then self:RefreshFightGsRankUI(rankInfo, false, isNationFightGsRank) elseif rankType == MDL.Rank.RankType.Country then local myRankInfo = MDL.Rank.GetMyRankInfo() self:RefreshCountryRankUI(rankInfo, myRankInfo) elseif rankType == MDL.Rank.RankType.Guild then self:RefreshGuildRankUI(rankInfo, false) end end -- toggle为1时的处理 function UIRankListPanel:RefreshCountryToggleShow(rankType) local countryRankInfo = MDL.Rank.GetWarZoneCountryRankInfoByType(rankType, nil) local isNationFightGsRank = CTL.Rank.IsNationFightGsRank(rankType) if rankType == MDL.Rank.RankType.FightGs or isNationFightGsRank then self:RefreshFightGsRankUI(countryRankInfo, true, isNationFightGsRank) elseif rankType == MDL.Rank.RankType.Country then local rankInfo, myRankInfo = MDL.Rank.GetPreCountryInfo() self:RefreshCountryRankUI(rankInfo, nil) elseif rankType == MDL.Rank.RankType.Guild then -- 此处直接调用 进入方法后重新获取榜单和自己的上期数据 self:RefreshGuildRankUI(countryRankInfo, true) end end function UIRankListPanel:StopHeroLightEffect(isDispose) UIHeroLightEffectTool.StopHeroLightEffect(self.heroLightEffectDatas) if isDispose then self.heroLightEffectDatas = nil end end function UIRankListPanel:BeginHeroLightEffect(renderComp,playLightEffectFuncEnum,heroLightEffects) for _, lightEffectID in ipairs(heroLightEffects) do UIHeroLightEffectTool.PlayHeroLightEffect(self.heroLightEffectDatas,renderComp, 0, playLightEffectFuncEnum,lightEffectID, nil) end end function UIRankListPanel:PlayDriverModelEffect(effectPath) return UTL.UIRender.PlayDriverPsEffect(self.modelComponentDataHandle, effectPath) end function UIRankListPanel:AuxUtilPlayPsEffect(effectPath) return UTL.UIRender.PlayPsEffect(self.modelComponentDataHandle, effectPath) end function UIRankListPanel:PlayCharacterModelEffect(effectPath) return UTL.UIRender.PlayPsEffect(self.modelComponentDataHandle, effectPath) end function UIRankListPanel:UpdateGuildAttach() local info = MDL.Guild.GetMyFamousInfo() if info and info.hasFirstBalance == false then UIUtils.SetActive(self.Group_PeakPower, true) self:UpdatePeakGuildTimer() UIUtils.SetActive(self.txt_Times, false) else UIUtils.SetActive(self.Group_PeakPower, false) UIUtils.SetActive(self.txt_Times, true) end end function UIRankListPanel:UpdatePeakGuildTimer() self:StopRepeatFunc(self.UpdatePeakGuildTimer) local customStr, customType, refreshInterval = CTL.Guild.GetPeakParam(Const_IDS.IDS_GuildLeaderInspire_TimeTips1) self.txt_CountDown:SetCustomString(customStr, 1, customType) local _, leftTime = MDL.Guild.GetGuildBalanceTime() self.txt_CountDown:ResetAndBeginTimer(false, leftTime) if refreshInterval > 0 then self:StartRepeatFunc(self.UpdatePeakGuildTimer, refreshInterval + 1, 1) end end return UIRankListPanel