【新假战斗】加入主角技能
parent
c9e2ddcaf8
commit
880c77888a
|
@ -652,28 +652,48 @@ end
|
|||
-- 从monsterGroup中获取灵兽数据
|
||||
function this.GetMonsterDataFromGroup(gId, camp)
|
||||
local list = {}
|
||||
-- 灵兽
|
||||
local Monsters = MonsterGroup[gId].Animal
|
||||
if not Monsters then
|
||||
return list
|
||||
end
|
||||
for i = 1, #Monsters do
|
||||
local monster = Monsters[i]
|
||||
local id = monster[1]
|
||||
local star = monster[2]
|
||||
local level = monster[3]
|
||||
if Monsters then
|
||||
for i = 1, #Monsters do
|
||||
local monster = Monsters[i]
|
||||
local id = monster[1]
|
||||
local star = monster[2]
|
||||
local level = monster[3]
|
||||
|
||||
local mUnit = {
|
||||
unitId = id,
|
||||
position = i,
|
||||
star = star,
|
||||
playerSex = 0,
|
||||
forceScore = 0
|
||||
}
|
||||
local pros = this.GetMonsterPros(id, level, star)
|
||||
mUnit.property = pros
|
||||
local mSkill = ConfigManager.GetConfigDataByDoubleKey(ConfigName.SpiritAnimalSkill, "SpiritAnimalMatch", id, "StarMatch", star)
|
||||
mUnit.unitSkillIds = mSkill.Id
|
||||
list[i] = this.PokemonUnitAdapter(mUnit, camp)
|
||||
end
|
||||
end
|
||||
-- 主角
|
||||
local RoleSkills = MonsterGroup[gId].Role
|
||||
if RoleSkills and #RoleSkills > 0 then
|
||||
local mUnit = {
|
||||
unitId = id,
|
||||
position = i,
|
||||
star = star,
|
||||
unitId = 20100,
|
||||
position = 100,
|
||||
star = 1,
|
||||
playerSex = 0,
|
||||
forceScore = 0
|
||||
forceScore = 0,
|
||||
property = {}
|
||||
}
|
||||
local pros = this.GetMonsterPros(id, level, star)
|
||||
mUnit.property = pros
|
||||
local mSkill = ConfigManager.GetConfigDataByDoubleKey(ConfigName.SpiritAnimalSkill, "SpiritAnimalMatch", id, "StarMatch", star)
|
||||
mUnit.unitSkillIds = mSkill.Id
|
||||
list[i] = this.PokemonUnitAdapter(mUnit, camp)
|
||||
for _, id in ipairs(RoleSkills) do
|
||||
if not mUnit.unitSkillIds then
|
||||
mUnit.unitSkillIds = id
|
||||
else
|
||||
mUnit.unitSkillIds = mUnit.unitSkillIds .. "#" .. id
|
||||
end
|
||||
end
|
||||
list[#list+1] = this.PokemonUnitAdapter(mUnit, camp)
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
|
|
@ -413,6 +413,7 @@ function this.InitBattleEvent()
|
|||
BattleLogic.Event:AddEvent(BattleEventName.BattleOrderChange, this.BattleOrderChange)
|
||||
BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, this.BattleRoundChange)
|
||||
BattleLogic.Event:AddEvent(BattleEventName.RoleTurnStart, this.RoleTurnChange)
|
||||
BattleLogic.Event:AddEvent(BattleEventName.BattleStart, this.OnBattleStart)
|
||||
|
||||
end
|
||||
-- 清除战斗数据
|
||||
|
@ -426,6 +427,7 @@ function this.ClearBattleEvent()
|
|||
BattleLogic.Event:RemoveEvent(BattleEventName.BattleOrderChange, this.BattleOrderChange)
|
||||
BattleLogic.Event:RemoveEvent(BattleEventName.BattleRoundChange, this.BattleRoundChange)
|
||||
BattleLogic.Event:RemoveEvent(BattleEventName.RoleTurnStart, this.RoleTurnChange)
|
||||
BattleLogic.Event:RemoveEvent(BattleEventName.BattleStart, this.OnBattleStart)
|
||||
end
|
||||
|
||||
--敌军出现的表现
|
||||
|
@ -489,6 +491,14 @@ function this.EnemyAppear(isStart)
|
|||
end
|
||||
end
|
||||
|
||||
-- 战斗开始回调
|
||||
function this.OnBattleStart()
|
||||
-- 回调UI层
|
||||
if this.root.OnBattleStart then
|
||||
this.root.OnBattleStart()
|
||||
end
|
||||
end
|
||||
|
||||
-- 角色轮转回调(不出手的位置不会回调)
|
||||
function this.RoleTurnChange(role)
|
||||
-- 回调UI层
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
local GuideBattleLogic = {}
|
||||
|
||||
function GuideBattleLogic:Init(guideType)
|
||||
if not guideType then
|
||||
return
|
||||
end
|
||||
self.guideType = guideType
|
||||
self.configList = ConfigManager.GetAllConfigsDataByKey(ConfigName.GuideBattleConfig, "GuideGroup", self.guideType)
|
||||
end
|
||||
|
@ -43,6 +46,39 @@ function GuideBattleLogic:RoleTurnChange(curRound, role)
|
|||
end
|
||||
end
|
||||
|
||||
function GuideBattleLogic:OnBattleStart(func)
|
||||
-- 没有就不引导了
|
||||
if not self.configList or #self.configList <= 0 then
|
||||
if func then
|
||||
func()
|
||||
end
|
||||
return
|
||||
end
|
||||
local _config = nil
|
||||
for _, con in ipairs(self.configList) do
|
||||
if con.Round == -2 then -- 战前
|
||||
_config = con
|
||||
break
|
||||
end
|
||||
end
|
||||
if not _config then
|
||||
if func then
|
||||
func()
|
||||
end
|
||||
return
|
||||
end
|
||||
-- 对话形式的引导
|
||||
if _config.TriggerType == 1 then
|
||||
BattleManager.SetGuidePause(true)
|
||||
local storyId = _config.TriggerId
|
||||
StoryManager.EventTrigger(storyId, function()
|
||||
BattleManager.SetGuidePause(false)
|
||||
if func then
|
||||
func()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
function GuideBattleLogic:OnBattleEnd(func)
|
||||
-- 没有就不引导了
|
||||
if not self.configList or #self.configList <= 0 then
|
||||
|
@ -53,7 +89,7 @@ function GuideBattleLogic:OnBattleEnd(func)
|
|||
end
|
||||
local _config = nil
|
||||
for _, con in ipairs(self.configList) do
|
||||
if con.Round == -1 then
|
||||
if con.Round == -1 then -- 战后
|
||||
_config = con
|
||||
break
|
||||
end
|
||||
|
|
|
@ -86,7 +86,11 @@ function this:OnOpen(_fightData, _endFunc, guideType)
|
|||
endFunc = _endFunc
|
||||
|
||||
fightType = BATTLE_TYPE.Test --判定战斗类型
|
||||
this.BG:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_zhandou_changjing_1005")
|
||||
if guideType == 1 then
|
||||
this.BG:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_zhandou_changjing_1005")
|
||||
else
|
||||
this.BG:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_zhandou_changjing_2")
|
||||
end
|
||||
|
||||
this.BtnGM:SetActive(true)
|
||||
this.ButtonLock:SetActive(false)
|
||||
|
@ -159,6 +163,11 @@ function this.BattleEnd(result)
|
|||
end)
|
||||
end
|
||||
|
||||
function this.OnBattleStart(order)
|
||||
--显示波次
|
||||
GuideBattleLogic:OnBattleStart()
|
||||
end
|
||||
|
||||
|
||||
function this.OnOrderChanged(order)
|
||||
--显示波次
|
||||
|
|
Loading…
Reference in New Issue