棋盘新的读取方式
This commit is contained in:
parent
4c752c0e78
commit
4b1875aafd
186
lua/app/config/battle_exp.lua
Normal file
186
lua/app/config/battle_exp.lua
Normal file
@ -0,0 +1,186 @@
|
||||
local battle_exp = {
|
||||
[1]={
|
||||
["exp"]=2
|
||||
},
|
||||
[2]={
|
||||
["exp"]=18
|
||||
},
|
||||
[3]={
|
||||
["exp"]=58
|
||||
},
|
||||
[4]={
|
||||
["exp"]=108
|
||||
},
|
||||
[5]={
|
||||
["exp"]=188
|
||||
},
|
||||
[6]={
|
||||
["exp"]=298
|
||||
},
|
||||
[7]={
|
||||
["exp"]=448
|
||||
},
|
||||
[8]={
|
||||
["exp"]=658
|
||||
},
|
||||
[9]={
|
||||
["exp"]=948
|
||||
},
|
||||
[10]={
|
||||
["exp"]=1318
|
||||
},
|
||||
[11]={
|
||||
["exp"]=1858
|
||||
},
|
||||
[12]={
|
||||
["exp"]=2568
|
||||
},
|
||||
[13]={
|
||||
["exp"]=3448
|
||||
},
|
||||
[14]={
|
||||
["exp"]=4498
|
||||
},
|
||||
[15]={
|
||||
["exp"]=5718
|
||||
},
|
||||
[16]={
|
||||
["exp"]=7138
|
||||
},
|
||||
[17]={
|
||||
["exp"]=8758
|
||||
},
|
||||
[18]={
|
||||
["exp"]=10628
|
||||
},
|
||||
[19]={
|
||||
["exp"]=12748
|
||||
},
|
||||
[20]={
|
||||
["exp"]=15118
|
||||
},
|
||||
[21]={
|
||||
["exp"]=17738
|
||||
},
|
||||
[22]={
|
||||
["exp"]=20608
|
||||
},
|
||||
[23]={
|
||||
["exp"]=23728
|
||||
},
|
||||
[24]={
|
||||
["exp"]=27098
|
||||
},
|
||||
[25]={
|
||||
["exp"]=30718
|
||||
},
|
||||
[26]={
|
||||
["exp"]=34588
|
||||
},
|
||||
[27]={
|
||||
["exp"]=38708
|
||||
},
|
||||
[28]={
|
||||
["exp"]=43078
|
||||
},
|
||||
[29]={
|
||||
["exp"]=47798
|
||||
},
|
||||
[30]={
|
||||
["exp"]=52868
|
||||
},
|
||||
[31]={
|
||||
["exp"]=58288
|
||||
},
|
||||
[32]={
|
||||
["exp"]=64058
|
||||
},
|
||||
[33]={
|
||||
["exp"]=70178
|
||||
},
|
||||
[34]={
|
||||
["exp"]=76648
|
||||
},
|
||||
[35]={
|
||||
["exp"]=83468
|
||||
},
|
||||
[36]={
|
||||
["exp"]=90638
|
||||
},
|
||||
[37]={
|
||||
["exp"]=98158
|
||||
},
|
||||
[38]={
|
||||
["exp"]=106028
|
||||
},
|
||||
[39]={
|
||||
["exp"]=114248
|
||||
},
|
||||
[40]={
|
||||
["exp"]=122918
|
||||
},
|
||||
[41]={
|
||||
["exp"]=132038
|
||||
},
|
||||
[42]={
|
||||
["exp"]=141608
|
||||
},
|
||||
[43]={
|
||||
["exp"]=151628
|
||||
},
|
||||
[44]={
|
||||
["exp"]=162098
|
||||
},
|
||||
[45]={
|
||||
["exp"]=173018
|
||||
},
|
||||
[46]={
|
||||
["exp"]=184388
|
||||
},
|
||||
[47]={
|
||||
["exp"]=196208
|
||||
},
|
||||
[48]={
|
||||
["exp"]=208478
|
||||
},
|
||||
[49]={
|
||||
["exp"]=221198
|
||||
},
|
||||
[50]={
|
||||
["exp"]=234368
|
||||
},
|
||||
[51]={
|
||||
["exp"]=247988
|
||||
},
|
||||
[52]={
|
||||
["exp"]=262058
|
||||
},
|
||||
[53]={
|
||||
["exp"]=276578
|
||||
},
|
||||
[54]={
|
||||
["exp"]=291548
|
||||
},
|
||||
[55]={
|
||||
["exp"]=306968
|
||||
},
|
||||
[56]={
|
||||
["exp"]=322838
|
||||
},
|
||||
[57]={
|
||||
["exp"]=339158
|
||||
},
|
||||
[58]={
|
||||
["exp"]=355928
|
||||
},
|
||||
[59]={
|
||||
["exp"]=373148
|
||||
},
|
||||
[60]={
|
||||
["exp"]=390368
|
||||
}
|
||||
}
|
||||
local config = {
|
||||
data=battle_exp,count=60
|
||||
}
|
||||
return config
|
||||
10
lua/app/config/battle_exp.lua.meta
Normal file
10
lua/app/config/battle_exp.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0969bad6920b66d43b567117507a49e7
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -102,6 +102,10 @@ local buff = {
|
||||
["decr"]=3,
|
||||
["is_percent"]=2,
|
||||
["v_buf"]="heal"
|
||||
},
|
||||
[14]={
|
||||
["name"]="block_hurt_dec",
|
||||
["buff_type"]=1
|
||||
}
|
||||
}
|
||||
local keys = {
|
||||
@ -118,12 +122,13 @@ local keys = {
|
||||
["block"]=buff[10],
|
||||
["hit_block"]=buff[11],
|
||||
["heal"]=buff[12],
|
||||
["hit_heal"]=buff[13]
|
||||
["hit_heal"]=buff[13],
|
||||
["block_hurt_dec"]=buff[14]
|
||||
}
|
||||
}
|
||||
local config = {
|
||||
data=buff,
|
||||
keys=keys,
|
||||
count=13
|
||||
count=14
|
||||
}
|
||||
return config
|
||||
File diff suppressed because it is too large
Load Diff
7148
lua/app/config/chapter_board.lua
Normal file
7148
lua/app/config/chapter_board.lua
Normal file
File diff suppressed because it is too large
Load Diff
10
lua/app/config/chapter_board.lua.meta
Normal file
10
lua/app/config/chapter_board.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e2b7e3534b15dc4aa3b72501a87f467
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -7,6 +7,10 @@ local LocalizationGlobalConst =
|
||||
QLT_DESC_4 = "QLT_DESC_4",
|
||||
QLT_DESC_5 = "QLT_DESC_5",
|
||||
QLT_DESC_6 = "QLT_DESC_6",
|
||||
MESSAGE_BOX_TITLE = "MESSAGE_BOX_TITLE",
|
||||
BTN_TEXT_CANCEL = "BTN_TEXT_CANCEL",
|
||||
BTN_TEXT_OK = "BTN_TEXT_OK",
|
||||
BATTLE_DESC_1 = "BATTLE_DESC_1",
|
||||
}
|
||||
|
||||
return LocalizationGlobalConst
|
||||
120
lua/app/config/monster_base.lua
Normal file
120
lua/app/config/monster_base.lua
Normal file
@ -0,0 +1,120 @@
|
||||
local monster_base = {
|
||||
[10001]={
|
||||
["model_id"]="m10001"
|
||||
},
|
||||
[10002]={
|
||||
["model_id"]="m10002"
|
||||
},
|
||||
[10003]={
|
||||
["model_id"]="m10003"
|
||||
},
|
||||
[10004]={
|
||||
["model_id"]="m10004"
|
||||
},
|
||||
[10005]={
|
||||
["model_id"]="m10005"
|
||||
},
|
||||
[10006]={
|
||||
["model_id"]="m10006"
|
||||
},
|
||||
[10007]={
|
||||
["model_id"]="m10007"
|
||||
},
|
||||
[10008]={
|
||||
["model_id"]="m10008"
|
||||
},
|
||||
[10009]={
|
||||
["model_id"]="m10009"
|
||||
},
|
||||
[10010]={
|
||||
["model_id"]="m10010"
|
||||
},
|
||||
[10011]={
|
||||
["model_id"]="m10011"
|
||||
},
|
||||
[10012]={
|
||||
["model_id"]="m10012"
|
||||
},
|
||||
[10013]={
|
||||
["model_id"]="m10013"
|
||||
},
|
||||
[10014]={
|
||||
["model_id"]="m10014"
|
||||
},
|
||||
[10015]={
|
||||
["model_id"]="m10015"
|
||||
},
|
||||
[10016]={
|
||||
["model_id"]="m10016"
|
||||
},
|
||||
[10017]={
|
||||
["model_id"]="m10017"
|
||||
},
|
||||
[10018]={
|
||||
["model_id"]="m10018"
|
||||
},
|
||||
[10019]={
|
||||
["model_id"]="m10019"
|
||||
},
|
||||
[10020]={
|
||||
["model_id"]="m10020"
|
||||
},
|
||||
[10021]={
|
||||
["model_id"]="m10021"
|
||||
},
|
||||
[10022]={
|
||||
["model_id"]="m10022"
|
||||
},
|
||||
[20001]={
|
||||
["model_id"]="m20001"
|
||||
},
|
||||
[20002]={
|
||||
["model_id"]="m20002"
|
||||
},
|
||||
[20003]={
|
||||
["model_id"]="m20003"
|
||||
},
|
||||
[20004]={
|
||||
["model_id"]="m20004"
|
||||
},
|
||||
[20005]={
|
||||
["model_id"]="m20005"
|
||||
},
|
||||
[20006]={
|
||||
["model_id"]="m20006"
|
||||
},
|
||||
[20007]={
|
||||
["model_id"]="m20007"
|
||||
},
|
||||
[20008]={
|
||||
["model_id"]="m20008"
|
||||
},
|
||||
[20009]={
|
||||
["model_id"]="m20009"
|
||||
},
|
||||
[20010]={
|
||||
["model_id"]="m20010"
|
||||
},
|
||||
[20011]={
|
||||
["model_id"]="m20011"
|
||||
},
|
||||
[20012]={
|
||||
["model_id"]="m20012"
|
||||
},
|
||||
[20013]={
|
||||
["model_id"]="m20013"
|
||||
},
|
||||
[20014]={
|
||||
["model_id"]="m20014"
|
||||
},
|
||||
[20015]={
|
||||
["model_id"]="m20015"
|
||||
},
|
||||
[20016]={
|
||||
["model_id"]="m20016"
|
||||
}
|
||||
}
|
||||
local config = {
|
||||
data=monster_base,count=38
|
||||
}
|
||||
return config
|
||||
10
lua/app/config/monster_base.lua.meta
Normal file
10
lua/app/config/monster_base.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d719904ab37d95c409385663201f45af
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
86
lua/app/config/monster_chapter.lua
Normal file
86
lua/app/config/monster_chapter.lua
Normal file
@ -0,0 +1,86 @@
|
||||
local monster_chapter = {
|
||||
[101]={
|
||||
["monster_base"]=10001,
|
||||
["hp"]=10000000,
|
||||
["atk"]=10000,
|
||||
["atk_times"]=2,
|
||||
["skill"]={
|
||||
100001
|
||||
},
|
||||
["monster_exp"]=10000
|
||||
},
|
||||
[201]={
|
||||
["monster_base"]=10002,
|
||||
["hp"]=10000000,
|
||||
["atk"]=10000,
|
||||
["atk_times"]=3,
|
||||
["skill"]={
|
||||
100001
|
||||
},
|
||||
["monster_exp"]=10000
|
||||
},
|
||||
[301]={
|
||||
["monster_base"]=10003,
|
||||
["hp"]=10000000,
|
||||
["atk"]=10000,
|
||||
["atk_times"]=2,
|
||||
["skill"]={
|
||||
100001
|
||||
},
|
||||
["monster_exp"]=10000
|
||||
},
|
||||
[401]={
|
||||
["monster_base"]=10004,
|
||||
["hp"]=10000000,
|
||||
["atk"]=10000,
|
||||
["atk_times"]=3,
|
||||
["skill"]={
|
||||
100001
|
||||
},
|
||||
["monster_exp"]=10000
|
||||
},
|
||||
[501]={
|
||||
["monster_base"]=10005,
|
||||
["hp"]=10000000,
|
||||
["atk"]=10000,
|
||||
["atk_times"]=2,
|
||||
["skill"]={
|
||||
100001
|
||||
},
|
||||
["monster_exp"]=10000
|
||||
},
|
||||
[601]={
|
||||
["monster_base"]=10006,
|
||||
["hp"]=10000000,
|
||||
["atk"]=10000,
|
||||
["atk_times"]=3,
|
||||
["skill"]={
|
||||
100001
|
||||
},
|
||||
["monster_exp"]=10000
|
||||
},
|
||||
[701]={
|
||||
["monster_base"]=10007,
|
||||
["hp"]=10000000,
|
||||
["atk"]=10000,
|
||||
["atk_times"]=2,
|
||||
["skill"]={
|
||||
100001
|
||||
},
|
||||
["monster_exp"]=10000
|
||||
},
|
||||
[801]={
|
||||
["monster_base"]=10008,
|
||||
["hp"]=10000000,
|
||||
["atk"]=10000,
|
||||
["atk_times"]=3,
|
||||
["skill"]={
|
||||
100001
|
||||
},
|
||||
["monster_exp"]=10000
|
||||
}
|
||||
}
|
||||
local config = {
|
||||
data=monster_chapter,count=8
|
||||
}
|
||||
return config
|
||||
10
lua/app/config/monster_chapter.lua.meta
Normal file
10
lua/app/config/monster_chapter.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 779a2880a816b4243bf908b3812de050
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
32
lua/app/config/skill_monster.lua
Normal file
32
lua/app/config/skill_monster.lua
Normal file
@ -0,0 +1,32 @@
|
||||
local skill_monster = {
|
||||
[100001]={
|
||||
["cd"]=3,
|
||||
["cd_start"]=3
|
||||
},
|
||||
[100002]={
|
||||
["cd"]=4,
|
||||
["cd_start"]=4
|
||||
},
|
||||
[100003]={
|
||||
|
||||
},
|
||||
[100004]={
|
||||
|
||||
},
|
||||
[100005]={
|
||||
|
||||
},
|
||||
[100006]={
|
||||
|
||||
},
|
||||
[100007]={
|
||||
|
||||
},
|
||||
[100008]={
|
||||
|
||||
}
|
||||
}
|
||||
local config = {
|
||||
data=skill_monster,count=8
|
||||
}
|
||||
return config
|
||||
10
lua/app/config/skill_monster.lua.meta
Normal file
10
lua/app/config/skill_monster.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5bb9a5e5ecdd2844bb315067b877a3a5
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -7,6 +7,10 @@ local localization_global =
|
||||
["QLT_DESC_4"] = "史诗",
|
||||
["QLT_DESC_5"] = "传说",
|
||||
["QLT_DESC_6"] = "神话",
|
||||
["MESSAGE_BOX_TITLE"] = "提示",
|
||||
["BTN_TEXT_CANCEL"] = "取消",
|
||||
["BTN_TEXT_OK"] = "确定",
|
||||
["BATTLE_DESC_1"] = "是否退出战斗",
|
||||
}
|
||||
|
||||
return localization_global
|
||||
@ -9,11 +9,15 @@ local ELIMINATION_TOUCH_EVENT = GConst.ELIMINATION_TOUCH_EVENT
|
||||
local BattleConst = GConst.BattleConst
|
||||
|
||||
-- *************各个子模块的战斗需要重写的方法 START*************
|
||||
function BattleController:getChapterId()
|
||||
return 0
|
||||
end
|
||||
|
||||
function BattleController:getInitBoard()
|
||||
return {}
|
||||
end
|
||||
|
||||
function BattleController:getFixedRandomGrid()
|
||||
function BattleController:getNotInvolvedSkills()
|
||||
return {}
|
||||
end
|
||||
|
||||
@ -40,22 +44,24 @@ function BattleController:loadOtherRes(callback)
|
||||
end
|
||||
|
||||
function BattleController:onLinkChange()
|
||||
for posId, entity in pairs(DataManager.BattleData:getGridEnties()) do
|
||||
for posId, entity in pairs(self.battleData:getGridEnties()) do
|
||||
if entity:getCell() then
|
||||
entity:getCell():showHighLight(false)
|
||||
end
|
||||
end
|
||||
|
||||
local sequence = DataManager.BattleData:getGridSequence()
|
||||
local sequence = self.battleData:getGridSequence()
|
||||
local elementTypeMap = {}
|
||||
local posIdMap = {}
|
||||
local mainElementType
|
||||
for _, info in ipairs(sequence) do
|
||||
posIdMap[info.posId] = true
|
||||
local entity = DataManager.BattleData:getGridEntity(info.posId)
|
||||
local entity = self.battleData:getGridEntity(info.posId)
|
||||
|
||||
if not entity:getSkillId() then
|
||||
local elementType = entity:getElementType()
|
||||
elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1
|
||||
mainElementType = elementType
|
||||
end
|
||||
|
||||
if entity:getCell() then
|
||||
@ -63,10 +69,10 @@ function BattleController:onLinkChange()
|
||||
end
|
||||
end
|
||||
|
||||
for posId, _ in pairs(DataManager.BattleData:getSkillInfluenceGrids()) do
|
||||
for posId, _ in pairs(self.battleData:getSkillInfluenceGrids()) do
|
||||
if not posIdMap[posId] then
|
||||
posIdMap[posId] = true
|
||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||
local entity = self.battleData:getGridEntity(posId)
|
||||
if not entity:getSkillId() then
|
||||
local elementType = entity:getElementType()
|
||||
elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1
|
||||
@ -81,17 +87,21 @@ function BattleController:onLinkChange()
|
||||
self.battleUI:refreshSkill(elementTypeMap)
|
||||
Logger.logHighlight("---------onLinkChange--------------")
|
||||
Logger.printTable(elementTypeMap)
|
||||
if mainElementType then
|
||||
Logger.logHighlight("mainElementType " .. mainElementType)
|
||||
end
|
||||
end
|
||||
|
||||
-- *************各个子模块的战斗需要重写的方法 END*************
|
||||
|
||||
function BattleController:ctor()
|
||||
|
||||
self.battleData = DataManager.BattleData
|
||||
end
|
||||
|
||||
function BattleController:init(params)
|
||||
params = params or {}
|
||||
DataManager.BattleData:init(self:getInitBoard())
|
||||
self.chapterId = self:getChapterId()
|
||||
self.battleData:init()
|
||||
BattleHelper:init()
|
||||
self:prepareFight()
|
||||
end
|
||||
@ -110,6 +120,7 @@ function BattleController:prepareFight()
|
||||
self.battleUI:setController(self)
|
||||
self.battleUI:addLoadUICompleteListener(function()
|
||||
self:initAllUnits(onPreloadFinished)
|
||||
self:generateBoard()
|
||||
end)
|
||||
self:loadOtherRes(onPreloadFinished)
|
||||
end
|
||||
@ -117,7 +128,7 @@ end
|
||||
function BattleController:initAllUnits(callback)
|
||||
self.atkUnits = {}
|
||||
self.defUnits = {}
|
||||
local atkTeam = DataManager.BattleData:getAtkTeam()
|
||||
local atkTeam = self.battleData:getAtkTeam()
|
||||
local count = 0
|
||||
local totalCount = atkTeam:getMembersCount()
|
||||
local function onloadFinished()
|
||||
@ -148,23 +159,23 @@ function BattleController:onLoadComplete()
|
||||
end
|
||||
|
||||
function BattleController:onTouchEvent(eventType, posId)
|
||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||
local entity = self.battleData:getGridEntity(posId)
|
||||
if not entity:canLink() then
|
||||
return
|
||||
end
|
||||
|
||||
if eventType == ELIMINATION_TOUCH_EVENT.DOWN then
|
||||
if #DataManager.BattleData:getGridSequence() > 0 then
|
||||
DataManager.BattleData:clearGridSequence()
|
||||
if #self.battleData:getGridSequence() > 0 then
|
||||
self.battleData:clearGridSequence()
|
||||
end
|
||||
DataManager.BattleData:insertGridSequence(posId, self:snapshotBoard())
|
||||
local skillEntity = DataManager.BattleData:getSkillEntityBySkillId(entity:getSkillId())
|
||||
self.battleData:insertGridSequence(posId, self:snapshotBoard())
|
||||
local skillEntity = self.battleData:getSkillEntityBySkillId(entity:getSkillId())
|
||||
local maskElementType = entity:getElementType(skillEntity)
|
||||
self.battleUI:showBoardMask(maskElementType)
|
||||
self:findSkillInfluenceGrids()
|
||||
self:onLinkChange()
|
||||
elseif eventType == ELIMINATION_TOUCH_EVENT.ENTER then
|
||||
local sequence = DataManager.BattleData:getGridSequence()
|
||||
local sequence = self.battleData:getGridSequence()
|
||||
local info = sequence[#sequence]
|
||||
local lastPosId = info and info.posId
|
||||
if not lastPosId then
|
||||
@ -175,25 +186,25 @@ function BattleController:onTouchEvent(eventType, posId)
|
||||
return
|
||||
end
|
||||
|
||||
if DataManager.BattleData:alreadyInsertSequence(posId) then
|
||||
if self.battleData:alreadyInsertSequence(posId) then
|
||||
local info = sequence[#sequence - 1]
|
||||
local beforePosId = info and info.posId
|
||||
if not beforePosId then
|
||||
return
|
||||
end
|
||||
if beforePosId == posId then -- 进入的是倒数第二个,则移除倒数第一个
|
||||
local snapshot = DataManager.BattleData:removeGridSequence(lastPosId)
|
||||
local snapshot = self.battleData:removeGridSequence(lastPosId)
|
||||
if snapshot then -- 如果有快照,则恢复一次
|
||||
for posId, info in pairs(snapshot) do
|
||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||
local entity = self.battleData:getGridEntity(posId)
|
||||
if entity then
|
||||
entity:setInfoBySnapshop(info)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local lastEntity = DataManager.BattleData:getGridEntity(beforePosId)
|
||||
local lastSkillEntity = DataManager.BattleData:getSkillEntityBySkillId(lastEntity:getSkillId())
|
||||
local lastEntity = self.battleData:getGridEntity(beforePosId)
|
||||
local lastSkillEntity = self.battleData:getSkillEntityBySkillId(lastEntity:getSkillId())
|
||||
local maskElementType = lastEntity:getElementType(lastSkillEntity)
|
||||
self.battleUI:showBoardMask(maskElementType)
|
||||
|
||||
@ -204,15 +215,15 @@ function BattleController:onTouchEvent(eventType, posId)
|
||||
end
|
||||
|
||||
local skillId = entity:getSkillId()
|
||||
local skillEntity = DataManager.BattleData:getSkillEntityBySkillId(skillId)
|
||||
local skillEntity = self.battleData:getSkillEntityBySkillId(skillId)
|
||||
local elementType = entity:getElementType(skillEntity)
|
||||
|
||||
local lastEntity = DataManager.BattleData:getGridEntity(lastPosId)
|
||||
local lastEntity = self.battleData:getGridEntity(lastPosId)
|
||||
local lastSkillId = lastEntity:getSkillId()
|
||||
local lastSkillEntity = DataManager.BattleData:getSkillEntityBySkillId(lastSkillId)
|
||||
local lastSkillEntity = self.battleData:getSkillEntityBySkillId(lastSkillId)
|
||||
local lastElementType = lastEntity:getElementType(lastSkillEntity)
|
||||
|
||||
if skillEntity and DataManager.BattleData:getSequenceHadSkill() then
|
||||
if skillEntity and self.battleData:getSequenceHadSkill() then
|
||||
return
|
||||
end
|
||||
|
||||
@ -226,7 +237,7 @@ function BattleController:onTouchEvent(eventType, posId)
|
||||
local maskElementType = elementType or lastElementType
|
||||
self.battleUI:showBoardMask(maskElementType)
|
||||
|
||||
DataManager.BattleData:insertGridSequence(posId, self:snapshotBoard())
|
||||
self.battleData:insertGridSequence(posId, self:snapshotBoard())
|
||||
if lastEntity:getNeedChangePos() and not entity:getNeedChangePos() then -- 需要移动到队列末尾
|
||||
local lastSkillId = lastEntity:getSkillId()
|
||||
local skillId = entity:getSkillId()
|
||||
@ -248,26 +259,26 @@ function BattleController:onTouchEvent(eventType, posId)
|
||||
|
||||
else -- 取消和抬起
|
||||
self.battleUI:showBoardMask(nil)
|
||||
local sequence = DataManager.BattleData:getGridSequence()
|
||||
local sequence = self.battleData:getGridSequence()
|
||||
local count = #sequence
|
||||
if count < BattleConst.ELIMINATION_MIN_COUNT then
|
||||
if count <= 0 then
|
||||
DataManager.BattleData:clearGridSequence()
|
||||
self.battleData:clearGridSequence()
|
||||
self:onLinkChange()
|
||||
return
|
||||
end
|
||||
|
||||
local snapshot = DataManager.BattleData:removeGridSequence(sequence[1].posId)
|
||||
local snapshot = self.battleData:removeGridSequence(sequence[1].posId)
|
||||
if snapshot then -- 如果有快照,则恢复一次
|
||||
for posId, info in pairs(snapshot) do
|
||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||
local entity = self.battleData:getGridEntity(posId)
|
||||
if entity then
|
||||
entity:setInfoBySnapshop(info)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
DataManager.BattleData:clearGridSequence()
|
||||
self.battleData:clearGridSequence()
|
||||
self:onLinkChange()
|
||||
return
|
||||
end
|
||||
@ -277,18 +288,18 @@ function BattleController:onTouchEvent(eventType, posId)
|
||||
end
|
||||
|
||||
function BattleController:onLinkOver()
|
||||
local sequence = DataManager.BattleData:getGridSequence()
|
||||
local sequence = self.battleData:getGridSequence()
|
||||
local count = #sequence
|
||||
if count < BattleConst.ELIMINATION_MIN_COUNT then
|
||||
return
|
||||
end
|
||||
|
||||
local skillId = DataManager.BattleData:getSequenceHadSkill()
|
||||
local skillId = self.battleData:getSequenceHadSkill()
|
||||
local skillEntity
|
||||
local linkElementType
|
||||
local influenceElementType
|
||||
if skillId then
|
||||
skillEntity = DataManager.BattleData:getSkillEntityBySkillId(skillId)
|
||||
skillEntity = self.battleData:getSkillEntityBySkillId(skillId)
|
||||
end
|
||||
|
||||
local elementTypeMap = {}
|
||||
@ -297,7 +308,7 @@ function BattleController:onLinkOver()
|
||||
|
||||
for _, info in ipairs(sequence) do
|
||||
if not eliminationPosIds[info.posId] then
|
||||
local entity = DataManager.BattleData:getGridEntity(info.posId)
|
||||
local entity = self.battleData:getGridEntity(info.posId)
|
||||
if not entity:getSkillId() then
|
||||
local elementType = entity:getElementType()
|
||||
elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1
|
||||
@ -309,14 +320,14 @@ function BattleController:onLinkOver()
|
||||
boomGridIds[aroundPosId] = true
|
||||
end
|
||||
|
||||
local entity = DataManager.BattleData:getGridEntity(info.posId)
|
||||
local entity = self.battleData:getGridEntity(info.posId)
|
||||
entity:setIsIdle(true)
|
||||
eliminationPosIds[info.posId] = true
|
||||
end
|
||||
end
|
||||
|
||||
for posId, _ in pairs(DataManager.BattleData:getSkillInfluenceGrids()) do
|
||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||
for posId, _ in pairs(self.battleData:getSkillInfluenceGrids()) do
|
||||
local entity = self.battleData:getGridEntity(posId)
|
||||
if not entity:getIsIdle() then
|
||||
if entity:isEmptyIdle() then
|
||||
entity:setIsIdle(true)
|
||||
@ -340,7 +351,7 @@ function BattleController:onLinkOver()
|
||||
|
||||
for posId, status in pairs(boomGridIds) do
|
||||
if not eliminationPosIds[posId] then
|
||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||
local entity = self.battleData:getGridEntity(posId)
|
||||
if entity then
|
||||
local elementTypeInvalid = entity:isElmentTypeInvalid()
|
||||
entity:addAroundEliminationCount()
|
||||
@ -356,8 +367,8 @@ function BattleController:onLinkOver()
|
||||
end
|
||||
end
|
||||
|
||||
DataManager.BattleData:addSkillEnergy(elementTypeMap)
|
||||
DataManager.BattleData:clearGridSequence()
|
||||
self.battleData:addSkillEnergy(elementTypeMap)
|
||||
self.battleData:clearGridSequence()
|
||||
|
||||
self.battleUI:disableUITouch()
|
||||
self.battleUI:eliminationAni(sequence, function()
|
||||
@ -376,7 +387,7 @@ function BattleController:fillBoard()
|
||||
for c = 1, BattleConst.COLUMN_COUNT do
|
||||
for r = BattleConst.ROW_COUNT, 1, -1 do
|
||||
local posId = ModuleManager.BattleManager:getPosId(r, c)
|
||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||
local entity = self.battleData:getGridEntity(posId)
|
||||
if entity:getIsIdle() then
|
||||
self:fillThisPos(posId, columnCount, gridMap)
|
||||
end
|
||||
@ -390,7 +401,7 @@ function BattleController:fillBoard()
|
||||
if list and list[1] then -- 此列有需要填充的元素
|
||||
local entity = table.remove(list, 1)
|
||||
if entity then
|
||||
DataManager.BattleData:setGridInfo(entity:getPosId(), self:getRandomGridInfo())
|
||||
self.battleData:setGridInfo(entity:getPosId(), self:getRandomGridInfo())
|
||||
end
|
||||
find = true
|
||||
end
|
||||
@ -405,7 +416,7 @@ function BattleController:fillBoard()
|
||||
for c = 1, BattleConst.COLUMN_COUNT do
|
||||
for r = BattleConst.ROW_COUNT, 1, -1 do
|
||||
local posId = ModuleManager.BattleManager:getPosId(r, c)
|
||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||
local entity = self.battleData:getGridEntity(posId)
|
||||
if #entity:getPath() > 0 then
|
||||
pathMap[posId] = entity:getPath()
|
||||
entity:clearPath()
|
||||
@ -506,9 +517,25 @@ function BattleController:exeInstructions(instructions, callback)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleController:generateBoard()
|
||||
local boardList, _ = self:getInitBoard()
|
||||
if self.curBoardIndex and self.curBoardIndex >= #boardList then
|
||||
return
|
||||
end
|
||||
|
||||
if not self.battleUI then
|
||||
return
|
||||
end
|
||||
|
||||
self.curBoardIndex = (self.curBoardIndex or 0) + 1
|
||||
local board = boardList[self.curBoardIndex]
|
||||
self.battleData:refreshBoard(board)
|
||||
self.battleUI:initGridCell()
|
||||
end
|
||||
|
||||
function BattleController:generateSkill()
|
||||
local map = {}
|
||||
for _, skillEntity in pairs(DataManager.BattleData:getSkillEntities()) do
|
||||
for _, skillEntity in pairs(self.battleData:getSkillEntities()) do
|
||||
if skillEntity:getEnergyEnough() then
|
||||
map[skillEntity:getPosition()] = skillEntity:getSkillId()
|
||||
end
|
||||
@ -517,7 +544,7 @@ function BattleController:generateSkill()
|
||||
for elementType, skillId in pairs(map) do
|
||||
local list = self:getSkillElementList(elementType, 1, true)
|
||||
for _, posId in ipairs(list) do
|
||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||
local entity = self.battleData:getGridEntity(posId)
|
||||
if entity then
|
||||
entity:setSkilId(skillId)
|
||||
if entity:getElementType() ~= elementType then
|
||||
@ -535,7 +562,7 @@ function BattleController:generateGridType(gridType)
|
||||
|
||||
local list = {}
|
||||
local count = 0
|
||||
for posId, entity in pairs(DataManager.BattleData:getGridEnties()) do
|
||||
for posId, entity in pairs(self.battleData:getGridEnties()) do
|
||||
if entity:isEmptyIdle() then
|
||||
table.insert(list, entity)
|
||||
count = count + 1
|
||||
@ -543,13 +570,13 @@ function BattleController:generateGridType(gridType)
|
||||
end
|
||||
if count > 0 then
|
||||
local entity = list[math.random(1, count)]
|
||||
DataManager.BattleData:setGridInfo(entity:getPosId(), {gridType = gridType, elementType = entity:getElementType()})
|
||||
self.battleData:setGridInfo(entity:getPosId(), {gridType = gridType, elementType = entity:getElementType()})
|
||||
end
|
||||
end
|
||||
|
||||
function BattleController:getSkillElementList(elementType, count, useAlternate)
|
||||
local result = {}
|
||||
local gridEntities = DataManager.BattleData:getGridEnties()
|
||||
local gridEntities = self.battleData:getGridEnties()
|
||||
if not gridEntities then
|
||||
return result
|
||||
end
|
||||
@ -610,7 +637,7 @@ end
|
||||
|
||||
---- 从一个点直接遍历所有相关的路径
|
||||
function BattleController:fillThisPos(posId, columnCount, gridMap)
|
||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||
local entity = self.battleData:getGridEntity(posId)
|
||||
if not entity or not entity:getIsIdle() then
|
||||
return
|
||||
end
|
||||
@ -625,7 +652,7 @@ function BattleController:fillThisPos(posId, columnCount, gridMap)
|
||||
columnCount[c] = columnCount[c] + 1
|
||||
|
||||
local fallPosId = posId
|
||||
local fallEntity = DataManager.BattleData:getGridEntity(fallPosId)
|
||||
local fallEntity = self.battleData:getGridEntity(fallPosId)
|
||||
if not fallEntity then -- 异常情况,理论上不可能不存在
|
||||
return
|
||||
end
|
||||
@ -640,14 +667,14 @@ function BattleController:fillThisPos(posId, columnCount, gridMap)
|
||||
local curPos = ModuleManager.BattleManager:getPosInfo(posId)
|
||||
fallEntity:addPath({x = curPos.x, y = curPos.y})
|
||||
|
||||
DataManager.BattleData:exchangeGridEntities(posId, fallPosId)
|
||||
self.battleData:exchangeGridEntities(posId, fallPosId)
|
||||
if not gridMap[c] then
|
||||
gridMap[c] = {}
|
||||
end
|
||||
table.insert(gridMap[c], fallEntity)
|
||||
else
|
||||
for index, fallPosId in ipairs(list) do
|
||||
local fallEntity = DataManager.BattleData:getGridEntity(fallPosId)
|
||||
local fallEntity = self.battleData:getGridEntity(fallPosId)
|
||||
if not fallEntity then -- 异常情况,理论上不可能不存在
|
||||
return
|
||||
end
|
||||
@ -656,7 +683,7 @@ function BattleController:fillThisPos(posId, columnCount, gridMap)
|
||||
if fallEntity:getIsIdle() then
|
||||
self:fillThisPos(fallPosId, columnCount, gridMap)
|
||||
end
|
||||
fallEntity = DataManager.BattleData:getGridEntity(fallPosId)
|
||||
fallEntity = self.battleData:getGridEntity(fallPosId)
|
||||
if not fallEntity:getIsIdle() then
|
||||
if not fallEntity:getPath()[1] then
|
||||
local curPos = ModuleManager.BattleManager:getPosInfo(fallPosId)
|
||||
@ -666,7 +693,7 @@ function BattleController:fillThisPos(posId, columnCount, gridMap)
|
||||
local curPos = ModuleManager.BattleManager:getPosInfo(posId)
|
||||
fallEntity:addPath({x = curPos.x, y = curPos.y})
|
||||
|
||||
DataManager.BattleData:exchangeGridEntities(posId, fallPosId)
|
||||
self.battleData:exchangeGridEntities(posId, fallPosId)
|
||||
self:fillThisPos(fallPosId, columnCount, gridMap)
|
||||
return
|
||||
end
|
||||
@ -677,19 +704,15 @@ function BattleController:fillThisPos(posId, columnCount, gridMap)
|
||||
end
|
||||
|
||||
function BattleController:getRandomGridInfo()
|
||||
if not self.fixedRandomList then
|
||||
self.fixedRandomList = {}
|
||||
for _, elementType in ipairs(self:getFixedRandomGrid()) do
|
||||
table.insert(self.fixedRandomList, elementType)
|
||||
end
|
||||
end
|
||||
local list, fixedRandomGrid = self:getInitBoard()
|
||||
local fixedRandomList = fixedRandomGrid[self.curBoardIndex]
|
||||
|
||||
local gridType = 0
|
||||
local elementType
|
||||
if self.fixedRandomList[1] then
|
||||
elementType = table.remove(self.fixedRandomList, 1)
|
||||
if fixedRandomList and fixedRandomList[1] then
|
||||
elementType = table.remove(fixedRandomList, 1)
|
||||
else
|
||||
local map = DataManager.BattleData:getElementTypeMap()
|
||||
local map = self.battleData:getElementTypeMap()
|
||||
local indexs = {}
|
||||
local typeList = {}
|
||||
for typeName, typeNum in pairs(BattleConst.ELEMENT_TYPE) do
|
||||
@ -711,20 +734,20 @@ function BattleController:getRandomGridInfo()
|
||||
end
|
||||
|
||||
function BattleController:findSkillInfluenceGrids()
|
||||
local girds = DataManager.BattleData:clearSkillInfluenceGrids()
|
||||
local girds = self.battleData:clearSkillInfluenceGrids()
|
||||
for posId, _ in pairs(girds) do
|
||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||
local entity = self.battleData:getGridEntity(posId)
|
||||
entity:setNeedElimination(false)
|
||||
end
|
||||
|
||||
local sequence = DataManager.BattleData:getGridSequence()
|
||||
local sequence = self.battleData:getGridSequence()
|
||||
for _, info in ipairs(sequence) do
|
||||
local entity = DataManager.BattleData:getGridEntity(info.posId)
|
||||
local entity = self.battleData:getGridEntity(info.posId)
|
||||
local skillId = entity:getSkillId()
|
||||
if skillId then
|
||||
local skillEntity = DataManager.BattleData:getSkillEntityBySkillId(skillId)
|
||||
local skillEntity = self.battleData:getSkillEntityBySkillId(skillId)
|
||||
if skillEntity then
|
||||
BATTLE_BOARD_SKILL_HANDLE.activeBoardSkill(info.posId, skillEntity, DataManager.BattleData:getGridEnties())
|
||||
BATTLE_BOARD_SKILL_HANDLE.activeBoardSkill(info.posId, skillEntity, self.battleData:getGridEnties())
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -734,7 +757,7 @@ function BattleController:getRandomSkillList(getCount)
|
||||
getCount = getCount or BattleConst.SKILL_SELECT_COUNT
|
||||
local result = {}
|
||||
local cfg = ConfigManager:getConfig("skill_rogue")
|
||||
local skillPool = DataManager.BattleData:getSkillPool()
|
||||
local skillPool = self.battleData:getSkillPool()
|
||||
local map = {}
|
||||
|
||||
local count = 0
|
||||
@ -742,7 +765,7 @@ function BattleController:getRandomSkillList(getCount)
|
||||
local skillWeight = {}
|
||||
for _, skillId in ipairs(skillPool) do
|
||||
local skillCfg = cfg[skillId]
|
||||
if skillCfg and not skillCfg.limit_times or DataManager.BattleData:getSkillCount(skillId) < skillCfg.limit_times then
|
||||
if skillCfg and not skillCfg.limit_times or self.battleData:getSkillCount(skillId) < skillCfg.limit_times then
|
||||
if not map[skillId] then
|
||||
table.insert(newSkillPool, skillId)
|
||||
table.insert(skillWeight, skillCfg.weight)
|
||||
@ -762,12 +785,14 @@ function BattleController:getRandomSkillList(getCount)
|
||||
end
|
||||
|
||||
for skillId, info in ipairs(cfg) do
|
||||
if info.universal then
|
||||
if not info.limit_times or DataManager.BattleData:getSkillCount(skillId) < info.limit_times then
|
||||
if not map[skillId] then
|
||||
table.insert(newSkillPool, skillId)
|
||||
table.insert(skillWeight, info.weight)
|
||||
count = count + 1
|
||||
if not self:getNotInvolvedSkills()[skillId] then
|
||||
if info.universal then
|
||||
if not info.limit_times or self.battleData:getSkillCount(skillId) < info.limit_times then
|
||||
if not map[skillId] then
|
||||
table.insert(newSkillPool, skillId)
|
||||
table.insert(skillWeight, info.weight)
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -786,13 +811,13 @@ function BattleController:getRandomSkillList(getCount)
|
||||
end
|
||||
|
||||
function BattleController:onSelectSkill(skillId)
|
||||
DataManager.BattleData:addSkillCount(skillId)
|
||||
BATTLE_ROGUE_SKILL_HANDLE.takeEffect(skillId, DataManager.BattleData, self)
|
||||
self.battleData:addSkillCount(skillId)
|
||||
BATTLE_ROGUE_SKILL_HANDLE.takeEffect(skillId, self.battleData, self)
|
||||
end
|
||||
|
||||
function BattleController:changeElementType(count, elementType)
|
||||
local list = {}
|
||||
for _, entity in pairs(DataManager.BattleData:getGridEnties()) do
|
||||
for _, entity in pairs(self.battleData:getGridEnties()) do
|
||||
if entity:canChangeInfo() and entity:getElementType() ~= elementType then
|
||||
table.insert(list, entity)
|
||||
end
|
||||
@ -849,7 +874,7 @@ end
|
||||
---- 快照一次棋盘
|
||||
function BattleController:snapshotBoard()
|
||||
local snapshot = {}
|
||||
for _, entity in pairs(DataManager.BattleData:getGridEnties()) do
|
||||
for _, entity in pairs(self.battleData:getGridEnties()) do
|
||||
snapshot[entity:getPosId()] = entity:getSnapshoptInfo()
|
||||
end
|
||||
return snapshot
|
||||
|
||||
@ -1,20 +1,32 @@
|
||||
local BattleController = require "app/module/battle/controller/battle_controller"
|
||||
local BattleControllerStage = class("BattleControllerStage", BattleController)
|
||||
|
||||
function BattleControllerStage:getInitBoard()
|
||||
local config = ConfigManager:getConfig("chapter")[1]
|
||||
return config.board
|
||||
function BattleController:getChapterId()
|
||||
return 1 -- 临时
|
||||
end
|
||||
|
||||
function BattleControllerStage:getFixedRandomGrid()
|
||||
local config = ConfigManager:getConfig("chapter")[1]
|
||||
return config.control_element
|
||||
function BattleControllerStage:getInitBoard()
|
||||
if not self.boradList then
|
||||
self.boradList = {}
|
||||
self.fixedRandomGrid = {}
|
||||
local config = ConfigManager:getConfig("chapter")[self.chapterId]
|
||||
local boardCfg = ConfigManager:getConfig("chapter_board")
|
||||
for _, boardId in ipairs(config.board) do
|
||||
local cfg = boardCfg[boardId]
|
||||
if cfg then
|
||||
table.insert(self.boradList, GFunc.getTable(cfg.board))
|
||||
table.insert(self.fixedRandomGrid, GFunc.getTable(cfg.control_element))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return self.boradList, self.fixedRandomGrid
|
||||
end
|
||||
|
||||
function BattleControllerStage:getSealElementType()
|
||||
if not self.sealElementType then
|
||||
self.sealElementType = {}
|
||||
local config = ConfigManager:getConfig("chapter")[1]
|
||||
local config = ConfigManager:getConfig("chapter")[self.chapterId]
|
||||
if config.seal_element then
|
||||
for _, elementType in ipairs(config.seal_element) do
|
||||
self.sealElementType[elementType] = true
|
||||
@ -25,4 +37,18 @@ function BattleControllerStage:getSealElementType()
|
||||
return self.sealElementType
|
||||
end
|
||||
|
||||
function BattleControllerStage:getNotInvolvedSkills()
|
||||
if not self.notInvolvedSkills then
|
||||
self.notInvolvedSkills = {}
|
||||
local config = ConfigManager:getConfig("chapter")[self.chapterId]
|
||||
if config.not_involved_skill then
|
||||
for _, skillId in ipairs(config.not_involved_skill) do
|
||||
self.notInvolvedSkills[skillId] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return self.notInvolvedSkills
|
||||
end
|
||||
|
||||
return BattleControllerStage
|
||||
@ -23,7 +23,8 @@ end
|
||||
function BattleUI:_display()
|
||||
local uiMap = self.root:genAllChildren()
|
||||
self.boardMask2D = uiMap["battle_ui.bg_2.board_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_RECT_MASK_2D)
|
||||
self:initGridCell()
|
||||
self.boardMask = uiMap["battle_ui.bg_2.board_mask"]
|
||||
self.boardMask:setVisible(false)
|
||||
self:initSkill()
|
||||
self:initBattlefield()
|
||||
end
|
||||
@ -31,7 +32,16 @@ end
|
||||
function BattleUI:_addListeners()
|
||||
local uiMap = self.root:genAllChildren()
|
||||
uiMap["battle_ui.close_btn"]:addClickListener(function()
|
||||
ModuleManager.BattleManager:endBattleAndExit()
|
||||
local params = {
|
||||
content = I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_1),
|
||||
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL,
|
||||
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
||||
cancelText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_CANCEL),
|
||||
okFunc = function()
|
||||
ModuleManager.BattleManager:endBattleAndExit()
|
||||
end,
|
||||
}
|
||||
GFunc.showMessageBox(params)
|
||||
end)
|
||||
end
|
||||
|
||||
@ -171,6 +181,8 @@ function BattleUI:eliminationAni(sequence, callback)
|
||||
return
|
||||
end
|
||||
|
||||
self.boardMask:setVisible(true)
|
||||
self.boardMask:getTransform():SetAsLastSibling()
|
||||
if self.eliminationAniSeq then
|
||||
self.eliminationAniSeq:Kill()
|
||||
self.eliminationAniSeq = nil
|
||||
@ -216,6 +228,7 @@ function BattleUI:eliminationAni(sequence, callback)
|
||||
callback()
|
||||
end
|
||||
|
||||
self.boardMask:setVisible(false)
|
||||
self:refreshSkill()
|
||||
end)
|
||||
end
|
||||
|
||||
@ -76,7 +76,7 @@ function MessageBox:showMessageBox(params)
|
||||
prefabObject._closeByAndroidBackspace = true
|
||||
end
|
||||
uiMap["message_box.title_bg_img.ok_btn"]:setVisible(true)
|
||||
uiMap["message_box.title_bg_img.ok_btn"]:setAnchoredPositionX(139)
|
||||
uiMap["message_box.title_bg_img.ok_btn"]:setAnchoredPositionX(-124)
|
||||
uiMap["message_box.title_bg_img.cancel_btn"]:setVisible(true)
|
||||
uiMap["message_box.title_bg_img.cancel_btn"]:addClickListener(function()
|
||||
self:closeAndClear(prefabObject, uiMap)
|
||||
|
||||
@ -10,11 +10,32 @@ local BATTLE_BOARD_SKILL_ENTITY = require "app/userdata/battle/skill/battle_bora
|
||||
local ATTR_TYPE = GConst.ATTR_TYPE
|
||||
local DEFAULT_FACTOR = BattleConst.DEFAULT_FACTOR
|
||||
|
||||
function BattleData:init(board, skillIds, skillPool)
|
||||
function BattleData:init(skillIds, skillPool)
|
||||
self:clear()
|
||||
self.atkTeam = self:initTeam(BattleConst.SIDE_ATK)
|
||||
self.defTeam = self:initTeam(BattleConst.SIDE_DEF)
|
||||
|
||||
--- todo
|
||||
skillIds = {
|
||||
10, 21, 30, 40, 50
|
||||
}
|
||||
for _, skillId in ipairs(skillIds) do
|
||||
local cfg = SKILL_HERO_CFG[skillId]
|
||||
self.skillMap[cfg.position] = BATTLE_BOARD_SKILL_ENTITY:create(skillId)
|
||||
end
|
||||
|
||||
---- skillPool
|
||||
self.skillPool = skillPool or {}
|
||||
|
||||
for id, info in pairs(ConfigManager:getConfig("skill_rogue")) do
|
||||
if not info.universal then
|
||||
table.insert(self.skillPool, id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function BattleData:refreshBoard(board)
|
||||
self.elementTypeMap = {}
|
||||
for i, info in ipairs(board) do
|
||||
local r = 1
|
||||
local c = 1
|
||||
@ -34,29 +55,16 @@ function BattleData:init(board, skillIds, skillPool)
|
||||
gridType = info[1],
|
||||
elementType = info[2]
|
||||
}
|
||||
self.gridEntities[data.posId] = BATTLE_GRID_ENTITY:create(data)
|
||||
if self.gridEntities[data.posId] then
|
||||
self.gridEntities[data.posId]:setGridType(data.gridType)
|
||||
self.gridEntities[data.posId]:setElementType(data.elementType)
|
||||
else
|
||||
self.gridEntities[data.posId] = BATTLE_GRID_ENTITY:create(data)
|
||||
end
|
||||
if self.gridEntities[data.posId]:canLink() then
|
||||
self.elementTypeMap[data.elementType] = (self.elementTypeMap[data.elementType] or 0) + 1
|
||||
end
|
||||
end
|
||||
|
||||
--- todo
|
||||
skillIds = {
|
||||
10, 21, 30, 40, 50
|
||||
}
|
||||
for _, skillId in ipairs(skillIds) do
|
||||
local cfg = SKILL_HERO_CFG[skillId]
|
||||
self.skillMap[cfg.position] = BATTLE_BOARD_SKILL_ENTITY:create(skillId)
|
||||
end
|
||||
|
||||
---- skillPool
|
||||
self.skillPool = skillPool or {}
|
||||
|
||||
for id, info in pairs(ConfigManager:getConfig("skill_rogue")) do
|
||||
if not info.universal then
|
||||
table.insert(self.skillPool, id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function BattleData:clear()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user