merge
This commit is contained in:
commit
b5f765f74c
@ -116,7 +116,9 @@ BIReport.RUNE_OPT_TYPE = {
|
||||
|
||||
BIReport.ITEM_GET_TYPE = {
|
||||
NEW_PLAYER_INITIAL = "NewPlayerInitial", -- 新玩家创号自带
|
||||
UPGRADE_HERO = "UpgradeHero"
|
||||
UPGRADE_HERO = "UpgradeHero",
|
||||
FIGHT_END = "FightEnd",
|
||||
CHAPTER_BOX = "ChapterBox"
|
||||
}
|
||||
|
||||
BIReport.ADS_CLICK_TYPE = {
|
||||
|
||||
@ -13,6 +13,7 @@ local MODULE_PATHS = {
|
||||
BattleManager = "app/module/battle/battle_manager",
|
||||
FormationManager = "app/module/formation/formation_manager",
|
||||
HeroManager = "app/module/hero/hero_manager",
|
||||
ChapterManager = "app/module/chapter/chapter_manager",
|
||||
}
|
||||
|
||||
-- 这里的key对应func_open里的id
|
||||
|
||||
@ -199,13 +199,24 @@ local chapter_board = {
|
||||
}
|
||||
},
|
||||
["control_element"]={
|
||||
3,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
5
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
}
|
||||
},
|
||||
[2]={
|
||||
@ -619,10 +630,15 @@ local chapter_board = {
|
||||
}
|
||||
},
|
||||
["control_element"]={
|
||||
3,
|
||||
1,
|
||||
5,
|
||||
3
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
}
|
||||
},
|
||||
[4]={
|
||||
|
||||
@ -25,6 +25,10 @@ local LocalizationGlobalConst =
|
||||
HERO_DESC_5 = "HERO_DESC_5",
|
||||
HERO_DESC_6 = "HERO_DESC_6",
|
||||
HERO_DESC_7 = "HERO_DESC_7",
|
||||
|
||||
REWARD_PREVIEW_DESC = "REWARD_PREVIEW_DESC",
|
||||
HERO_DESC_8 = "HERO_DESC_8",
|
||||
HERO_DESC_9 = "HERO_DESC_9",
|
||||
}
|
||||
|
||||
return LocalizationGlobalConst
|
||||
@ -1,7 +1,7 @@
|
||||
local monster_chapter = {
|
||||
[101]={
|
||||
["monster_base"]=10001,
|
||||
["hp"]=10000000,
|
||||
["hp"]=10000,
|
||||
["atk"]=10000,
|
||||
["atk_times"]=2,
|
||||
["hurt_skill"]=100001,
|
||||
|
||||
@ -11,6 +11,7 @@ local localization_global =
|
||||
["BTN_TEXT_CANCEL"] = "取消",
|
||||
["BTN_TEXT_OK"] = "确定",
|
||||
["BATTLE_DESC_1"] = "是否退出战斗",
|
||||
|
||||
["ITEM_NOT_ENOUGH"] = "{0}不足",
|
||||
["START_DESC"] = "开始",
|
||||
["ELEMENT_NAME_1"] = "红色元素",
|
||||
@ -25,6 +26,21 @@ local localization_global =
|
||||
["HERO_DESC_5"] = "激活",
|
||||
["HERO_DESC_6"] = "已解锁",
|
||||
["HERO_DESC_7"] = "未解锁",
|
||||
|
||||
["GET_REWARDS"] = "获得奖励",
|
||||
["CLICK_CLOSE_DESC"] = "点击关闭",
|
||||
["REWARD_DESC"] = "奖励",
|
||||
["CONTINUE_DESC"] = "继续",
|
||||
["BATTLE_DESC_2"] = "暂停",
|
||||
["BATTLE_DESC_3"] = "刷新",
|
||||
["BATTLE_DESC_4"] = "达到",
|
||||
["BATTLE_DESC_5"] = "胜利",
|
||||
["BATTLE_DESC_6"] = "失败",
|
||||
["BATTLE_DESC_7"] = "累计造成总伤害:<color=#89FF76>{0}</color>",
|
||||
|
||||
["REWARD_PREVIEW_DESC"] = "奖励预览",
|
||||
["HERO_DESC_8"] = "使用",
|
||||
["HERO_DESC_9"] = "信息",
|
||||
}
|
||||
|
||||
return localization_global
|
||||
@ -265,6 +265,23 @@ BattleConst.ELEMENT_ICON = {
|
||||
[BattleConst.ELEMENT_TYPE.PURPLE] = "purple_1"
|
||||
}
|
||||
|
||||
BattleConst.SKILL_ELEMENT_BG = {
|
||||
[BattleConst.ELEMENT_TYPE.RED] = "battle_skill_bg_red_1",
|
||||
[BattleConst.ELEMENT_TYPE.YELLOW] = "battle_skill_bg_yellow_1",
|
||||
[BattleConst.ELEMENT_TYPE.GREEN] = "battle_skill_bg_green_1",
|
||||
[BattleConst.ELEMENT_TYPE.BLUE] = "battle_skill_bg_blue_1",
|
||||
[BattleConst.ELEMENT_TYPE.PURPLE] = "battle_skill_bg_purple_1"
|
||||
}
|
||||
|
||||
BattleConst.SKILL_ELEMENT_BG_2 = {
|
||||
ANY = "battle_skill_bg_3",
|
||||
[BattleConst.ELEMENT_TYPE.RED] = "battle_skill_bg_red_2",
|
||||
[BattleConst.ELEMENT_TYPE.YELLOW] = "battle_skill_bg_yellow_2",
|
||||
[BattleConst.ELEMENT_TYPE.GREEN] = "battle_skill_bg_green_2",
|
||||
[BattleConst.ELEMENT_TYPE.BLUE] = "battle_skill_bg_blue_2",
|
||||
[BattleConst.ELEMENT_TYPE.PURPLE] = "battle_skill_bg_purple_2"
|
||||
}
|
||||
|
||||
BattleConst.POS_ID_2_RC = {}
|
||||
BattleConst.RC_2_POS_ID = {}
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ function BattleManager:showSelectSkillUI(skillList)
|
||||
end
|
||||
|
||||
function BattleManager:showBattleResultUI(rewards, combatReport)
|
||||
UIManager:showUI("app/ui/battle/battle_result_ui", {rewards = rewards, combatReport})
|
||||
UIManager:showUI("app/ui/battle/battle_result_ui", {rewards = rewards, combatReport = combatReport})
|
||||
end
|
||||
|
||||
function BattleManager:playBattle(battleType, params, returnFunc)
|
||||
|
||||
@ -79,24 +79,26 @@ function BattleController:onLinkChange()
|
||||
elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1
|
||||
mainElementType = elementType
|
||||
end
|
||||
end
|
||||
|
||||
for _, info in ipairs(sequence) do
|
||||
local entity = self.battleData:getGridEntity(info.posId)
|
||||
if entity:getCell() then
|
||||
entity:getCell():showHighLight(true)
|
||||
entity:getCell():showHighLight(true, mainElementType)
|
||||
end
|
||||
end
|
||||
|
||||
for posId, info in pairs(self.battleData:getSkillInfluenceGrids()) do
|
||||
local entity = self.battleData:getGridEntity(posId)
|
||||
if not posIdMap[posId] then
|
||||
if not posIdMap[posId] and info.direction ~= BattleConst.BOARD_RANGE_TYPE.RANDOM then
|
||||
posIdMap[posId] = true
|
||||
if not entity:getSkillId() then
|
||||
local elementType = entity:getElementType()
|
||||
elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1
|
||||
end
|
||||
end
|
||||
|
||||
if entity:getCell() and info.direction ~= BattleConst.BOARD_RANGE_TYPE.RANDOM then
|
||||
entity:getCell():showCircle(true)
|
||||
if entity:getCell() then
|
||||
entity:getCell():showCircle(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -156,7 +158,6 @@ function BattleController:prepareFight()
|
||||
BattleHelper:setEffectTextCache(self.battleUI:getBattleNumber())
|
||||
self:initAtkUnits(onPreloadFinished)
|
||||
self:initDefUnits(onPreloadFinished)
|
||||
self:battleStart()
|
||||
end)
|
||||
self:loadOtherRes(onPreloadFinished)
|
||||
end
|
||||
@ -236,6 +237,9 @@ function BattleController:enterNextWave()
|
||||
end
|
||||
|
||||
self.waveIndex = self.waveIndex + 1
|
||||
if self.battleUI then
|
||||
self.battleUI:refreshWave(self.waveIndex)
|
||||
end
|
||||
if self.waveIndex == 1 then -- 第一波
|
||||
self:generateBoard()
|
||||
return
|
||||
@ -280,7 +284,11 @@ function BattleController:enterAtkStepOver()
|
||||
|
||||
local defTeam = self.battleData:getDefTeam()
|
||||
if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑
|
||||
self:findNextDefUnit()
|
||||
if self.waveIndex >= self.maxWaveIndex() then
|
||||
self:enterRoundEnd()
|
||||
else
|
||||
self:enterRefreshBoard()
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
@ -311,7 +319,11 @@ function BattleController:enterDefStepOver()
|
||||
|
||||
local defTeam = self.battleData:getDefTeam()
|
||||
if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑
|
||||
self:enterRefreshBoard()
|
||||
if self.waveIndex >= self.maxWaveIndex() then
|
||||
self:enterRoundEnd()
|
||||
else
|
||||
self:enterRefreshBoard()
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
@ -619,14 +631,14 @@ function BattleController:fillBoard()
|
||||
-- local gridType = list[math.random(1, 4)]
|
||||
-- self:generateGridType(gridType)
|
||||
-- ModuleManager.BattleManager:showSelectSkillUI(self:getRandomSkillList())
|
||||
-- self:generateBoard()
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleController:onFillBoardOver()
|
||||
self:generateSkill()
|
||||
self.battleUI:refreshSkill()
|
||||
self:enterRoundEnd()
|
||||
self:generateSkill(function()
|
||||
self.battleUI:refreshSkill()
|
||||
self:enterRoundEnd()
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleController:generateInstructions(skillEntity, elementType, influenceElementType, elementTypeMap)
|
||||
@ -766,20 +778,37 @@ function BattleController:popBoardCacheSkill(callback)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleController:generateSkill()
|
||||
function BattleController:generateSkill(callback)
|
||||
local map = {}
|
||||
for _, skillEntity in pairs(self.battleData:getSkillEntities()) do
|
||||
if skillEntity:getEnergyEnough() then
|
||||
map[skillEntity:getPosition()] = skillEntity:getSkillId()
|
||||
local list = self:getSkillElementList(skillEntity:getPosition(), 1, true)
|
||||
if list[1] then
|
||||
map[skillEntity:getPosition()] =
|
||||
{
|
||||
skillId = skillEntity:getSkillId(),
|
||||
posId = list[1]
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for elementType, skillId in pairs(map) do
|
||||
local list = self:getSkillElementList(elementType, 1, true)
|
||||
for _, posId in ipairs(list) do
|
||||
self:setGridSkillId(posId, skillId)
|
||||
if not self.battleUI then
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
self.battleUI:generateSkillAni(map, function()
|
||||
for elementType, info in pairs(map) do
|
||||
self:setGridSkillId(info.posId, info.skillId)
|
||||
end
|
||||
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleController:setGridSkillId(posId, skillId)
|
||||
@ -1011,7 +1040,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 self.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)
|
||||
@ -1093,7 +1122,6 @@ function BattleController:addHeroAttr(attrName, value)
|
||||
-- elseif attrName == then
|
||||
-- -- body
|
||||
-- else
|
||||
|
||||
-- end
|
||||
end
|
||||
|
||||
@ -1126,6 +1154,13 @@ function BattleController:snapshotBoard()
|
||||
return snapshot
|
||||
end
|
||||
|
||||
function BattleController:addBattleExp(exp)
|
||||
if not self.battleData or not exp then
|
||||
return
|
||||
end
|
||||
self.battleData:addExp(exp)
|
||||
end
|
||||
|
||||
function BattleController:_tick(dt)
|
||||
if self.isPause then
|
||||
return
|
||||
|
||||
@ -83,7 +83,22 @@ function BattleControllerStage:findNextDefUnit()
|
||||
end
|
||||
|
||||
function BattleControllerStage:controllBattleEnd()
|
||||
|
||||
self.combatReport = {
|
||||
battleType = GConst.BattleConst.BATTLE_TYPE.STAGE,
|
||||
wave = self.waveIndex,
|
||||
victory = self.victory,
|
||||
atkReport = {
|
||||
{
|
||||
heroId = 12001,
|
||||
dmg = 237800,
|
||||
},
|
||||
{
|
||||
heroId = 12001,
|
||||
dmg = 23700,
|
||||
}
|
||||
}
|
||||
}
|
||||
ModuleManager.ChapterManager:endFight(self.chapterId, self.combatReport)
|
||||
end
|
||||
|
||||
return BattleControllerStage
|
||||
@ -183,6 +183,34 @@ local _addSkillInInfluenceAtkp = function(skillInfo, battleData, battleControlle
|
||||
end
|
||||
end
|
||||
|
||||
local _addSkillGeneralAttackEffect = function(skillInfo, battleData, battleController)
|
||||
local elementType = skillInfo.skill_position
|
||||
if not elementType or not skillInfo.effect then
|
||||
return
|
||||
end
|
||||
|
||||
local entity = battleData:getSkillEntityByElement(elementType)
|
||||
if entity then
|
||||
for _, effect in ipairs(skillInfo.effect) do
|
||||
entity:addGeneralAttackEffect(effect)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local _addSkillElementCountEffect = function(skillInfo, battleData, battleController)
|
||||
local elementType = skillInfo.skill_position
|
||||
if not elementType or not skillInfo.effect then
|
||||
return
|
||||
end
|
||||
|
||||
local entity = battleData:getSkillEntityByElement(elementType)
|
||||
if entity then
|
||||
for _, effect in ipairs(skillInfo.effect) do
|
||||
entity:addElementCountEffect(effect)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
BattleRogueSkillHandle._effectOn = {
|
||||
[1] = _changeBaseSkill, -- 改变初始技能ID
|
||||
[2] = _addEliminationRange, -- 增加消除数量
|
||||
@ -195,6 +223,8 @@ BattleRogueSkillHandle._effectOn = {
|
||||
[9] = _addSkillEffect, -- 获得技能效果
|
||||
[10] = _changeElementType, -- 将场上随机几个元素变为某元素
|
||||
[11] = _addSkillInInfluenceAtkp, -- 技能消除的增加伤害
|
||||
[12] = _addSkillGeneralAttackEffect, -- 技能链接中的每一个元素,都触发的技能效果
|
||||
[11] = _addSkillElementCountEffect, -- 技能链接中每一个元素累加的技能效果
|
||||
}
|
||||
|
||||
function BattleRogueSkillHandle.takeEffect(skillId, battleData, battleController)
|
||||
|
||||
57
lua/app/module/chapter/chapter_manager.lua
Normal file
57
lua/app/module/chapter/chapter_manager.lua
Normal file
@ -0,0 +1,57 @@
|
||||
local ChapterManager = class("ChapterManager", BaseModule)
|
||||
|
||||
function ChapterManager:openBox(chapterId, index)
|
||||
if DataManager.ChapterData:getChapterBoxRewardGot(chapterId, index) then
|
||||
return
|
||||
end
|
||||
|
||||
local parmas = {
|
||||
id = chapterId,
|
||||
index = index,
|
||||
}
|
||||
ServerDataManager:dataOperate(GConst.ServerDataConst.DATA_OP_BEHAVIOR.OPEN_CHAPTER_BOX, parmas, function(result)
|
||||
if result.status == 0 then
|
||||
GFunc.addRewards(result.rewards, BIReport.ITEM_GET_TYPE.CHAPTER_BOX)
|
||||
GFunc.showRewardBox(result.rewards)
|
||||
DataManager.ChapterData:init(result.chapterData, true)
|
||||
DataManager.ChapterData:setDirty()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function ChapterManager:startFight()
|
||||
---- 通信
|
||||
ModuleManager.BattleManager:playBattle(GConst.BattleConst.BATTLE_TYPE.STAGE)
|
||||
end
|
||||
|
||||
function ChapterManager:endFight(id, combatReport)
|
||||
local cfg = ConfigManager:getConfig("chapter")[id]
|
||||
local rewards = {}
|
||||
for i = 1, combatReport.wave do
|
||||
for _, reward in ipairs(cfg.wave_reward) do
|
||||
table.insert(rewards, reward)
|
||||
end
|
||||
end
|
||||
|
||||
if combatReport.victory then
|
||||
for _, reward in ipairs(cfg.finish_reward) do
|
||||
table.insert(rewards, reward)
|
||||
end
|
||||
end
|
||||
|
||||
local parmas = {
|
||||
id = id,
|
||||
combatReport = combatReport,
|
||||
rewards = GFunc.mergeRewards(rewards)
|
||||
}
|
||||
ServerDataManager:dataOperate(GConst.ServerDataConst.DATA_OP_BEHAVIOR.END_FIGHT, parmas, function(result)
|
||||
if result.status == 0 then
|
||||
GFunc.addRewards(result.rewards, BIReport.ITEM_GET_TYPE.FIGHT_END)
|
||||
ModuleManager.BattleManager:showBattleResultUI(result.rewards, combatReport)
|
||||
DataManager.ChapterData:init(result.chapterData, true)
|
||||
DataManager.ChapterData:setDirty()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
return ChapterManager
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02d214b08c9e8e249af651ea321569bd
|
||||
guid: 1acc2358f0b9a1d48a45eddba4729b06
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
@ -55,7 +55,7 @@ end
|
||||
|
||||
function HeroManager:getSkillIcon(skillId)
|
||||
local cfg = ConfigManager:getConfig("skill")[skillId]
|
||||
return cfg and cfg.icon
|
||||
return cfg and tostring(cfg.icon)
|
||||
end
|
||||
|
||||
function HeroManager:getSkillRogueDesc(skillId)
|
||||
|
||||
@ -5,6 +5,75 @@ local MIN_CHAPTER_ID = 1
|
||||
function ServerChapterData:init(data)
|
||||
self.data.chapterId = data and data.chapterId or MIN_CHAPTER_ID
|
||||
self.data.maxChapterId = data and data.maxChapterId or (self.data.chapterId - 1)
|
||||
self.data.chapterBoxInfo = data and data.chapterBoxInfo or {}
|
||||
self.data.chapterFightInfo = data and data.chapterFightInfo or {}
|
||||
end
|
||||
|
||||
function ServerChapterData:fightChapter(id, victory, wave)
|
||||
local idStr = tostring(id)
|
||||
if not self.data.chapterFightInfo[idStr] then
|
||||
self.data.chapterFightInfo[idStr] = {
|
||||
victory = false,
|
||||
maxWave = 0
|
||||
}
|
||||
end
|
||||
|
||||
local passBefore = self.data.chapterFightInfo[idStr].victory
|
||||
if victory then
|
||||
self.data.chapterFightInfo[idStr].victory = victory
|
||||
end
|
||||
|
||||
if wave > self.data.chapterFightInfo[idStr].maxWave then
|
||||
self.data.chapterFightInfo[idStr].maxWave = wave
|
||||
end
|
||||
|
||||
if not passBefore and victory then
|
||||
if id > self.data.maxChapterId then
|
||||
self.data.maxChapterId = id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ServerChapterData:getChapterBoxRewardGot(chapterId, index)
|
||||
local idStr = tostring(chapterId)
|
||||
local list = self.data.chapterBoxInfo[idStr]
|
||||
if not list then
|
||||
return false
|
||||
end
|
||||
|
||||
for _, idx in ipairs(list) do
|
||||
if idx == index then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function ServerChapterData:getChapterBoxRewards(chapterId, index)
|
||||
local cfg = ConfigManager:getConfig("chapter")[chapterId]
|
||||
if not cfg then
|
||||
return
|
||||
end
|
||||
|
||||
return cfg["box_reward_" .. index]
|
||||
end
|
||||
|
||||
function ServerChapterData:openChapterBox(chapterId, index)
|
||||
local idStr = tostring(chapterId)
|
||||
local list = self.data.chapterBoxInfo[idStr]
|
||||
if not list then
|
||||
self.data.chapterBoxInfo[idStr] = {}
|
||||
else
|
||||
for _, idx in ipairs(list) do
|
||||
if idx == index then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(self.data.chapterBoxInfo[idStr], index)
|
||||
return true
|
||||
end
|
||||
|
||||
return ServerChapterData
|
||||
70
lua/app/server/manager/server_chapter_manager.lua
Normal file
70
lua/app/server/manager/server_chapter_manager.lua
Normal file
@ -0,0 +1,70 @@
|
||||
local ServerChapterManager = {}
|
||||
|
||||
function ServerChapterManager:openBox(params, callback)
|
||||
local result = {
|
||||
status = 1
|
||||
}
|
||||
if params == nil or not params.id or not params.index then
|
||||
if callback then
|
||||
callback(result)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local ServerGameData = ServerDataManager:getServerGameData()
|
||||
|
||||
if not ServerGameData.ChapterData:openChapterBox(params.id, params.index) then
|
||||
if callback then
|
||||
callback(result)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local rewards = ServerGameData.ChapterData:getChapterBoxRewards(params.id, params.index)
|
||||
result.rewards = ServerGameData:addRewards(rewards)
|
||||
result.chapterData = ServerGameData.ChapterData:getCloneData()
|
||||
result.status = 0
|
||||
|
||||
|
||||
if callback then
|
||||
callback(result)
|
||||
end
|
||||
end
|
||||
|
||||
function ServerChapterManager:endFight(params, callback)
|
||||
local result = {
|
||||
status = 1
|
||||
}
|
||||
if params == nil or not params.id or not params.combatReport then
|
||||
if callback then
|
||||
callback(result)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local cfg = ConfigManager:getConfig("chapter")[params.id]
|
||||
local rewards = {}
|
||||
for i = 1, params.combatReport.wave do
|
||||
for _, reward in ipairs(cfg.wave_reward) do
|
||||
table.insert(rewards, reward)
|
||||
end
|
||||
end
|
||||
|
||||
if params.combatReport.victory then
|
||||
for _, reward in ipairs(cfg.finish_reward) do
|
||||
table.insert(rewards, reward)
|
||||
end
|
||||
end
|
||||
rewards = GFunc.mergeRewards(rewards)
|
||||
local ServerGameData = ServerDataManager:getServerGameData()
|
||||
ServerGameData.ChapterData:fightChapter(params.id, params.combatReport.victory, params.combatReport.wave)
|
||||
result.rewards = ServerGameData:addRewards(rewards)
|
||||
result.chapterData = ServerGameData.ChapterData:getCloneData()
|
||||
result.status = 0
|
||||
|
||||
if callback then
|
||||
callback(result)
|
||||
end
|
||||
end
|
||||
|
||||
return ServerChapterManager
|
||||
10
lua/app/server/manager/server_chapter_manager.lua.meta
Normal file
10
lua/app/server/manager/server_chapter_manager.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a93eee72dda74b4695a1e0de728ac96
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -10,6 +10,8 @@ ServerDataConst.DATA_OP_BEHAVIOR = {
|
||||
CROSS_DAY = "CROSS_DAY",
|
||||
UPDATE_FORMATION = "UPDATE_FORMATION",
|
||||
UPGRADE_HERO = "UPGRADE_HERO",
|
||||
END_FIGHT = "END_FIGHT",
|
||||
OPEN_CHAPTER_BOX = "OPEN_CHAPTER_BOX",
|
||||
}
|
||||
|
||||
return ServerDataConst
|
||||
@ -4,7 +4,8 @@ local ServerDataManager = {}
|
||||
|
||||
function ServerDataManager:init()
|
||||
self.ServerFormationManager = require("app/server/manager/server_formation_manager")
|
||||
self.HeroManager = require("app/server/manager/server_hero_manager")
|
||||
self.ServerHeroManager = require("app/server/manager/server_hero_manager")
|
||||
self.ServerChapterManager = require("app/server/manager/server_chapter_manager")
|
||||
end
|
||||
|
||||
function ServerDataManager:saveData()
|
||||
@ -61,7 +62,9 @@ end
|
||||
ServerDataManager.OP_FUNC = {
|
||||
[GConst.ServerDataConst.DATA_OP_BEHAVIOR.SYNC_DATA] = function (...) ServerDataManager:onSyncData(...) end,
|
||||
[GConst.ServerDataConst.DATA_OP_BEHAVIOR.UPDATE_FORMATION] = function (...) ServerDataManager.ServerFormationManager:updateFormation(...) end,
|
||||
[GConst.ServerDataConst.DATA_OP_BEHAVIOR.UPGRADE_HERO] = function (...) ServerDataManager.HeroManager:onUpgradeHero(...) end,
|
||||
[GConst.ServerDataConst.DATA_OP_BEHAVIOR.UPGRADE_HERO] = function (...) ServerDataManager.ServerHeroManager:onUpgradeHero(...) end,
|
||||
[GConst.ServerDataConst.DATA_OP_BEHAVIOR.END_FIGHT] = function(...) ServerDataManager.ServerChapterManager:endFight(...) end,
|
||||
[GConst.ServerDataConst.DATA_OP_BEHAVIOR.OPEN_CHAPTER_BOX] = function(...) ServerDataManager.ServerChapterManager:openBox(...) end,
|
||||
}
|
||||
|
||||
function ServerDataManager:dealGM(params, callback)
|
||||
|
||||
@ -121,6 +121,8 @@ function ServerGameData:addRewards(cfgRewards, getType)
|
||||
local cfg = ConfigManager:getItemConfig()[rewardId]
|
||||
if cfg.box_drop then
|
||||
self:openRewardBox(TempRewards, cfg.box_drop, rewardNum, rewardId)
|
||||
elseif cfg.hero_drop then
|
||||
self:openRewardBox(TempRewards, cfg.hero_drop, rewardNum, rewardId)
|
||||
else
|
||||
table.insert(TempRewards, reward)
|
||||
end
|
||||
|
||||
@ -9,23 +9,6 @@ end
|
||||
function BattleResultUI:ctor(params)
|
||||
self.rewards = params.rewards
|
||||
self.combatReport = params.combatReport
|
||||
---- 假数据
|
||||
-- self.combatReport = {
|
||||
-- battleType = GConst.BattleConst.BATTLE_TYPE.STAGE,
|
||||
-- victory = false,
|
||||
-- wave = 3,
|
||||
-- atkReport = {
|
||||
-- {
|
||||
-- heroId = 12001,
|
||||
-- dmg = 237800,
|
||||
-- },
|
||||
-- {
|
||||
-- heroId = 12001,
|
||||
-- dmg = 23700,
|
||||
-- }
|
||||
-- }
|
||||
-- }
|
||||
|
||||
self.totalDmg = 0
|
||||
if self.combatReport.atkReport then
|
||||
for _, info in ipairs(self.combatReport.atkReport) do
|
||||
@ -110,7 +93,7 @@ function BattleResultUI:refreshRewards()
|
||||
return GConst.TYPEOF_LUA_CLASS.REWARD_CELL
|
||||
end)
|
||||
self.scrollRect:addRefreshCallback(function(index, cell)
|
||||
cell:refreshByConfig(self.rewards[index])
|
||||
cell:refresh(self.rewards[index])
|
||||
end)
|
||||
self.scrollRect:clearCells()
|
||||
self.scrollRect:refillCells(#self.rewards)
|
||||
|
||||
@ -1,15 +1,9 @@
|
||||
local BattleUI = class("BattleUI", BaseUI)
|
||||
local GRID_CELL = "app/ui/battle/cell/grid_cell"
|
||||
local GRID_CELL_PATH = "assets/prefabs/ui/battle/cell/grid_cell.prefab"
|
||||
local SKILL_NODE_CELL = "app/ui/battle/cell/skill_node_cell"
|
||||
|
||||
local DEFAULT_X = 10000
|
||||
local SKILL_POS = {
|
||||
[GConst.BattleConst.ELEMENT_TYPE.RED] = BF.Vector2(-183, 454),
|
||||
[GConst.BattleConst.ELEMENT_TYPE.YELLOW] = BF.Vector2(-81.61, 454),
|
||||
[GConst.BattleConst.ELEMENT_TYPE.GREEN] = BF.Vector2(17.1, 454),
|
||||
[GConst.BattleConst.ELEMENT_TYPE.BLUE] = BF.Vector2(124.7, 454),
|
||||
[GConst.BattleConst.ELEMENT_TYPE.PURPLE] = BF.Vector2(229.4, 454),
|
||||
}
|
||||
|
||||
function BattleUI:getPrefabPath()
|
||||
return "assets/prefabs/ui/battle/battle_ui.prefab"
|
||||
@ -27,7 +21,8 @@ end
|
||||
function BattleUI:_display()
|
||||
local uiMap = self.root:genAllChildren()
|
||||
self.uiMap = uiMap
|
||||
self.boardMask2D = uiMap["battle_ui.bg_2.board_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_RECT_MASK_2D)
|
||||
self.boardNode = uiMap["battle_ui.bg_2.board_node"]
|
||||
self.boardMask2D = self.boardNode:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_RECT_MASK_2D)
|
||||
self.boardMask = uiMap["battle_ui.bg_2.board_mask"]
|
||||
self.boardMask:setVisible(false)
|
||||
self.boardCacheNode = uiMap["battle_ui.bg_2.board_cache_node"]
|
||||
@ -37,6 +32,7 @@ function BattleUI:_display()
|
||||
self:initBattlefield()
|
||||
self:initNumberNode()
|
||||
self:initHpNode()
|
||||
self:hideGenerateSkillGridCells()
|
||||
end
|
||||
|
||||
function BattleUI:_addListeners()
|
||||
@ -46,26 +42,29 @@ function BattleUI:_addListeners()
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleUI:_bind()
|
||||
self:bind(DataManager.BattleData, "lvDirty", function()
|
||||
self:refreshLv()
|
||||
end, true)
|
||||
end
|
||||
|
||||
function BattleUI:initSkill()
|
||||
if self.skillObjs then
|
||||
if self.skillNodeCells then
|
||||
return
|
||||
end
|
||||
self.skillObjs = {}
|
||||
self.skillNodeCells = {}
|
||||
|
||||
local uiMap = self.root:genAllChildren()
|
||||
for elementType, skillEntity in pairs(DataManager.BattleData:getSkillEntities()) do
|
||||
if not self.skillObjs[elementType] then
|
||||
local prefix = "battle_ui.bg_2.skill_node_" .. elementType
|
||||
self.skillObjs[elementType] = {
|
||||
icon = uiMap[prefix],
|
||||
mask = uiMap[prefix .. ".mask"],
|
||||
}
|
||||
self.skillObjs[elementType].imgComp = self.skillObjs[elementType].mask:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE)
|
||||
self.skillObjs[elementType].imgComp.fillAmount = 1
|
||||
self.skillObjs[elementType].icon:setSprite(GConst.ATLAS_PATH.ICON_SKILL, skillEntity:getBattleIcon())
|
||||
self.skillObjs[elementType].mask:setSprite(GConst.ATLAS_PATH.ICON_SKILL, skillEntity:getBattleIcon())
|
||||
for name, elementType in pairs(GConst.BattleConst.ELEMENT_TYPE) do
|
||||
self.skillNodeCells[elementType] = CellManager:addCellComp(uiMap["battle_ui.bg_2.skill_node_cell_" .. elementType], SKILL_NODE_CELL)
|
||||
local skillEntity = DataManager.BattleData:getSkillEntities()[elementType]
|
||||
if skillEntity then
|
||||
self.skillNodeCells[elementType]:refresh(skillEntity)
|
||||
end
|
||||
self.skillNodeCells[elementType]:getBaseObject():setActive(skillEntity ~= nil)
|
||||
end
|
||||
|
||||
uiMap["battle_ui.bg_2.skill_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT):RefreshLayout()
|
||||
end
|
||||
|
||||
function BattleUI:initBattlefield()
|
||||
@ -90,11 +89,10 @@ function BattleUI:getBattleNumber()
|
||||
end
|
||||
|
||||
function BattleUI:initHpNode()
|
||||
self.hpNode = self.uiMap["battle_ui.battle_hp_node"]
|
||||
self.hpProgressLeft = self.uiMap["battle_ui.battle_hp_node.progress_left"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
|
||||
self.hpProgressRight = self.uiMap["battle_ui.battle_hp_node.progress_right"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
|
||||
self.hpTextRight = self.uiMap["battle_ui.battle_hp_node.text_right"]
|
||||
self.hpTextLeft = self.uiMap["battle_ui.battle_hp_node.text_left"]
|
||||
self.hpProgressLeft = self.uiMap["battle_ui.top_node.bg_l.atk_slider_green"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
|
||||
self.hpProgressRight = self.uiMap["battle_ui.top_node.bg_r.atk_slider_red"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
|
||||
self.hpTextRight = self.uiMap["battle_ui.top_node.atk_hp"]
|
||||
self.hpTextLeft = self.uiMap["battle_ui.top_node.def_hp"]
|
||||
end
|
||||
|
||||
function BattleUI:refreshAtkHp(num, percent)
|
||||
@ -108,21 +106,15 @@ function BattleUI:refreshDefHp(num, percent)
|
||||
end
|
||||
|
||||
function BattleUI:refreshSkill(elementMap)
|
||||
if not self.skillObjs then
|
||||
if not self.skillNodeCells then
|
||||
return
|
||||
end
|
||||
|
||||
for elementType, skillEntity in pairs(DataManager.BattleData:getSkillEntities()) do
|
||||
if not self.skillObjs[elementType] then
|
||||
if not self.skillNodeCells[elementType] then
|
||||
return
|
||||
end
|
||||
local add = 0
|
||||
if elementMap and elementMap[elementType] then
|
||||
add = elementMap[elementType]
|
||||
end
|
||||
local curEnergy = skillEntity:getEnergy() + add
|
||||
local needEnergy = skillEntity:getNeedEnergy()
|
||||
self.skillObjs[elementType].imgComp.fillAmount = (needEnergy - curEnergy) / needEnergy
|
||||
self.skillNodeCells[elementType]:refresh(skillEntity, elementMap)
|
||||
end
|
||||
end
|
||||
|
||||
@ -242,7 +234,7 @@ function BattleUI:eliminationAni(sequence, callback)
|
||||
baseObject:setAnchoredPositionX(DEFAULT_X)
|
||||
else
|
||||
self.eliminationAniSeq:Insert(index * 0.01, baseObject:getTransform():DOScale(1.3, 0.1))
|
||||
self.eliminationAniSeq:Insert(index * 0.01 + 0.2, baseObject:getTransform():DOAnchorPos(SKILL_POS[entity:getElementType()], 0.3))
|
||||
self.eliminationAniSeq:Insert(index * 0.01 + 0.2, baseObject:getTransform():DOAnchorPos(self:getElementSkillPos(entity:getElementType()), 0.3))
|
||||
self.eliminationAniSeq:Insert(index * 0.01 + 0.2, baseObject:getTransform():DOScale(1, 0.3))
|
||||
end
|
||||
end
|
||||
@ -263,6 +255,62 @@ function BattleUI:eliminationAni(sequence, callback)
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleUI:generateSkillAni(map, callback)
|
||||
if table.nums(map) <= 0 then
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
self:hideGenerateSkillGridCells()
|
||||
if self.generateSkillAniSeq then
|
||||
self.generateSkillAniSeq:Kill()
|
||||
self.generateSkillAniSeq = nil
|
||||
end
|
||||
|
||||
self.generateSkillAniSeq = self.root:createBindTweenSequence()
|
||||
for elementType, info in pairs(map) do
|
||||
local entity = self.generateSkillGridEntities[elementType]
|
||||
if entity and entity:getCell() then
|
||||
entity:setSkilId(info.skillId)
|
||||
local cell = entity:getCell()
|
||||
cell:refresh(entity)
|
||||
self.generateSkillAniSeq:AppendCallback(function()
|
||||
local pos = self:getElementSkillPos(elementType)
|
||||
cell:getBaseObject():setAnchoredPosition(pos.x, pos.y)
|
||||
end)
|
||||
local pos = ModuleManager.BattleManager:getPosInfo(info.posId)
|
||||
self.generateSkillAniSeq:Append(cell:getBaseObject():getTransform():DOAnchorPos(pos, 0.5))
|
||||
end
|
||||
end
|
||||
self.generateSkillAniSeq:AppendCallback(function()
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
self:hideGenerateSkillGridCells()
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleUI:hideGenerateSkillGridCells()
|
||||
if not self.generateSkillGridEntities then
|
||||
local uiMap = self.root:genAllChildren()
|
||||
self.generateSkillGridEntities = {}
|
||||
for name, elementType in pairs(GConst.BattleConst.ELEMENT_TYPE) do
|
||||
local cell = CellManager:addCellComp(uiMap["battle_ui.bg_2.board_node.ani_node.grid_cell_" .. elementType], GRID_CELL)
|
||||
local entity = DataManager.BattleData:getNewGridEntity()
|
||||
entity:setCell(cell)
|
||||
self.generateSkillGridEntities[elementType] = entity
|
||||
end
|
||||
end
|
||||
|
||||
for _, entity in pairs(self.generateSkillGridEntities) do
|
||||
if entity:getCell() then
|
||||
entity:getCell():getBaseObject():setAnchoredPositionX(DEFAULT_X)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function BattleUI:fallGrid(listInfo, callback)
|
||||
self:showMask(false)
|
||||
self.fallAniCount = 0
|
||||
@ -442,6 +490,46 @@ function BattleUI:showMask(show)
|
||||
self.boardMask:setVisible(show)
|
||||
end
|
||||
|
||||
function BattleUI:getElementSkillPos(elementType)
|
||||
if not self.skillPoss then
|
||||
self.skillPoss = {}
|
||||
end
|
||||
|
||||
if not self.skillPoss[elementType] then
|
||||
local cell = self.skillNodeCells[elementType]
|
||||
if not cell then
|
||||
self.skillPoss[elementType] = BF.Vector2(0, 0)
|
||||
else
|
||||
local targetPos = cell:getBaseObject():getTransform().position
|
||||
local sPoint = UIManager:getUICameraComponent():WorldToScreenPoint(targetPos)
|
||||
targetPos = CS.BF.Utils.RectTransformScreenPointToLocalPointInRectangle(self.boardNode:getTransform(), sPoint.x, sPoint.y, UIManager:getUICameraComponent())
|
||||
self.skillPoss[elementType] = targetPos
|
||||
end
|
||||
end
|
||||
|
||||
return self.skillPoss[elementType]
|
||||
end
|
||||
|
||||
function BattleUI:refreshLv()
|
||||
local uiMap = self.root:genAllChildren()
|
||||
if not self.lvSlider then
|
||||
self.lvSlider = uiMap["battle_ui.bg_2.lv_node.slider"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
|
||||
self.lvDesc = uiMap["battle_ui.bg_2.lv_node.icon.lv_desc"]
|
||||
end
|
||||
local curExp = DataManager.BattleData:getBattleExp()
|
||||
local curNeedExp = DataManager.BattleData:getBattleNeedExp()
|
||||
self.lvSlider.value = curExp / curNeedExp
|
||||
self.lvDesc:setText(DataManager.BattleData:getBattleLv())
|
||||
end
|
||||
|
||||
function BattleUI:refreshWave(wave)
|
||||
local uiMap = self.root:genAllChildren()
|
||||
local icon = uiMap["battle_ui.top_node.wave_icon"]
|
||||
local desc = uiMap["battle_ui.top_node.wave_desc"]
|
||||
desc:setText(wave)
|
||||
GFunc.centerImgAndTx(icon, desc, 10)
|
||||
end
|
||||
|
||||
function BattleUI:clear()
|
||||
if self.alreadyClear then
|
||||
return
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
local GridCell = class("GridCell", BaseCell)
|
||||
|
||||
function GridCell:refresh(gridEntity, curElement)
|
||||
self.gridEntity = gridEntity
|
||||
local uiMap = self:getUIMap()
|
||||
local downBg = uiMap["grid_cell.touch_node.ani_node.down_bg"]
|
||||
local elementType = gridEntity:getElementType()
|
||||
local elementIcon = uiMap["grid_cell.touch_node.ani_node.middle_bg"]
|
||||
local highLightIcon = uiMap["grid_cell.touch_node.ani_node.middle_bg.high_light_icon"]
|
||||
if self.lastElementType ~= elementType then
|
||||
self.lastElementType = elementType
|
||||
local atlas, icon = ModuleManager.BattleManager:getElementIcon(elementType)
|
||||
elementIcon:setSprite(atlas, icon)
|
||||
highLightIcon:setSprite(atlas, icon .. "_1")
|
||||
end
|
||||
elementIcon:setVisible(true)
|
||||
|
||||
@ -29,7 +29,6 @@ function GridCell:refresh(gridEntity, curElement)
|
||||
end
|
||||
|
||||
local skillIcon = uiMap["grid_cell.touch_node.ani_node.skill_icon"]
|
||||
local skillHighLightIcon = uiMap["grid_cell.touch_node.ani_node.skill_icon.high_light_icon"]
|
||||
local skillId = gridEntity:getSkillId()
|
||||
if skillId then
|
||||
elementIcon:setVisible(false)
|
||||
@ -40,7 +39,6 @@ function GridCell:refresh(gridEntity, curElement)
|
||||
local cfg = ModuleManager.BattleManager.SKILL_HERO_CFG[skillId]
|
||||
if cfg then
|
||||
skillIcon:setSprite(GConst.ATLAS_PATH.ICON_SKILL, tostring(cfg.battle_icon))
|
||||
skillHighLightIcon:setSprite(GConst.ATLAS_PATH.ICON_SKILL, tostring(cfg.battle_icon) .. "_1")
|
||||
end
|
||||
end
|
||||
|
||||
@ -70,12 +68,39 @@ function GridCell:showCircle(show)
|
||||
uiMap["grid_cell.touch_node.ani_node.circle"]:setVisible(show == true)
|
||||
end
|
||||
|
||||
function GridCell:showHighLight(show)
|
||||
function GridCell:showHighLight(show, mainElementType)
|
||||
if not self.gridEntity then
|
||||
return
|
||||
end
|
||||
|
||||
local uiMap = self:getUIMap()
|
||||
local highLightIcon = uiMap["grid_cell.touch_node.ani_node.middle_bg.high_light_icon"]
|
||||
local skillHighLightIcon = uiMap["grid_cell.touch_node.ani_node.skill_icon.high_light_icon"]
|
||||
highLightIcon:setVisible(show)
|
||||
skillHighLightIcon:setVisible(show)
|
||||
local downBg = uiMap["grid_cell.touch_node.ani_node.down_bg"]
|
||||
|
||||
local skillId = self.gridEntity:getSkillId()
|
||||
downBg:setVisible(skillId ~= nil)
|
||||
if skillId then
|
||||
local skillEntity = DataManager.BattleData:getSkillEntityBySkillId(skillId)
|
||||
local ignoreElementType = skillEntity:getIgnoreElementType()
|
||||
local skillBg
|
||||
if ignoreElementType and not mainElementType then
|
||||
skillBg = GConst.BattleConst.SKILL_ELEMENT_BG_2.ANY
|
||||
else
|
||||
mainElementType = mainElementType or skillEntity:getPosition()
|
||||
skillBg = GConst.BattleConst.SKILL_ELEMENT_BG_2[mainElementType]
|
||||
end
|
||||
if self.lastSkillBg ~= skillBg then
|
||||
self.lastSkillBg = skillBg
|
||||
downBg:setSprite(GConst.ATLAS_PATH.BATTLE, self.lastSkillBg)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- 测试代码
|
||||
local str = GConst.EMPTY_STRING
|
||||
if show then
|
||||
str = self.gridEntity:getAroundEliminationCount()
|
||||
end
|
||||
uiMap["grid_cell.touch_node.ani_node.count"]:setText(str)
|
||||
end
|
||||
|
||||
function GridCell:resetTranform()
|
||||
|
||||
31
lua/app/ui/battle/cell/skill_node_cell.lua
Normal file
31
lua/app/ui/battle/cell/skill_node_cell.lua
Normal file
@ -0,0 +1,31 @@
|
||||
local SkillNodeCell = class("SkillNodeCell", BaseCell)
|
||||
|
||||
function SkillNodeCell:refresh(skillEntity, elementMap)
|
||||
local elementType = skillEntity:getPosition()
|
||||
local add = 0
|
||||
if elementMap and elementMap[elementType] then
|
||||
add = elementMap[elementType]
|
||||
end
|
||||
|
||||
local uiMap = self:getUIMap()
|
||||
if not self.imgComp then
|
||||
self.imgComp = uiMap["skill_node_cell.energy_bg"]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE)
|
||||
end
|
||||
local curEnergy = skillEntity:getEnergy() + add
|
||||
local needEnergy = skillEntity:getNeedEnergy()
|
||||
self.imgComp.fillAmount = curEnergy / needEnergy
|
||||
if self.lastSkillIcon ~= skillEntity:getBattleIcon() then
|
||||
self.lastSkillIcon = skillEntity:getBattleIcon()
|
||||
uiMap["skill_node_cell.skill_icon"]:setSprite(GConst.ATLAS_PATH.ICON_SKILL, self.lastSkillIcon)
|
||||
end
|
||||
if self.lastNeedEnergy ~= needEnergy then
|
||||
self.lastNeedEnergy = needEnergy
|
||||
uiMap["skill_node_cell.mask"]:setSprite(GConst.ATLAS_PATH.BATTLE, "battle_skill_line_" .. needEnergy)
|
||||
end
|
||||
if self.lastElementType ~= elementType then
|
||||
self.lastElementType = elementType
|
||||
uiMap["skill_node_cell.match_bg"]:setSprite(GConst.ATLAS_PATH.BATTLE, GConst.BattleConst.SKILL_ELEMENT_BG[elementType])
|
||||
end
|
||||
end
|
||||
|
||||
return SkillNodeCell
|
||||
10
lua/app/ui/battle/cell/skill_node_cell.lua.meta
Normal file
10
lua/app/ui/battle/cell/skill_node_cell.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd71a31a4c619394fa0f0c774106abfe
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -7,9 +7,10 @@ function LargeHeroCell:init()
|
||||
self.check = uiMap["hero_cell.hero_bg.mask"]
|
||||
self.matchImg = uiMap["hero_cell.hero_bg.match_img"]
|
||||
self.infoBtnDesc = uiMap["large_hero_cell.hero_bg.info_btn.desc"]
|
||||
self.useBtn = uiMap["large_hero_cell.hero_bg.use_btn.desc"]
|
||||
self.useBtnDesc = uiMap["large_hero_cell.hero_bg.use_btn.desc"]
|
||||
self.isGray = false
|
||||
|
||||
self.useBtnDesc:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_8))
|
||||
uiMap["large_hero_cell.hero_bg.info_btn"]:addClickListener(function()
|
||||
if not self.heroId or not self.matchType then
|
||||
return
|
||||
@ -30,6 +31,13 @@ function LargeHeroCell:refresh(heroEntity, isGray)
|
||||
self.matchType = heroEntity:getMatchType()
|
||||
local heroInfo = heroEntity:getConfig()
|
||||
self:_refresh(heroInfo, isGray)
|
||||
local str
|
||||
if heroEntity:canLvUp() then
|
||||
str = I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4)
|
||||
else
|
||||
str = I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_9)
|
||||
end
|
||||
self.infoBtnDesc:setText(str)
|
||||
end
|
||||
|
||||
function LargeHeroCell:refreshWithCfgId(id, isGray)
|
||||
@ -37,6 +45,7 @@ function LargeHeroCell:refreshWithCfgId(id, isGray)
|
||||
self.heroId = id
|
||||
self.matchType = heroInfo.position
|
||||
self:_refresh(heroInfo, isGray)
|
||||
self.infoBtnDesc:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_9))
|
||||
end
|
||||
|
||||
function LargeHeroCell:_refresh(heroInfo, isGray)
|
||||
|
||||
@ -14,7 +14,7 @@ function RewardCell:refresh(reward)
|
||||
local id
|
||||
if reward.type == GConst.REWARD_TYPE.ITEM then
|
||||
self:_refreshItem(reward.item)
|
||||
id = reward.item.cfg_id
|
||||
id = reward.item.cfg_id or reward.item.id
|
||||
-- elseif reward.type == GConst.REWARD_TYPE.EQUIP then
|
||||
-- self:_refreshEquip(reward.equip)
|
||||
-- id = reward.equip.id
|
||||
@ -55,7 +55,7 @@ function RewardCell:_refreshItem(item)
|
||||
self.numTx:setVisible(true)
|
||||
self.frameBg:setSprite(GConst.ATLAS_PATH.ICON_ITEM, "frame_0")
|
||||
self.icon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, info.icon)
|
||||
self.numTx:setText(item.count)
|
||||
self.numTx:setText(item.count or item.num)
|
||||
end
|
||||
|
||||
function RewardCell:_refreshEquip(equip)
|
||||
|
||||
@ -37,7 +37,7 @@ function HeroListCell:refresh(index, heroList, stageFormation, allHeroCount, act
|
||||
end
|
||||
local heroStartIndex = (index-1)*4 + 1
|
||||
if heroStartIndex > activeCount then
|
||||
heroStartIndex = heroStartIndex - activeCount%4
|
||||
heroStartIndex = heroStartIndex - (4 - activeCount%4)
|
||||
end
|
||||
local heroIndex = heroStartIndex
|
||||
for i = 1, 4 do
|
||||
|
||||
@ -40,6 +40,18 @@ function HeroComp:init()
|
||||
self.content:addClickListener(function()
|
||||
self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X)
|
||||
end)
|
||||
|
||||
for index, obj in ipairs(self.heroNodeList) do
|
||||
obj:addClickListener(function()
|
||||
local heroId = self.stageFormation[index]
|
||||
if heroId then
|
||||
local hero = DataManager.HeroData:getHeroById(heroId)
|
||||
if hero then
|
||||
ModuleManager.HeroManager:showHeroDetailUI(heroId)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function HeroComp:refresh()
|
||||
@ -142,7 +154,8 @@ function HeroComp:onClickHero(cell, heroId)
|
||||
targetPos = CS.BF.Utils.RectTransformScreenPointToLocalPointInRectangle(self.content:getTransform(), sPoint.x, sPoint.y, UIManager:getUICameraComponent())
|
||||
self.largeHeroCell:getBaseObject():setAnchoredPosition(targetPos.x, targetPos.y)
|
||||
self.largeHeroCell:getBaseObject():getTransform():SetAsLastSibling()
|
||||
self.largeHeroCell:refresh(entity, self.stageFormation[entity:getMatchType()] == heroId)
|
||||
self.largeHeroCell:refresh(entity, not entity:isActived())
|
||||
self.largeHeroCell:showCheck(self.stageFormation[entity:getMatchType()] == heroId)
|
||||
else
|
||||
ModuleManager.HeroManager:showHeroDetailUI(heroId)
|
||||
self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X)
|
||||
|
||||
@ -30,7 +30,7 @@ function HeroDetailUI:_display()
|
||||
uiMap["hero_detail_ui.bg.hp_name"]:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_2))
|
||||
uiMap["hero_detail_ui.bg.atk_name"]:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_3))
|
||||
|
||||
-- uiMap["hero_detail_ui.bg.skill_icon"]:setSprite(GConst.ATLAS_PATH.ICON_SKILL, ModuleManager.HeroManager:getSkillIcon(self.heroEntity:getActiveSkill()))
|
||||
uiMap["hero_detail_ui.bg.skill_icon"]:setSprite(GConst.ATLAS_PATH.ICON_SKILL, ModuleManager.HeroManager:getSkillIcon(self.heroEntity:getActiveSkill()))
|
||||
uiMap["hero_detail_ui.bg.hero_icon"]:setSprite(GConst.ATLAS_PATH.ICON_HERO, self.heroEntity:getIcon())
|
||||
uiMap["hero_detail_ui.bg.hero_element"]:setSprite(GConst.ATLAS_PATH.ICON_HERO, ModuleManager.HeroManager:getMatchTypeIcon(self.heroEntity:getMatchType()))
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ local CHAPTER_PATH = "assets/arts/textures/background/chapter/%s.png"
|
||||
|
||||
local BOX_ICON = {
|
||||
"common_chest_1",
|
||||
"common_chest_2"
|
||||
"common_chest_4"
|
||||
}
|
||||
|
||||
function MainComp:init()
|
||||
@ -58,7 +58,7 @@ function MainComp:refresh()
|
||||
end
|
||||
|
||||
function MainComp:onFightBtnClick()
|
||||
ModuleManager.BattleManager:playBattle(GConst.BattleConst.BATTLE_TYPE.STAGE)
|
||||
ModuleManager.ChapterManager:startFight()
|
||||
end
|
||||
|
||||
function MainComp:refreshChapter(force)
|
||||
@ -85,15 +85,19 @@ function MainComp:refreshChapter(force)
|
||||
end
|
||||
end
|
||||
|
||||
local curMaxWave = DataManager.ChapterData:getChapterMaxWave()
|
||||
local boxCount = DataManager.ChapterData:getChapterBoxCount()
|
||||
slider:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = DataManager.ChapterData:getChapterMaxWave() / boxCount
|
||||
local maxWave = DataManager.ChapterData:getChapterBoxNum(chapterId, boxCount)
|
||||
slider:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = curMaxWave / maxWave
|
||||
|
||||
for index, objs in ipairs(self.boxObjs) do
|
||||
local show = boxCount >= index
|
||||
objs.box:setActive(show)
|
||||
objs.desc:setActive(show)
|
||||
if show then
|
||||
local needWave = DataManager.ChapterData:getChapterBoxNum(chapterId, index)
|
||||
local x = 370 * (index / boxCount)
|
||||
local rewards = DataManager.ChapterData:getChapterBoxByIndex(nil, index)
|
||||
local rewards = DataManager.ChapterData:getChapterBoxRewards(nil, index)
|
||||
local num = DataManager.ChapterData:getChapterBoxNum(nil, index)
|
||||
local rewardGot = DataManager.ChapterData:getChapterBoxRewardGot(nil, index)
|
||||
local icon = BOX_ICON[1]
|
||||
@ -101,7 +105,11 @@ function MainComp:refreshChapter(force)
|
||||
icon = BOX_ICON[2]
|
||||
end
|
||||
objs.box:addClickListener(function()
|
||||
ModuleManager.TipsManager:showRewardsTips(rewards, nil, objs.box)
|
||||
if needWave <= curMaxWave and not rewardGot then
|
||||
ModuleManager.ChapterManager:openBox(chapterId, index)
|
||||
else
|
||||
ModuleManager.TipsManager:showRewardsTips(rewards, nil, objs.box)
|
||||
end
|
||||
end)
|
||||
objs.box:setSprite(GConst.ATLAS_PATH.COMMON, icon)
|
||||
objs.box:setAnchoredPositionX(x)
|
||||
|
||||
@ -93,7 +93,7 @@ end
|
||||
function MainCityUI:_bind()
|
||||
self:bind(DataManager.ChapterData, "isDirty", function()
|
||||
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN then
|
||||
self.subComps[self.selectedIndex]:refreshChapter()
|
||||
self.subComps[self.selectedIndex]:refreshChapter(true)
|
||||
end
|
||||
end)
|
||||
self:bind(DataManager.PlayerData, "dirty", function(binder, value)
|
||||
|
||||
@ -19,7 +19,7 @@ function RewardsTips:init()
|
||||
if not self.rewardCells then
|
||||
self.rewardCells = {}
|
||||
for i = 1, 3 do
|
||||
self.rewardCells[i] = CellManager:addCellComp(uiMap["rewards_tips.reward_node.reward_layout.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
|
||||
self.rewardCells[i] = CellManager:addCellComp(uiMap["rewards_tips.bg.reward_node.reward_layout.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -38,7 +38,7 @@ function RewardsTips:onRefresh()
|
||||
self:closeUI()
|
||||
end)
|
||||
|
||||
self.descTx:setText(self.params.customTitleStr or I18N:getGlobalText(I18N.GlobalConst.BOUNTY_DESC_11))
|
||||
self.descTx:setText(self.params.customTitleStr or I18N:getGlobalText(I18N.GlobalConst.REWARD_PREVIEW_DESC))
|
||||
if self.params.rewards then
|
||||
for i, cell in ipairs(self.rewardCells) do
|
||||
if self.params.rewards[i] then
|
||||
|
||||
@ -5,13 +5,18 @@ local BattleData = class("BattleData", BaseData)
|
||||
local SKILL_HERO_CFG = ConfigManager:getConfig("skill")
|
||||
local BattleConst = GConst.BattleConst
|
||||
local BATTLE_GRID_ENTITY = require "app/userdata/battle/battle_grid_entity"
|
||||
local BATTLE_BOARD_SKILL_ENTITY = require "app/userdata/battle/skill/battle_borad_skill_entity"
|
||||
local BATTLE_BOARD_SKILL_ENTITY = require "app/userdata/battle/skill/battle_board_skill_entity"
|
||||
|
||||
local ATTR_TYPE = GConst.ATTR_TYPE
|
||||
local DEFAULT_FACTOR = BattleConst.DEFAULT_FACTOR
|
||||
|
||||
function BattleData:init()
|
||||
self:clear()
|
||||
self.battleLv = 1
|
||||
self.curBattleExp = 0
|
||||
self.needBattleExp = self:getLvNeedExp()
|
||||
self.addLvCount = 0
|
||||
self.data.lvDirty = false
|
||||
self.atkTeam = self:initTeam(BattleConst.SIDE_ATK)
|
||||
self.defTeam = self:initTeam(BattleConst.SIDE_DEF)
|
||||
self:initRogueSkills()
|
||||
@ -297,6 +302,46 @@ function BattleData:clearCacheBoardSkill()
|
||||
self.cacheSkillCount = 0
|
||||
end
|
||||
|
||||
function BattleData:getBattleLv()
|
||||
return self.battleLv
|
||||
end
|
||||
|
||||
function BattleData:getBattleExp()
|
||||
return self.curBattleExp
|
||||
end
|
||||
|
||||
function BattleData:getBattleNeedExp()
|
||||
return self.needBattleExp
|
||||
end
|
||||
|
||||
function BattleData:getLvNeedExp(lv)
|
||||
lv = lv or self.battleLv
|
||||
local cfg = ConfigManager:getConfig("battle_exp")
|
||||
if not cfg[lv] then
|
||||
return cfg[ConfigManager:getConfigNum("battle_exp")].exp
|
||||
end
|
||||
return cfg[lv].exp
|
||||
end
|
||||
|
||||
function BattleData:addExp(exp)
|
||||
self.curBattleExp = self.curBattleExp + exp
|
||||
while self.curBattleExp >= self.needBattleExp do
|
||||
self.curBattleExp = self.curBattleExp - self.needBattleExp
|
||||
self.addLvCount = self.addLvCount + 1
|
||||
self.battleLv = self.battleLv + 1
|
||||
self.needBattleExp = self:getLvNeedExp()
|
||||
end
|
||||
self.data.lvDirty = not self.data.lvDirty
|
||||
end
|
||||
|
||||
function BattleData:useAddlvCount()
|
||||
if self.addLvCount <= 0 then
|
||||
self.addLvCount = 0
|
||||
return false
|
||||
end
|
||||
self.addLvCount = self.addLvCount - 1
|
||||
end
|
||||
|
||||
function BattleData:initTeam(side)
|
||||
local data = nil
|
||||
if side == BattleConst.SIDE_ATK then
|
||||
|
||||
@ -6,6 +6,8 @@ function BattleBoardSkillEnity:ctor(skillId)
|
||||
self.addRange = {}
|
||||
self.linkAtkp = 0
|
||||
self.inInfluenceAtkp = 0
|
||||
self.generalAttackEffect = {}
|
||||
self.elementCountEffect = {}
|
||||
end
|
||||
|
||||
function BattleBoardSkillEnity:refreshSkillId(skillId)
|
||||
@ -167,4 +169,28 @@ function BattleBoardSkillEnity:addInInfluenceAtkp(atkp)
|
||||
self.inInfluenceAtkp = self.inInfluenceAtkp + atkp
|
||||
end
|
||||
|
||||
function BattleBoardSkillEnity:addGeneralAttackEffect(effect)
|
||||
if not self.generalAttackEffect[effect.type] then
|
||||
self.generalAttackEffect[effect.type] = GFunc.getTable(effect)
|
||||
else
|
||||
self.generalAttackEffect[effect.type].num = self.generalAttackEffect[effect.type].numn + effect.num
|
||||
end
|
||||
end
|
||||
|
||||
function BattleBoardSkillEnity:getGeneralAttackEffect()
|
||||
return self.generalAttackEffect
|
||||
end
|
||||
|
||||
function BattleBoardSkillEnity:addElementCountEffect(effect)
|
||||
if not self.elementCountEffect[effect.type] then
|
||||
self.elementCountEffect[effect.type] = GFunc.getTable(effect)
|
||||
else
|
||||
self.elementCountEffect[effect.type].num = self.elementCountEffect[effect.type].numn + effect.num
|
||||
end
|
||||
end
|
||||
|
||||
function BattleBoardSkillEnity:getElementCountEffect()
|
||||
return self.elementCountEffect
|
||||
end
|
||||
|
||||
return BattleBoardSkillEnity
|
||||
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7216a60554ba9c84bbf9edadb4b54ccf
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -17,11 +17,17 @@ function ChapterData:clear()
|
||||
self.data.chapterFightInfo = {}
|
||||
end
|
||||
|
||||
function ChapterData:init(data)
|
||||
self.data.chapterId = data and data.chapterId or MIN_CHAPTER_ID
|
||||
function ChapterData:init(data, notChangeChapterId)
|
||||
if not notChangeChapterId then
|
||||
self.data.chapterId = data and data.chapterId or MIN_CHAPTER_ID
|
||||
end
|
||||
self.data.maxChapterId = data and data.maxChapterId or self.data.chapterId - 1
|
||||
-- self.data.chapterBoxInfo = {}
|
||||
-- self.data.chapterFightInfo = {}
|
||||
self.data.chapterBoxInfo = data and data.chapterBoxInfo or {}
|
||||
self.data.chapterFightInfo = data and data.chapterFightInfo or {}
|
||||
end
|
||||
|
||||
function ChapterData:setDirty()
|
||||
self.data.isDirty = not self.data.isDirty
|
||||
end
|
||||
|
||||
function ChapterData:getChapterId()
|
||||
@ -83,18 +89,6 @@ function ChapterData:getChapterBoxNum(chapterId, index)
|
||||
end
|
||||
end
|
||||
|
||||
function ChapterData:getChapterBoxByIndex(chapterId, index)
|
||||
chapterId = chapterId or self:getChapterId()
|
||||
if not self:getChapterBoxNum(chapterId, index) then
|
||||
return
|
||||
end
|
||||
|
||||
local cfg = self:getChapterCfg()[chapterId]
|
||||
if cfg then
|
||||
return cfg["box_reward_" .. index]
|
||||
end
|
||||
end
|
||||
|
||||
function ChapterData:getChapterBoxRewardGot(chapterId, index)
|
||||
chapterId = tostring(chapterId or self:getChapterId())
|
||||
local list = self.data.chapterBoxInfo[chapterId]
|
||||
@ -111,6 +105,18 @@ function ChapterData:getChapterBoxRewardGot(chapterId, index)
|
||||
return false
|
||||
end
|
||||
|
||||
function ChapterData:getChapterBoxRewards(chapterId, index)
|
||||
chapterId = chapterId or self:getChapterId()
|
||||
if not self:getChapterBoxNum(chapterId, index) then
|
||||
return
|
||||
end
|
||||
|
||||
local cfg = self:getChapterCfg()[chapterId]
|
||||
if cfg then
|
||||
return cfg["box_reward_" .. index]
|
||||
end
|
||||
end
|
||||
|
||||
function ChapterData:getChapterMaxWave(chapterId)
|
||||
chapterId = tostring(chapterId or self:getChapterId())
|
||||
if self.data.chapterFightInfo[chapterId] then
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user