【公会】成员信息界面报错修复

dev_chengFeng
gaoxin 2021-05-24 16:58:26 +08:00
parent e308fd0149
commit 24498b21a9
1 changed files with 99 additions and 15 deletions

View File

@ -64,11 +64,13 @@ function GuildMemberInfoPopup:InitComponent()
this.addFriendBtnText = Util.GetGameObject(this.addFriendBtn, "text"):GetComponent("Text")
this.starBox = Util.GetGameObject(self.transform, "tipImage/panel/info/starBox")
this.star = Util.GetGameObject(self.transform, "tipImage/panel/info/starBox/star")
this.titlePar = Util.GetGameObject(self.transform, "tipImage/panel/info/titlePar")
this.memPower = Util.GetGameObject(self.transform, "tipImage/panel/defendbox/power"):GetComponent("Text")
this.formationTip = Util.GetGameObject(self.transform, "tipImage/panel/defendbox/tip"):GetComponent("Text")
this.attackCount = Util.GetGameObject(self.transform, "tipImage/attackCount"):GetComponent("Text")
this.demonsHeroList=Util.GetGameObject(self.gameObject, "tipImage/panel/defendbox/demons")
this.diffDemonsHeroList=Util.GetGameObject(self.gameObject, "tipImage/panel/defendbox/diffdemons")
-- this.DiffDemons = {}
-- for i = 1, 3 do
-- table.insert(this.DiffDemons, Util.GetGameObject(self.gameObject, "tipImage/panel/defendbox/diffdemons/icon_"..i))
@ -77,22 +79,29 @@ function GuildMemberInfoPopup:InitComponent()
for i = 1, 6 do
table.insert(this.Demons, Util.GetGameObject(self.gameObject, "tipImage/panel/defendbox/Demons/heroPro (" .. i .. ")"))
end
this.Pokemons={}
for i = 1, 6 do
table.insert(this.Demons, Util.GetGameObject(self.gameObject, "tipImage/panel/Pokemons/Demons/heroPro (" .. i .. ")"))
end
Util.GetGameObject(self.transform, "tipImage/panel/pokemonInfo/tip"):GetComponent("Text").text=Language[11501]
this.Pokemons = {}
for i = 1, 6 do
table.insert(this.Pokemons, Util.GetGameObject(self.gameObject, "tipImage/panel/pokemonInfo/Demons/heroPro (" .. i .. ")"))
end
this.pokemonObj=Util.GetGameObject(self.transform, "tipImage/panel/pokemonInfo").gameObject
this.bgImg= Util.GetGameObject(self.transform, "tipImage/tipImage"):GetComponent("RectTransform")
this.boxLine = Util.GetGameObject(self.transform, "tipImage/panel/defendbox/line")
this.btnBox = Util.GetGameObject(self.transform, "panel/box")
this.btnBox = Util.GetGameObject(self.transform, "tipImage/panel/box")
-- this.bgImg= Util.GetGameObject(self.transform, "tipImage/tipImage"):GetComponent("RectTransform")
this.btnList = {}
this.btnList[1] = Util.GetGameObject(this.btnBox, "btn1")
this.btnList[2] = Util.GetGameObject(this.btnBox, "btn2")
this.btnList[3] = Util.GetGameObject(this.btnBox, "btn3")
--神印信息
this.imprintObj = Util.GetGameObject(self.transform, "tipImage/panel/imprintInfo")
this.imprintGrid = Util.GetGameObject(this.imprintObj, "Imprints")
this.imprintPre = Util.GetGameObject(self.transform, "imprintPre")
this.imprintItemList = {}
end
--绑定事件(用于子类重写)
@ -190,6 +199,8 @@ function GuildMemberInfoPopup:OnShow()
end
-- 刷新基础信息显示
local titleLiveStr
local titleLive
function this.RefreshPlayerInfo()
this.memName.text = this._MemData.userName
this.memProfess.text = Language[10935]..GUILD_GRANT_STR[this._MemData.position]
@ -197,6 +208,11 @@ function this.RefreshPlayerInfo()
if not _PlayerHead then
_PlayerHead = SubUIManager.Open(SubUIConfig.PlayerHeadView, this.memHead.transform)
end
if titleLive then
poolManager:UnLoadAsset(titleLiveStr, titleLive, PoolManager.AssetType.GameObject)
titleLive = nil
titleLiveStr = nil
end
_PlayerHead:Reset()
_PlayerHead:SetScale(Vector3.one * 0.85)
_PlayerHead:SetHead(this._MemData.head)
@ -204,6 +220,24 @@ function this.RefreshPlayerInfo()
_PlayerHead:SetLevel(this._MemData.userLevel)
_PlayerHead:SetLayer(this.sortingOrder)
_PlayerHead:SetEffectScale(0.9)
local title=this._MemData.userTitle
if title and title>0 then
this.titlePar:SetActive(true)
local curPlayerRole = ConfigManager.GetConfigData(ConfigName.PlayerRole,title)
local curArtResourcesConfig = ConfigManager.GetConfigData(ConfigName.ArtResourcesConfig,curPlayerRole.LiveAnimName)
titleLiveStr = curArtResourcesConfig.Name
titleLive = poolManager:LoadAsset(titleLiveStr, PoolManager.AssetType.GameObject)
titleLive.transform:SetParent(this.titlePar.transform)
titleLive.transform.localPosition = Vector3.New(0,0,0)
titleLive.transform.localScale = Vector3.New(0.5,0.5,0.5)
local sortingorder=0
if this.sortingOrder then
Util.AddParticleSortLayer(titleLive,this.sortingOrder - sortingorder)
sortingorder = this.sortingOrder
end
else
this.titlePar:SetActive(false)
end
end
function this:OnSortingOrderChange()
@ -287,11 +321,12 @@ end
function this.FormationAdapter(teamInfo)
-- 战斗力
this.memPower.text = teamInfo.totalForce
-- 妖灵师
for i, demon in ipairs(this.Demons) do
Util.GetGameObject(demon, "frame"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetQuantityImageByquality(1))
Util.GetGameObject(demon, "hero"):SetActive(false)
end
end
--队伍阵容
for i, hero in ipairs(teamInfo.team) do
local demonId = teamInfo.team[i].heroTid
if demonId then
@ -301,12 +336,21 @@ function this.FormationAdapter(teamInfo)
local heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig, demonId)
Util.GetGameObject(heroGo, "proIcon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetProStrImageByProNum(heroConfig.PropertyName))
Util.GetGameObject(heroGo, "lvbg/levelText"):GetComponent("Text").text = hero.level
Util.GetGameObject(this.Demons[hero.position], "frame"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetQuantityImageByquality(heroConfig.Quality,hero.star))
Util.GetGameObject(heroGo, "icon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetResourcePath(heroConfig.Icon))
Util.GetGameObject(this.Demons[hero.position], "frame"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetQuantityImageByquality(heroConfig.Quality, hero.star))
-- if hero.skinId == 0 then
-- Util.GetGameObject(heroGo, "icon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetResourcePath(heroConfig.Icon))
-- else
-- local config = ConfigManager.GetConfigDataByKey(ConfigName.HeroSkin,"Type",hero.skinId)
-- Util.GetGameObject(heroGo, "icon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetResourcePath(config.Icon))
-- end
SetHeroIcon(this.spLoader, hero,Util.GetGameObject(heroGo, "icon"):GetComponent("Image"),heroConfig)
local frameBtn = Util.GetGameObject(this.Demons[hero.position], "frame")
local heroData = {}
Util.AddOnceClick(frameBtn, function()
NetManager.ViewHeroInfoRequest(this._MemId,hero.heroid,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)--HeroManager.GetSingleHeroData(heroData.dynamicId)
UIManager.OpenPanel(UIName.RoleInfoPopup, heroData,true)
@ -318,17 +362,15 @@ function this.FormationAdapter(teamInfo)
local len=#teamInfo.PokemonInfos
LogError("长度:"..len)
if len>0 then
this.bgImg.sizeDelta=Vector2.New(900,1024)
-- this.bgImg.sizeDelta=Vector2.New(900,1024)
this.pokemonObj:SetActive(true)
for i, demon in ipairs(this.Pokemons) do
demon.gameObject:SetActive(false)
Util.GetGameObject(demon, "frame"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetQuantityImageByquality(1))
Util.GetGameObject(demon, "hero"):SetActive(false)
Util.AddOnceClick(frameBtn, function()
end)
Util.GetGameObject(demon, "hero"):SetActive(false)
end
else
this.bgImg.sizeDelta=Vector2.New(900,850)
-- this.bgImg.sizeDelta=Vector2.New(900,850)
this.pokemonObj:SetActive(false)
end
@ -352,6 +394,45 @@ function this.FormationAdapter(teamInfo)
end)
end
end
--神印信息
if teamInfo.sealShow and #teamInfo.sealShow > 0 then
this.imprintObj:SetActive(true)
if not this.imprintItemList then
this.imprintItemList = {}
end
for i = 1, #this.imprintItemList do
this.imprintItemList[i].gameObject:SetActive(false)
end
for i = 1, #teamInfo.sealShow do
local item = this.imprintItemList[i]
local value = teamInfo.sealShow[i]
if not item then
item = newObject(this.imprintPre)
item.name = "imprintPre_"..i
item.transform:SetParent(this.imprintGrid.transform)
item.transform.localScale = Vector3.one
item.transform.localPosition = Vector3.zero
this.imprintItemList[i] = item
end
item.gameObject:SetActive(true)
local icon = Util.GetGameObject(item,"icon"):GetComponent("Image")
local hero = Util.GetGameObject(item,"hero"):GetComponent("Image")
icon.sprite = this.spLoader:LoadSprite(GetResourcePath(XiuXianSkillConfig[value.id].Icon))
if value.type == 1 then
hero.gameObject:SetActive(true)
hero.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(value.heroTId))
else
hero.gameObject:SetActive(false)
end
Util.AddOnceClick(item.gameObject,function ()
UIManager.OpenPanel(UIName.GeneralInfoPopup,GENERALINFO_TYPE.Imprint,value.id,value.heroTId)
end)
end
else
this.imprintObj:SetActive(false)
end
end
-- 刷新按钮显示
@ -585,6 +666,9 @@ function GuildMemberInfoPopup:OnDestroy()
end
-- 星星
_StarList = {}
titleLive = nil
titleLiveStr = nil
this.imprintItemList = {}
end