【boss详情】战斗中断完成,该创建新界面

dev_chengFeng
ZhangBiao 2021-02-22 16:59:55 +08:00
parent daa0038197
commit 0382600bb8
2 changed files with 40 additions and 81 deletions

View File

@ -116,8 +116,7 @@ function BattleLogic.CheckFirstCamp()
end
end
function BattleLogic.StartOrder()
--
function BattleLogic.InitOrder()
BattleLogic.CurOrder = BattleLogic.CurOrder + 1
if BattleLogic.CurOrder == 1 then
local playerData = fightData.playerData
@ -144,7 +143,6 @@ function BattleLogic.StartOrder()
end
end
else
RoleManager.ClearEnemy()
local orderList = fightData.enemyData[BattleLogic.CurOrder]
@ -159,14 +157,19 @@ function BattleLogic.StartOrder()
MonsterManager.AddMonster(enemyMonsterList[i])
end
end
end
-- 检测先后手
BattleLogic.CheckFirstCamp()
-- 开始战斗,延时一帧执行,避免战斗还没开始就释放了技能
BattleLogic.TurnRoundNextFrame()
-- 战斗开始
BattleLogic.Event:DispatchEvent(BattleEventName.BattleStart)
end
function BattleLogic.StartTurnRound()
BattleLogic.CheckFirstCamp()-- 检测先后手
BattleLogic.TurnRoundNextFrame()-- 开始战斗,延时一帧执行,避免战斗还没开始就释放了技能
BattleLogic.Event:DispatchEvent(BattleEventName.BattleStart)-- 战斗开始
end
function BattleLogic.StartOrder()
BattleLogic.InitOrder()
BattleLogic.StartTurnRound()
end
-- 获取当前轮数

View File

@ -407,33 +407,19 @@ end
--敌军出现的表现
function this.EnemyAppear()
SoundManager.PlaySound(SoundConfig.Sound_BattleStart_03)
local go
if BattleLogic.CurOrder == 1 then
go = this.FirstEffect
elseif BattleLogic.CurOrder == 2 then
go = this.FirstEffect
elseif BattleLogic.CurOrder == 3 then
go = this.ThirdEffect
end
local go = this.FirstEffect
go:SetActive(true)
--TODO:动态计算敌军站位
for i=1, 6 do
local index = i
local enemyLivePos = Util.GetTransform(this.EnemyPanel, "live_"..i)
local enemyPos = Util.GetTransform(this.EnemyPanel, tostring(i))
local scale = i > 3 and 0.5 or 0.6--(1 - math.abs(i-pos[1]+posOffset) * 0.15) --敌人依次缩放出现
local scale = i > 3 and 0.5 or 0.6
enemyLivePos:DOScale(Vector3.one * scale * 1.1, 0.5):SetEase(Ease.OutExpo)
enemyPos:DOScale(Vector3.one * 1.1, 0.5):SetEase(Ease.OutExpo):OnComplete(function ()
enemyLivePos:DOScale(Vector3.one * scale, 0.2):SetEase(Ease.InExpo)
enemyPos:DOScale(Vector3.one, 0.2):SetEase(Ease.InExpo):OnComplete(function ()
if index == 4 then
-- 提前播放音效
-- if BattleLogic.CurOrder == 1 then
-- SoundManager.PlaySound(SoundConfig.Sound_BattleStart_04)
-- end
elseif index == 6 then
if index == 6 then
--显示血条
for r, v in pairs(tbRole) do
if r.camp == 0 then
@ -446,19 +432,15 @@ function this.EnemyAppear()
go:SetActive(false)
playerHP = 0
this.PlayerHPTxt.text = Language[10269]..math.floor(playerHP / playerMaxHP * 100).."%"
enemyHP = 0
this.EnemyHPTxt.text = Language[10270]..math.floor(enemyHP / enemyMaxHP * 100).."%"
Timer.New(function ()
if BattleLogic.CurOrder == 1 then
BattleManager.StartBattle()
else
BattleManager.ResumeBattle()
end
end, 0.1):Start()
-- Timer.New(function ()
-- if BattleLogic.CurOrder == 1 then
-- BattleManager.StartBattle()
-- else
-- BattleManager.ResumeBattle()
-- end
-- end, 0.1):Start()
if BattleLogic.CurOrder == 1 then
Game.GlobalEvent:DispatchEvent(GameEvent.Guide.GuideBattleStart)
end
@ -472,7 +454,6 @@ function this.EnemyAppear()
go2.transform.localScale = Vector3.one
go2.transform.position = enemyPos.position + Vector3.New(0, 120, 0)*0.00375
go2:SetActive(true)
addDelayRecycleRes("fx_Effect_enemy_birth", go2, 2)
end
end)
@ -538,23 +519,7 @@ function this.BattleOrderChange(order)
this.PlayerHP.fillAmount = 0
BattleManager.PauseBattle()
-- this.BG:GetComponent("RectTransform").anchoredPosition = Vector2.zero
-- this.BG:GetComponent("Image").sprite = Util.LoadSprite(scene[order])
if order > 1 then
-- this.LastBG:GetComponent("Image").sprite = Util.LoadSprite(scene[order-1])
-- this.LastBG:SetActive(true)
-- this.LastBG:GetComponent("Image"):DOFade(1,0):OnComplete(function ()
-- this.LastBG:GetComponent("Image"):DOFade(0,1):OnComplete(function ()
-- this.LastBG:SetActive(false)
-- end)
-- end)
-- this.BG:GetComponent("Image"):DOFade(0,0):OnComplete(function ()
-- this.BG:GetComponent("Image"):DOFade(1,1)
-- end)
--
PlayUIAnimBack(this.gameObject,function ()
for _,v in pairs(tbRole) do
v.hpSlider.fillAmount = 0
@ -565,38 +530,29 @@ function this.BattleOrderChange(order)
end
end
PlayUIAnim(this.gameObject)--, this.EnemyAppear)
PlayUIAnim(this.gameObject)
this.EnemyAppear()
end)
else
this.UpRoot:SetActive(false)
this.DownRoot:SetActive(false)
this.PlayerPanel:SetActive(false)
-- RoleShowView.Show(function()
-- RoleShowView.Recycle()
this.UpRoot:SetActive(true)
this.DownRoot:SetActive(true)
PlayUIAnim(this.gameObject)
-- Timer.New(function()
-- SoundManager.PlaySound(SoundConfig.Sound_BattleStart_02)
-- end, 1):Start()
playerMaxHP = 0
BattleLogic.StartOrder()
-- for _,v in pairs(tbRole) do
-- v.hpSlider.fillAmount = 0
-- v.hpPassSlider.fillAmount = 0
-- v.hpCache = 0
-- if v.spSlider then
-- v.spSlider.fillAmount = 0
-- end
-- end
this.PlayerPanel:SetActive(true)
PlayUIAnim(this.PlayerPanel)
this.EnemyAppear()
-- end)
this.UpRoot:SetActive(true)
this.DownRoot:SetActive(true)
PlayUIAnim(this.gameObject)
playerMaxHP = 0
this.PlayerPanel:SetActive(true)
PlayUIAnim(this.PlayerPanel)
this.EnemyAppear()
BattleLogic.InitOrder()
Timer.New(function ()
if BattleLogic.CurOrder == 1 then
BattleManager.StartBattle()
else
BattleManager.ResumeBattle()
end
BattleLogic.StartTurnRound()
end,6):Start()
end
--刷新敌军站位