2021-08-26 17:14:13 +08:00
|
|
|
require("Base/BasePanel")
|
|
|
|
local WorldArenaOtherTeamPanel = Inherit(BasePanel)
|
|
|
|
local XiuXianSkillConfig = ConfigManager.GetConfig(ConfigName.XiuXianSkillConfig)
|
|
|
|
|
|
|
|
function WorldArenaOtherTeamPanel:InitComponent()
|
|
|
|
self.spLoader = SpriteLoader.New()
|
|
|
|
self.btnBack = Util.GetGameObject(self.gameObject, "Frame/BackBtn")
|
|
|
|
self.mask = Util.GetGameObject(self.gameObject, "mask")
|
|
|
|
self.content = Util.GetGameObject(self.gameObject, "Content")
|
|
|
|
--玩家信息
|
|
|
|
self.playerInfo = Util.GetGameObject(self.content, "playerInfo")
|
|
|
|
self.playerHead = Util.GetGameObject(self.playerInfo, "head")
|
|
|
|
self.playerName = Util.GetGameObject(self.playerInfo, "name")
|
|
|
|
self.playerScore = Util.GetGameObject(self.playerInfo, "score"):GetComponent("Text")
|
|
|
|
self.playerLevelImg = Util.GetGameObject(self.playerInfo, "levelImg"):GetComponent("Image")
|
|
|
|
--队伍信息
|
|
|
|
self.teamInfo = Util.GetGameObject(self.content, "teamInfo")
|
|
|
|
self.teamList = {}
|
|
|
|
for i = 1, 3 do
|
|
|
|
self.teamList[i] = {}
|
|
|
|
self.teamList[i].title = Util.GetGameObject(self.teamInfo, "Team ("..i..")/Title")
|
|
|
|
self.teamList[i].warPower = Util.GetGameObject(self.teamInfo, "Team ("..i..")/WarPower/Text"):GetComponent("Text")
|
|
|
|
self.teamList[i].heroList = {}
|
|
|
|
for j = 1, 6 do
|
|
|
|
self.teamList[i].heroList[j] = Util.GetGameObject(self.teamInfo, "Team ("..i..")/TeamList/heroPro ("..j..")")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
--灵兽信息
|
|
|
|
self.pokemonInfo = Util.GetGameObject(self.content, "pokemonInfo")
|
|
|
|
self.pokemonList = {}
|
|
|
|
for i = 1, 6 do
|
|
|
|
self.pokemonList[i] = Util.GetGameObject(self.pokemonInfo, "Demons/heroPro ("..i..")")
|
|
|
|
end
|
|
|
|
--神印信息
|
|
|
|
self.imprintInfo = Util.GetGameObject(self.content, "imprintInfo")
|
|
|
|
self.imprintGrid = Util.GetGameObject(self.imprintInfo, "Imprints")
|
|
|
|
self.imprintPre = Util.GetGameObject(self.gameObject, "imprintPre")
|
|
|
|
self.imprintItemList = {}
|
2021-08-26 17:36:03 +08:00
|
|
|
--挑战
|
|
|
|
self.btnChallenge = Util.GetGameObject(self.content, "Button")
|
2021-08-26 17:14:13 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
function WorldArenaOtherTeamPanel:BindEvent()
|
|
|
|
Util.AddClick(self.mask, function()
|
|
|
|
self:ClosePanel()
|
|
|
|
end)
|
|
|
|
Util.AddClick(self.btnBack, function()
|
|
|
|
self:ClosePanel()
|
|
|
|
end)
|
2021-08-26 17:36:03 +08:00
|
|
|
Util.AddClick(self.btnChallenge, function()
|
|
|
|
PopupTipPanel.ShowTip("去挑战了")
|
|
|
|
self:ClosePanel()
|
|
|
|
end)
|
2021-08-26 17:14:13 +08:00
|
|
|
end
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
function WorldArenaOtherTeamPanel:AddListener()
|
|
|
|
end
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
function WorldArenaOtherTeamPanel:RemoveListener()
|
|
|
|
end
|
|
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
|
|
function WorldArenaOtherTeamPanel:OnOpen(_playerId)
|
|
|
|
self.playerId = _playerId
|
|
|
|
end
|
|
|
|
|
|
|
|
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
|
|
|
function WorldArenaOtherTeamPanel:OnShow()
|
|
|
|
WorldArenaOtherTeamPanel:Refresh()
|
|
|
|
end
|
|
|
|
|
|
|
|
function WorldArenaOtherTeamPanel:OnSortingOrderChange()
|
|
|
|
if self.PlayerHead then
|
|
|
|
self.PlayerHead:SetLayer(self.sortingOrder)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function WorldArenaOtherTeamPanel:Refresh()
|
|
|
|
NetManager.RequestPlayerInfo(self.playerId, PLAYER_INFO_VIEW_TYPE.NORMAL,1, function(msg)
|
|
|
|
WorldArenaOtherTeamPanel:SetPlayerInfo(self.playerInfo,msg.teamInfo)
|
|
|
|
WorldArenaOtherTeamPanel:SetTeamInfo(self.teamInfo,{msg.teamInfo.team,msg.teamInfo.team,msg.teamInfo.team})
|
|
|
|
WorldArenaOtherTeamPanel:SetPokemonInfo(self.pokemonInfo,msg.teamInfo.team.PokemonInfos)
|
|
|
|
WorldArenaOtherTeamPanel:SetImprintInfo(self.imprintInfo,msg.teamInfo.team.sealShow)
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
|
|
--玩家信息
|
|
|
|
function WorldArenaOtherTeamPanel:SetPlayerInfo(go,playerData)
|
|
|
|
local head = Util.GetGameObject(go, "head")
|
|
|
|
local name = Util.GetGameObject(go, "name"):GetComponent("Text")
|
|
|
|
local score = Util.GetGameObject(go, "score"):GetComponent("Text")
|
|
|
|
local levelImg = Util.GetGameObject(go, "levelImg"):GetComponent("Image")
|
|
|
|
|
|
|
|
if not self.PlayerHead then
|
|
|
|
self.PlayerHead = SubUIManager.Open(SubUIConfig.PlayerHeadView, head.transform)
|
|
|
|
end
|
|
|
|
self.PlayerHead:Reset()
|
|
|
|
self.PlayerHead:SetScale(Vector3.one * 0.85)
|
|
|
|
self.PlayerHead:SetHead(playerData.head)
|
|
|
|
self.PlayerHead:SetFrame(playerData.headFrame)
|
|
|
|
self.PlayerHead:SetLevel(playerData.level)
|
|
|
|
self.PlayerHead:SetLayer(self.sortingOrder)
|
|
|
|
self.PlayerHead:SetEffectScale(0.9)
|
|
|
|
|
|
|
|
name.text = PracticeManager.SetNameColor(playerData.name,playerData.practiceLevel)
|
|
|
|
score.text = string.format( "积分:%s",playerData.name )
|
|
|
|
levelImg.sprite = self.spLoader:LoadSprite("y_yuxulundao_xingxing")
|
|
|
|
end
|
|
|
|
|
|
|
|
--编队信息
|
2021-08-26 17:36:03 +08:00
|
|
|
function WorldArenaOtherTeamPanel:SetTeamInfo(_go,teamData)
|
2021-08-26 17:14:13 +08:00
|
|
|
for index = 1, 3 do
|
2021-08-26 17:36:03 +08:00
|
|
|
local go = Util.GetGameObject(_go,"Team ("..index..")")
|
2021-08-26 17:14:13 +08:00
|
|
|
local data = teamData[index]
|
|
|
|
local title = Util.GetGameObject(go,"Title"):GetComponent("Text")
|
|
|
|
local warPower = Util.GetGameObject(go,"WarPower/Text"):GetComponent("Text")
|
|
|
|
local teamList = Util.GetGameObject(go,"TeamList")
|
|
|
|
title.text = string.format( "第%s队",NumToChinese[index])
|
|
|
|
warPower.text = data.totalForce
|
|
|
|
|
|
|
|
for i, demon in ipairs(self.teamList[index].heroList) do
|
|
|
|
Util.GetGameObject(demon, "frame"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetQuantityImageByquality(1))
|
|
|
|
Util.GetGameObject(demon, "hero"):SetActive(false)
|
|
|
|
end
|
|
|
|
--队伍阵容
|
|
|
|
for i, hero in ipairs(data.team) do
|
|
|
|
local heroTid = data.team[i].heroTid
|
|
|
|
if heroTid then
|
|
|
|
local heroGo = Util.GetGameObject(self.teamList[index].heroList[hero.position], "hero")
|
|
|
|
heroGo:SetActive(true)
|
|
|
|
SetHeroStars(self.spLoader, Util.GetGameObject(heroGo, "starGrid"), hero.star)
|
|
|
|
local heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig, heroTid)
|
|
|
|
Util.GetGameObject(heroGo, "proIcon"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetProStrImageByProNum(heroConfig.PropertyName))
|
|
|
|
Util.GetGameObject(heroGo, "lvbg/levelText"):GetComponent("Text").text = hero.level
|
|
|
|
Util.GetGameObject(self.teamList[index].heroList[hero.position], "frame"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetQuantityImageByquality(heroConfig.Quality, hero.star))
|
|
|
|
SetHeroIcon(self.spLoader, hero,Util.GetGameObject(heroGo, "icon"):GetComponent("Image"),heroConfig)
|
|
|
|
local frameBtn = Util.GetGameObject(self.teamList[index].heroList[hero.position], "frame")
|
|
|
|
local heroData = {}
|
|
|
|
Util.AddOnceClick(frameBtn, function()
|
|
|
|
NetManager.ViewHeroInfoRequest(self.playerId,hero.heroid,1,PLAYER_INFO_VIEW_TYPE.NORMAL,function(msg)
|
|
|
|
if not hero.heroid then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
heroData= GoodFriendManager.GetHeroDatas(msg.hero,msg.force,msg.SpecialEffects,msg.guildSkill)
|
|
|
|
GoodFriendManager.InitEquipData(msg.equip,heroData)
|
|
|
|
UIManager.OpenPanel(UIName.RoleInfoPopup, heroData,true)
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
--灵兽信息
|
|
|
|
function WorldArenaOtherTeamPanel:SetPokemonInfo(go,pokemonData)
|
|
|
|
local len = #pokemonData
|
|
|
|
if len>0 then
|
|
|
|
self.pokemonInfo:SetActive(true)
|
|
|
|
for i, demon in ipairs(self.pokemonList) do
|
|
|
|
demon.gameObject:SetActive(false)
|
|
|
|
Util.GetGameObject(demon, "frame"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetQuantityImageByquality(1))
|
|
|
|
Util.GetGameObject(demon, "hero"):SetActive(false)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
self.pokemonInfo:SetActive(false)
|
|
|
|
end
|
|
|
|
for i, hero in ipairs(pokemonData) do
|
|
|
|
local demonId = pokemonData[i].heroTid
|
|
|
|
self.pokemonList[i].gameObject:SetActive(true)
|
|
|
|
if demonId then
|
|
|
|
local heroGo = Util.GetGameObject(self.pokemonList[i], "hero")
|
|
|
|
heroGo:SetActive(true)
|
|
|
|
SetHeroStars(self.spLoader, Util.GetGameObject(heroGo, "starGrid"), hero.star)
|
|
|
|
local heroConfig = ConfigManager.GetConfigData(ConfigName.SpiritAnimal, demonId)
|
|
|
|
Util.GetGameObject(heroGo, "lvbg/levelText"):GetComponent("Text").text = hero.level
|
|
|
|
Util.GetGameObject(self.pokemonList[i], "frame"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetQuantityImageByquality(heroConfig.Quality))
|
|
|
|
Util.GetGameObject(heroGo, "icon"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetResourcePath(heroConfig.Icon))
|
|
|
|
local frameBtn = Util.GetGameObject(self.pokemonList[i], "frame")
|
|
|
|
local heroData = {}
|
|
|
|
Util.AddOnceClick(frameBtn, function()
|
|
|
|
local pokemonData={tempId=demonId,id=demonId,star=hero.star,level=hero.level}
|
|
|
|
UIManager.OpenPanel(UIName.PokemonGetInfoPopup,true,pokemonData)
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
--紫府神印信息
|
|
|
|
function WorldArenaOtherTeamPanel:SetImprintInfo(go,imprintData)
|
|
|
|
if imprintData and #imprintData > 0 then
|
|
|
|
self.imprintInfo:SetActive(true)
|
|
|
|
if not self.imprintItemList then
|
|
|
|
self.imprintItemList = {}
|
|
|
|
end
|
|
|
|
for i = 1, #self.imprintItemList do
|
|
|
|
self.imprintItemList[i].gameObject:SetActive(false)
|
|
|
|
end
|
|
|
|
for i = 1, #imprintData do
|
|
|
|
local item = self.imprintItemList[i]
|
|
|
|
local value = imprintData[i]
|
|
|
|
if not item then
|
|
|
|
item = newObject(self.imprintPre)
|
|
|
|
item.name = "imprintPre_"..i
|
|
|
|
item.transform:SetParent(self.imprintGrid.transform)
|
|
|
|
item.transform.localScale = Vector3.one
|
|
|
|
item.transform.localPosition = Vector3.zero
|
|
|
|
self.imprintItemList[i] = item
|
|
|
|
end
|
|
|
|
item.gameObject:SetActive(true)
|
|
|
|
local icon = Util.GetGameObject(item,"icon"):GetComponent("Image")
|
|
|
|
icon.sprite = self.spLoader:LoadSprite(GetResourcePath(XiuXianSkillConfig[value.id].Icon))
|
|
|
|
Util.AddOnceClick(item.gameObject,function ()
|
|
|
|
UIManager.OpenPanel(UIName.GeneralInfoPopup,GENERALINFO_TYPE.Imprint,value.id,value.heroTId)
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
self.imprintInfo:SetActive(false)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function WorldArenaOtherTeamPanel:OnClose()
|
|
|
|
end
|
|
|
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
|
|
function WorldArenaOtherTeamPanel:OnDestroy()
|
|
|
|
self.spLoader:Destroy()
|
|
|
|
if self.PlayerHead then
|
|
|
|
self.PlayerHead:Recycle()
|
|
|
|
self.PlayerHead = nil
|
|
|
|
end
|
|
|
|
self.InfoList = {}
|
|
|
|
self.dragViewList = {}
|
|
|
|
self.triggerList = {}
|
|
|
|
self.gridList = {}
|
|
|
|
self.teamList = {}
|
|
|
|
self.pokemonList = {}
|
|
|
|
self.imprintItemList = {}
|
|
|
|
end
|
|
|
|
|
|
|
|
return WorldArenaOtherTeamPanel
|