【战斗】添加头像显示
parent
ecc7e155a0
commit
4c00b471ad
File diff suppressed because it is too large
Load Diff
|
@ -23,6 +23,11 @@ function MonsterManager.AddMonster(data)
|
|||
BattleLogic.Event:DispatchEvent(BattleEventName.AddMonster, monster)
|
||||
end
|
||||
|
||||
-- 获取角色数据
|
||||
function this.GetMonster(camp, pos)
|
||||
local index = camp * 6 + pos
|
||||
return this.monsterList[index]
|
||||
end
|
||||
|
||||
function MonsterManager.Update()
|
||||
|
||||
|
|
|
@ -168,10 +168,15 @@ function this:InitComponent(root, go)
|
|||
this.lingshouDownEffect:SetActive(false)
|
||||
this.enemyMonster=Util.GetGameObject(this.transform, "enemyMonster")
|
||||
this.playerMonster=Util.GetGameObject(this.transform, "playerMonster")
|
||||
this.ElementalResonanceView = SubUIManager.Open(SubUIConfig.ElementalResonanceView, self.gameObject.transform)
|
||||
this.ElementalResonanceView2 = SubUIManager.Open(SubUIConfig.ElementalResonanceView, self.gameObject.transform)
|
||||
this.ElementalResonanceView.elementalResonanceBtn:SetActive(false)
|
||||
this.ElementalResonanceView2.elementalResonanceBtn:SetActive(false)
|
||||
-- this.ElementalResonanceView = SubUIManager.Open(SubUIConfig.ElementalResonanceView, self.gameObject.transform)
|
||||
-- this.ElementalResonanceView2 = SubUIManager.Open(SubUIConfig.ElementalResonanceView, self.gameObject.transform)
|
||||
-- this.ElementalResonanceView.elementalResonanceBtn:SetActive(false)
|
||||
-- this.ElementalResonanceView2.elementalResonanceBtn:SetActive(false)
|
||||
|
||||
this.player = Util.GetGameObject(this.DownRoot, "player")
|
||||
this.enemy = Util.GetGameObject(this.UpRoot, "enemy")
|
||||
this.player:SetActive(false)
|
||||
this.enemy:SetActive(false)
|
||||
|
||||
|
||||
this.mySkillCast:SetActive(false)
|
||||
|
@ -194,8 +199,8 @@ end
|
|||
|
||||
-- 正常接口
|
||||
function this:OnOpen(data, _fightType, isBoss)
|
||||
this.ElementalResonanceView:OnOpen({sortOrder = BattleManager.GetBattleSorting()})
|
||||
this.ElementalResonanceView2:OnOpen({sortOrder = BattleManager.GetBattleSorting()})
|
||||
-- this.ElementalResonanceView:OnOpen({sortOrder = BattleManager.GetBattleSorting()})
|
||||
-- this.ElementalResonanceView2:OnOpen({sortOrder = BattleManager.GetBattleSorting()})
|
||||
this:Init()
|
||||
this:SetData(data.fightData, data.fightSeed, data.fightType, data.maxRound, data.fightId, isBoss)
|
||||
this.fightType = _fightType
|
||||
|
@ -407,6 +412,29 @@ function this.InitBattleData()
|
|||
|
||||
-- this.EnemyPanel:GetComponent("RectTransform").anchoredPosition = Vector2.New(0, posY)
|
||||
end
|
||||
|
||||
-- 设置主角头像显示
|
||||
local sexIcon = {
|
||||
[0] = "live2d_npc_boy_t1",
|
||||
[1] = "live2d_npc_girl_t1",
|
||||
}
|
||||
function this.SetHeadShow()
|
||||
local enemy = MonsterManager.GetMonster(1, 100) -- 敌方主角
|
||||
if enemy then
|
||||
this.enemy:SetActive(true)
|
||||
this.enemy:GetComponent("Image").sprite = this.spLoader:LoadSprite(sexIcon[enemy.sex])
|
||||
else
|
||||
this.enemy:SetActive(false)
|
||||
end
|
||||
local player = MonsterManager.GetMonster(0, 100) -- 我方主角
|
||||
if player then
|
||||
this.player:SetActive(true)
|
||||
this.player:GetComponent("Image").sprite = this.spLoader:LoadSprite(sexIcon[player.sex])
|
||||
else
|
||||
this.player:SetActive(false)
|
||||
end
|
||||
|
||||
end
|
||||
-- 注册战斗事件
|
||||
function this.InitBattleEvent()
|
||||
|
||||
|
@ -553,15 +581,15 @@ function this.BattleOrderChange(order)
|
|||
this.root.OnOrderChanged(order)
|
||||
end
|
||||
|
||||
this.ElementalResonanceView.elementalResonanceBtn:SetActive(true)
|
||||
this.ElementalResonanceView2.elementalResonanceBtn:SetActive(true)
|
||||
-- this.ElementalResonanceView.elementalResonanceBtn:SetActive(true)
|
||||
-- this.ElementalResonanceView2.elementalResonanceBtn:SetActive(true)
|
||||
|
||||
local curFormation = FormationManager.GetFormationByID(FormationManager.currentFormationIndex)
|
||||
this.ElementalResonanceView:GetElementalType(curFormation.teamHeroInfos,1)
|
||||
this.ElementalResonanceView:SetPosition(2)
|
||||
-- this.ElementalResonanceView:GetElementalType(curFormation.teamHeroInfos,1)
|
||||
-- this.ElementalResonanceView:SetPosition(2)
|
||||
if this.fightData.enemyData[order] then
|
||||
this.ElementalResonanceView2:GetElementalType(this.fightData.enemyData[order], 2, order)
|
||||
this.ElementalResonanceView2:SetPosition(3)
|
||||
-- this.ElementalResonanceView2:GetElementalType(this.fightData.enemyData[order], 2, order)
|
||||
-- this.ElementalResonanceView2:SetPosition(3)
|
||||
end
|
||||
|
||||
if this.tween1 then
|
||||
|
@ -623,13 +651,15 @@ function this.BattleOrderChange(order)
|
|||
if this.fightType == BATTLE_TYPE.STORY_FIGHT and data.BossPreview and data.BossPreview > 0 and key == 0 then
|
||||
|
||||
this.EnemyAppear(false)--设置敌人
|
||||
this.SetHeadShow()-- 显示头像
|
||||
Timer.New(function ()
|
||||
UIManager.OpenPanel(UIName.BattleBossInfoPanel,function ()
|
||||
func()
|
||||
end)
|
||||
end,1.5):Start()
|
||||
else
|
||||
this.EnemyAppear(true)--设置敌人
|
||||
this.EnemyAppear(true) --设置敌人
|
||||
this.SetHeadShow() -- 显示头像
|
||||
Timer.New(function ()
|
||||
func()
|
||||
end,1.5):Start()
|
||||
|
@ -1069,8 +1099,8 @@ function this:OnDestroy()
|
|||
this.spLoader:Destroy()
|
||||
BattleManager.SetSpLoader(nil)
|
||||
|
||||
SubUIManager.Close(this.ElementalResonanceView)
|
||||
SubUIManager.Close(this.ElementalResonanceView2)
|
||||
-- SubUIManager.Close(this.ElementalResonanceView)
|
||||
-- SubUIManager.Close(this.ElementalResonanceView2)
|
||||
-- BattlePool.Destroy()
|
||||
-- 回收所有延迟资源
|
||||
BattleManager.RecycleAllDelayRes()
|
||||
|
|
Loading…
Reference in New Issue