【玩家信息】增加额外属性

dev_chengFeng
ZhangBiao 2022-01-13 15:23:59 +08:00
parent 455cdcd19c
commit 36b475ee15
2 changed files with 1465 additions and 391 deletions

File diff suppressed because it is too large Load Diff

View File

@ -90,6 +90,21 @@ local _ViewConfig = {
},
}
local InfoBtns = {
[1] = {
name = "紫府神印",
gridName = "imprintInfo",
},
[2] = {
name = "身外化身",
gridName = "huashenInfo",
},
[3] = {
name = "四象心法",
gridName = "fourElementInfo",
},
}
local curPlayerName = ""
local _PlayerHead = nil
--初始化组件(用于子类重写)
@ -110,7 +125,6 @@ function PlayerInfoPopup:InitComponent()
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.Demons = {}
@ -141,10 +155,17 @@ function PlayerInfoPopup:InitComponent()
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 = {}
-- this.imprintObj = Util.GetGameObject(self.transform, "tipImage/panel/imprintInfo")
-- this.imprintGrid = Util.GetGameObject(this.imprintObj, "Imprints")
-- this.imprintPre = Util.GetGameObject(self.transform, "imprintPre")
--所有信息Obj的PreList
this.InfoBtns = Util.GetGameObject(self.transform, "tipImage/panel/InfoBtns")
this.InfoBtnsGrid = Util.GetGameObject(this.InfoBtns, "Grid")
this.InfoContent = Util.GetGameObject(self.transform, "tipImage/panel/InfoGrids")
this.infoBtnPre = Util.GetGameObject(self.transform, "btnPre")--按钮的Pre
this.imprintPre = Util.GetGameObject(self.transform, "imprintPre")--神印的Pre
this.InfoBtnsList = {}
this.ItemPreList = {}
end
@ -328,6 +349,7 @@ end
-- 编队数据匹配
function this.FormationAdapter(teamInfo)
--====================编队信息======================
this.formationTip.text = _ViewConfig[this._ViewType].tip
-- 战斗力
this.memPower.text = teamInfo.totalForce
@ -387,8 +409,8 @@ function this.FormationAdapter(teamInfo)
else
this.pokemonObj:SetActive(false)
end
--队伍灵兽
--====================队伍灵兽信息======================
for i, hero in ipairs(teamInfo.PokemonInfos) do
local demonId = teamInfo.PokemonInfos[i].heroTid
this.Pokemons[i].gameObject:SetActive(true)
@ -410,39 +432,48 @@ function this.FormationAdapter(teamInfo)
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
-- 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")
-- icon.sprite = this.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
-- this.imprintObj:SetActive(false)
-- end
--====================其他信息按钮显示======================
for index, value in ipairs(InfoBtns) do
local item = this.InfoBtnsList[index]
if not item then
item = newObjToParent(this.infoBtnPre,this.InfoBtnsGrid.transform)
this.InfoBtnsList[index] = item
item.gameObject:SetActive(true)
local icon = Util.GetGameObject(item,"icon"):GetComponent("Image")
icon.sprite = this.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
this.imprintObj:SetActive(false)
Util.GetGameObject(item,"btnName"):GetComponent("Text").text = value.name
end
end
-- 刷新按钮显示
--============================底部按钮显示===========================
function this.RefreshBtnShow()
this.btnBox:SetActive(true)
@ -479,7 +510,7 @@ function this.RefreshBtnShow()
--一些按钮需要特殊显示
this.SpecialBtnShow()
end
--按钮特殊显示
function this.SpecialBtnShow()
if this._ViewType == PLAYER_INFO_VIEW_TYPE.LINGMAIMIJING then
this.btnBox:SetActive(true)
@ -579,6 +610,7 @@ function this.LingMaiQieCuo()
sdata.headFrame = this.curPlayerData.headFrame
UIManager.OpenPanel(UIName.FormationPanelV2, FORMATION_TYPE.LINGMAIMIJING, sdata,true)
end
--=====================================按钮事件结束======================================
--界面关闭时调用(用于子类重写)
function PlayerInfoPopup:OnClose()
@ -601,7 +633,9 @@ function PlayerInfoPopup:OnDestroy()
end
titleLive = nil
titleLiveStr = nil
this.imprintItemList = {}
-- this.imprintItemList = {}
this.InfoBtnsList = {}
this.ItemPreList = {}
this.Demons = {}
if this.extraInfo then
this.extraInfo.OnDestroy()