merge
This commit is contained in:
commit
b5f765f74c
@ -116,7 +116,9 @@ BIReport.RUNE_OPT_TYPE = {
|
|||||||
|
|
||||||
BIReport.ITEM_GET_TYPE = {
|
BIReport.ITEM_GET_TYPE = {
|
||||||
NEW_PLAYER_INITIAL = "NewPlayerInitial", -- 新玩家创号自带
|
NEW_PLAYER_INITIAL = "NewPlayerInitial", -- 新玩家创号自带
|
||||||
UPGRADE_HERO = "UpgradeHero"
|
UPGRADE_HERO = "UpgradeHero",
|
||||||
|
FIGHT_END = "FightEnd",
|
||||||
|
CHAPTER_BOX = "ChapterBox"
|
||||||
}
|
}
|
||||||
|
|
||||||
BIReport.ADS_CLICK_TYPE = {
|
BIReport.ADS_CLICK_TYPE = {
|
||||||
|
|||||||
@ -13,6 +13,7 @@ local MODULE_PATHS = {
|
|||||||
BattleManager = "app/module/battle/battle_manager",
|
BattleManager = "app/module/battle/battle_manager",
|
||||||
FormationManager = "app/module/formation/formation_manager",
|
FormationManager = "app/module/formation/formation_manager",
|
||||||
HeroManager = "app/module/hero/hero_manager",
|
HeroManager = "app/module/hero/hero_manager",
|
||||||
|
ChapterManager = "app/module/chapter/chapter_manager",
|
||||||
}
|
}
|
||||||
|
|
||||||
-- 这里的key对应func_open里的id
|
-- 这里的key对应func_open里的id
|
||||||
|
|||||||
@ -199,13 +199,24 @@ local chapter_board = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
["control_element"]={
|
["control_element"]={
|
||||||
3,
|
|
||||||
2,
|
|
||||||
3,
|
|
||||||
3,
|
|
||||||
4,
|
4,
|
||||||
5,
|
4,
|
||||||
5
|
4,
|
||||||
|
4,
|
||||||
|
4,
|
||||||
|
4,
|
||||||
|
4,
|
||||||
|
4,
|
||||||
|
4,
|
||||||
|
4,
|
||||||
|
4,
|
||||||
|
4,
|
||||||
|
4,
|
||||||
|
4,
|
||||||
|
4,
|
||||||
|
4,
|
||||||
|
4,
|
||||||
|
4,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[2]={
|
[2]={
|
||||||
@ -619,10 +630,15 @@ local chapter_board = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
["control_element"]={
|
["control_element"]={
|
||||||
3,
|
4,
|
||||||
1,
|
4,
|
||||||
5,
|
4,
|
||||||
3
|
4,
|
||||||
|
4,
|
||||||
|
4,
|
||||||
|
4,
|
||||||
|
4,
|
||||||
|
4,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[4]={
|
[4]={
|
||||||
|
|||||||
@ -25,6 +25,10 @@ local LocalizationGlobalConst =
|
|||||||
HERO_DESC_5 = "HERO_DESC_5",
|
HERO_DESC_5 = "HERO_DESC_5",
|
||||||
HERO_DESC_6 = "HERO_DESC_6",
|
HERO_DESC_6 = "HERO_DESC_6",
|
||||||
HERO_DESC_7 = "HERO_DESC_7",
|
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
|
return LocalizationGlobalConst
|
||||||
@ -1,7 +1,7 @@
|
|||||||
local monster_chapter = {
|
local monster_chapter = {
|
||||||
[101]={
|
[101]={
|
||||||
["monster_base"]=10001,
|
["monster_base"]=10001,
|
||||||
["hp"]=10000000,
|
["hp"]=10000,
|
||||||
["atk"]=10000,
|
["atk"]=10000,
|
||||||
["atk_times"]=2,
|
["atk_times"]=2,
|
||||||
["hurt_skill"]=100001,
|
["hurt_skill"]=100001,
|
||||||
|
|||||||
@ -11,6 +11,7 @@ local localization_global =
|
|||||||
["BTN_TEXT_CANCEL"] = "取消",
|
["BTN_TEXT_CANCEL"] = "取消",
|
||||||
["BTN_TEXT_OK"] = "确定",
|
["BTN_TEXT_OK"] = "确定",
|
||||||
["BATTLE_DESC_1"] = "是否退出战斗",
|
["BATTLE_DESC_1"] = "是否退出战斗",
|
||||||
|
|
||||||
["ITEM_NOT_ENOUGH"] = "{0}不足",
|
["ITEM_NOT_ENOUGH"] = "{0}不足",
|
||||||
["START_DESC"] = "开始",
|
["START_DESC"] = "开始",
|
||||||
["ELEMENT_NAME_1"] = "红色元素",
|
["ELEMENT_NAME_1"] = "红色元素",
|
||||||
@ -25,6 +26,21 @@ local localization_global =
|
|||||||
["HERO_DESC_5"] = "激活",
|
["HERO_DESC_5"] = "激活",
|
||||||
["HERO_DESC_6"] = "已解锁",
|
["HERO_DESC_6"] = "已解锁",
|
||||||
["HERO_DESC_7"] = "未解锁",
|
["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
|
return localization_global
|
||||||
@ -265,6 +265,23 @@ BattleConst.ELEMENT_ICON = {
|
|||||||
[BattleConst.ELEMENT_TYPE.PURPLE] = "purple_1"
|
[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.POS_ID_2_RC = {}
|
||||||
BattleConst.RC_2_POS_ID = {}
|
BattleConst.RC_2_POS_ID = {}
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ function BattleManager:showSelectSkillUI(skillList)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function BattleManager:showBattleResultUI(rewards, combatReport)
|
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
|
end
|
||||||
|
|
||||||
function BattleManager:playBattle(battleType, params, returnFunc)
|
function BattleManager:playBattle(battleType, params, returnFunc)
|
||||||
|
|||||||
@ -79,24 +79,26 @@ function BattleController:onLinkChange()
|
|||||||
elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1
|
elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1
|
||||||
mainElementType = elementType
|
mainElementType = elementType
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, info in ipairs(sequence) do
|
||||||
|
local entity = self.battleData:getGridEntity(info.posId)
|
||||||
if entity:getCell() then
|
if entity:getCell() then
|
||||||
entity:getCell():showHighLight(true)
|
entity:getCell():showHighLight(true, mainElementType)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for posId, info in pairs(self.battleData:getSkillInfluenceGrids()) do
|
for posId, info in pairs(self.battleData:getSkillInfluenceGrids()) do
|
||||||
local entity = self.battleData:getGridEntity(posId)
|
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
|
posIdMap[posId] = true
|
||||||
if not entity:getSkillId() then
|
if not entity:getSkillId() then
|
||||||
local elementType = entity:getElementType()
|
local elementType = entity:getElementType()
|
||||||
elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1
|
elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1
|
||||||
end
|
end
|
||||||
end
|
if entity:getCell() then
|
||||||
|
entity:getCell():showCircle(true)
|
||||||
if entity:getCell() and info.direction ~= BattleConst.BOARD_RANGE_TYPE.RANDOM then
|
end
|
||||||
entity:getCell():showCircle(true)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -156,7 +158,6 @@ function BattleController:prepareFight()
|
|||||||
BattleHelper:setEffectTextCache(self.battleUI:getBattleNumber())
|
BattleHelper:setEffectTextCache(self.battleUI:getBattleNumber())
|
||||||
self:initAtkUnits(onPreloadFinished)
|
self:initAtkUnits(onPreloadFinished)
|
||||||
self:initDefUnits(onPreloadFinished)
|
self:initDefUnits(onPreloadFinished)
|
||||||
self:battleStart()
|
|
||||||
end)
|
end)
|
||||||
self:loadOtherRes(onPreloadFinished)
|
self:loadOtherRes(onPreloadFinished)
|
||||||
end
|
end
|
||||||
@ -236,6 +237,9 @@ function BattleController:enterNextWave()
|
|||||||
end
|
end
|
||||||
|
|
||||||
self.waveIndex = self.waveIndex + 1
|
self.waveIndex = self.waveIndex + 1
|
||||||
|
if self.battleUI then
|
||||||
|
self.battleUI:refreshWave(self.waveIndex)
|
||||||
|
end
|
||||||
if self.waveIndex == 1 then -- 第一波
|
if self.waveIndex == 1 then -- 第一波
|
||||||
self:generateBoard()
|
self:generateBoard()
|
||||||
return
|
return
|
||||||
@ -280,7 +284,11 @@ function BattleController:enterAtkStepOver()
|
|||||||
|
|
||||||
local defTeam = self.battleData:getDefTeam()
|
local defTeam = self.battleData:getDefTeam()
|
||||||
if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑
|
if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑
|
||||||
self:findNextDefUnit()
|
if self.waveIndex >= self.maxWaveIndex() then
|
||||||
|
self:enterRoundEnd()
|
||||||
|
else
|
||||||
|
self:enterRefreshBoard()
|
||||||
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -311,7 +319,11 @@ function BattleController:enterDefStepOver()
|
|||||||
|
|
||||||
local defTeam = self.battleData:getDefTeam()
|
local defTeam = self.battleData:getDefTeam()
|
||||||
if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑
|
if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑
|
||||||
self:enterRefreshBoard()
|
if self.waveIndex >= self.maxWaveIndex() then
|
||||||
|
self:enterRoundEnd()
|
||||||
|
else
|
||||||
|
self:enterRefreshBoard()
|
||||||
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -619,14 +631,14 @@ function BattleController:fillBoard()
|
|||||||
-- local gridType = list[math.random(1, 4)]
|
-- local gridType = list[math.random(1, 4)]
|
||||||
-- self:generateGridType(gridType)
|
-- self:generateGridType(gridType)
|
||||||
-- ModuleManager.BattleManager:showSelectSkillUI(self:getRandomSkillList())
|
-- ModuleManager.BattleManager:showSelectSkillUI(self:getRandomSkillList())
|
||||||
-- self:generateBoard()
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleController:onFillBoardOver()
|
function BattleController:onFillBoardOver()
|
||||||
self:generateSkill()
|
self:generateSkill(function()
|
||||||
self.battleUI:refreshSkill()
|
self.battleUI:refreshSkill()
|
||||||
self:enterRoundEnd()
|
self:enterRoundEnd()
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleController:generateInstructions(skillEntity, elementType, influenceElementType, elementTypeMap)
|
function BattleController:generateInstructions(skillEntity, elementType, influenceElementType, elementTypeMap)
|
||||||
@ -766,20 +778,37 @@ function BattleController:popBoardCacheSkill(callback)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleController:generateSkill()
|
function BattleController:generateSkill(callback)
|
||||||
local map = {}
|
local map = {}
|
||||||
for _, skillEntity in pairs(self.battleData:getSkillEntities()) do
|
for _, skillEntity in pairs(self.battleData:getSkillEntities()) do
|
||||||
if skillEntity:getEnergyEnough() then
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
for elementType, skillId in pairs(map) do
|
if not self.battleUI then
|
||||||
local list = self:getSkillElementList(elementType, 1, true)
|
if callback then
|
||||||
for _, posId in ipairs(list) do
|
callback()
|
||||||
self:setGridSkillId(posId, skillId)
|
|
||||||
end
|
end
|
||||||
|
return
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
function BattleController:setGridSkillId(posId, skillId)
|
function BattleController:setGridSkillId(posId, skillId)
|
||||||
@ -1011,7 +1040,7 @@ function BattleController:getRandomSkillList(getCount)
|
|||||||
local skillWeight = {}
|
local skillWeight = {}
|
||||||
for _, skillId in ipairs(skillPool) do
|
for _, skillId in ipairs(skillPool) do
|
||||||
local skillCfg = cfg[skillId]
|
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
|
if not map[skillId] then
|
||||||
table.insert(newSkillPool, skillId)
|
table.insert(newSkillPool, skillId)
|
||||||
table.insert(skillWeight, skillCfg.weight)
|
table.insert(skillWeight, skillCfg.weight)
|
||||||
@ -1093,7 +1122,6 @@ function BattleController:addHeroAttr(attrName, value)
|
|||||||
-- elseif attrName == then
|
-- elseif attrName == then
|
||||||
-- -- body
|
-- -- body
|
||||||
-- else
|
-- else
|
||||||
|
|
||||||
-- end
|
-- end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1126,6 +1154,13 @@ function BattleController:snapshotBoard()
|
|||||||
return snapshot
|
return snapshot
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleController:addBattleExp(exp)
|
||||||
|
if not self.battleData or not exp then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self.battleData:addExp(exp)
|
||||||
|
end
|
||||||
|
|
||||||
function BattleController:_tick(dt)
|
function BattleController:_tick(dt)
|
||||||
if self.isPause then
|
if self.isPause then
|
||||||
return
|
return
|
||||||
|
|||||||
@ -83,7 +83,22 @@ function BattleControllerStage:findNextDefUnit()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function BattleControllerStage:controllBattleEnd()
|
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
|
end
|
||||||
|
|
||||||
return BattleControllerStage
|
return BattleControllerStage
|
||||||
@ -183,6 +183,34 @@ local _addSkillInInfluenceAtkp = function(skillInfo, battleData, battleControlle
|
|||||||
end
|
end
|
||||||
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 = {
|
BattleRogueSkillHandle._effectOn = {
|
||||||
[1] = _changeBaseSkill, -- 改变初始技能ID
|
[1] = _changeBaseSkill, -- 改变初始技能ID
|
||||||
[2] = _addEliminationRange, -- 增加消除数量
|
[2] = _addEliminationRange, -- 增加消除数量
|
||||||
@ -195,6 +223,8 @@ BattleRogueSkillHandle._effectOn = {
|
|||||||
[9] = _addSkillEffect, -- 获得技能效果
|
[9] = _addSkillEffect, -- 获得技能效果
|
||||||
[10] = _changeElementType, -- 将场上随机几个元素变为某元素
|
[10] = _changeElementType, -- 将场上随机几个元素变为某元素
|
||||||
[11] = _addSkillInInfluenceAtkp, -- 技能消除的增加伤害
|
[11] = _addSkillInInfluenceAtkp, -- 技能消除的增加伤害
|
||||||
|
[12] = _addSkillGeneralAttackEffect, -- 技能链接中的每一个元素,都触发的技能效果
|
||||||
|
[11] = _addSkillElementCountEffect, -- 技能链接中每一个元素累加的技能效果
|
||||||
}
|
}
|
||||||
|
|
||||||
function BattleRogueSkillHandle.takeEffect(skillId, battleData, battleController)
|
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
|
fileFormatVersion: 2
|
||||||
guid: 02d214b08c9e8e249af651ea321569bd
|
guid: 1acc2358f0b9a1d48a45eddba4729b06
|
||||||
ScriptedImporter:
|
ScriptedImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
@ -55,7 +55,7 @@ end
|
|||||||
|
|
||||||
function HeroManager:getSkillIcon(skillId)
|
function HeroManager:getSkillIcon(skillId)
|
||||||
local cfg = ConfigManager:getConfig("skill")[skillId]
|
local cfg = ConfigManager:getConfig("skill")[skillId]
|
||||||
return cfg and cfg.icon
|
return cfg and tostring(cfg.icon)
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroManager:getSkillRogueDesc(skillId)
|
function HeroManager:getSkillRogueDesc(skillId)
|
||||||
|
|||||||
@ -5,6 +5,75 @@ local MIN_CHAPTER_ID = 1
|
|||||||
function ServerChapterData:init(data)
|
function ServerChapterData:init(data)
|
||||||
self.data.chapterId = data and data.chapterId or MIN_CHAPTER_ID
|
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.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
|
end
|
||||||
|
|
||||||
return ServerChapterData
|
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",
|
CROSS_DAY = "CROSS_DAY",
|
||||||
UPDATE_FORMATION = "UPDATE_FORMATION",
|
UPDATE_FORMATION = "UPDATE_FORMATION",
|
||||||
UPGRADE_HERO = "UPGRADE_HERO",
|
UPGRADE_HERO = "UPGRADE_HERO",
|
||||||
|
END_FIGHT = "END_FIGHT",
|
||||||
|
OPEN_CHAPTER_BOX = "OPEN_CHAPTER_BOX",
|
||||||
}
|
}
|
||||||
|
|
||||||
return ServerDataConst
|
return ServerDataConst
|
||||||
@ -4,7 +4,8 @@ local ServerDataManager = {}
|
|||||||
|
|
||||||
function ServerDataManager:init()
|
function ServerDataManager:init()
|
||||||
self.ServerFormationManager = require("app/server/manager/server_formation_manager")
|
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
|
end
|
||||||
|
|
||||||
function ServerDataManager:saveData()
|
function ServerDataManager:saveData()
|
||||||
@ -61,7 +62,9 @@ end
|
|||||||
ServerDataManager.OP_FUNC = {
|
ServerDataManager.OP_FUNC = {
|
||||||
[GConst.ServerDataConst.DATA_OP_BEHAVIOR.SYNC_DATA] = function (...) ServerDataManager:onSyncData(...) end,
|
[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.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)
|
function ServerDataManager:dealGM(params, callback)
|
||||||
|
|||||||
@ -121,6 +121,8 @@ function ServerGameData:addRewards(cfgRewards, getType)
|
|||||||
local cfg = ConfigManager:getItemConfig()[rewardId]
|
local cfg = ConfigManager:getItemConfig()[rewardId]
|
||||||
if cfg.box_drop then
|
if cfg.box_drop then
|
||||||
self:openRewardBox(TempRewards, cfg.box_drop, rewardNum, rewardId)
|
self:openRewardBox(TempRewards, cfg.box_drop, rewardNum, rewardId)
|
||||||
|
elseif cfg.hero_drop then
|
||||||
|
self:openRewardBox(TempRewards, cfg.hero_drop, rewardNum, rewardId)
|
||||||
else
|
else
|
||||||
table.insert(TempRewards, reward)
|
table.insert(TempRewards, reward)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -9,23 +9,6 @@ end
|
|||||||
function BattleResultUI:ctor(params)
|
function BattleResultUI:ctor(params)
|
||||||
self.rewards = params.rewards
|
self.rewards = params.rewards
|
||||||
self.combatReport = params.combatReport
|
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
|
self.totalDmg = 0
|
||||||
if self.combatReport.atkReport then
|
if self.combatReport.atkReport then
|
||||||
for _, info in ipairs(self.combatReport.atkReport) do
|
for _, info in ipairs(self.combatReport.atkReport) do
|
||||||
@ -110,7 +93,7 @@ function BattleResultUI:refreshRewards()
|
|||||||
return GConst.TYPEOF_LUA_CLASS.REWARD_CELL
|
return GConst.TYPEOF_LUA_CLASS.REWARD_CELL
|
||||||
end)
|
end)
|
||||||
self.scrollRect:addRefreshCallback(function(index, cell)
|
self.scrollRect:addRefreshCallback(function(index, cell)
|
||||||
cell:refreshByConfig(self.rewards[index])
|
cell:refresh(self.rewards[index])
|
||||||
end)
|
end)
|
||||||
self.scrollRect:clearCells()
|
self.scrollRect:clearCells()
|
||||||
self.scrollRect:refillCells(#self.rewards)
|
self.scrollRect:refillCells(#self.rewards)
|
||||||
|
|||||||
@ -1,15 +1,9 @@
|
|||||||
local BattleUI = class("BattleUI", BaseUI)
|
local BattleUI = class("BattleUI", BaseUI)
|
||||||
local GRID_CELL = "app/ui/battle/cell/grid_cell"
|
local GRID_CELL = "app/ui/battle/cell/grid_cell"
|
||||||
local GRID_CELL_PATH = "assets/prefabs/ui/battle/cell/grid_cell.prefab"
|
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 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()
|
function BattleUI:getPrefabPath()
|
||||||
return "assets/prefabs/ui/battle/battle_ui.prefab"
|
return "assets/prefabs/ui/battle/battle_ui.prefab"
|
||||||
@ -27,7 +21,8 @@ end
|
|||||||
function BattleUI:_display()
|
function BattleUI:_display()
|
||||||
local uiMap = self.root:genAllChildren()
|
local uiMap = self.root:genAllChildren()
|
||||||
self.uiMap = uiMap
|
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 = uiMap["battle_ui.bg_2.board_mask"]
|
||||||
self.boardMask:setVisible(false)
|
self.boardMask:setVisible(false)
|
||||||
self.boardCacheNode = uiMap["battle_ui.bg_2.board_cache_node"]
|
self.boardCacheNode = uiMap["battle_ui.bg_2.board_cache_node"]
|
||||||
@ -37,6 +32,7 @@ function BattleUI:_display()
|
|||||||
self:initBattlefield()
|
self:initBattlefield()
|
||||||
self:initNumberNode()
|
self:initNumberNode()
|
||||||
self:initHpNode()
|
self:initHpNode()
|
||||||
|
self:hideGenerateSkillGridCells()
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleUI:_addListeners()
|
function BattleUI:_addListeners()
|
||||||
@ -46,26 +42,29 @@ function BattleUI:_addListeners()
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleUI:_bind()
|
||||||
|
self:bind(DataManager.BattleData, "lvDirty", function()
|
||||||
|
self:refreshLv()
|
||||||
|
end, true)
|
||||||
|
end
|
||||||
|
|
||||||
function BattleUI:initSkill()
|
function BattleUI:initSkill()
|
||||||
if self.skillObjs then
|
if self.skillNodeCells then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
self.skillObjs = {}
|
self.skillNodeCells = {}
|
||||||
|
|
||||||
local uiMap = self.root:genAllChildren()
|
local uiMap = self.root:genAllChildren()
|
||||||
for elementType, skillEntity in pairs(DataManager.BattleData:getSkillEntities()) do
|
for name, elementType in pairs(GConst.BattleConst.ELEMENT_TYPE) do
|
||||||
if not self.skillObjs[elementType] then
|
self.skillNodeCells[elementType] = CellManager:addCellComp(uiMap["battle_ui.bg_2.skill_node_cell_" .. elementType], SKILL_NODE_CELL)
|
||||||
local prefix = "battle_ui.bg_2.skill_node_" .. elementType
|
local skillEntity = DataManager.BattleData:getSkillEntities()[elementType]
|
||||||
self.skillObjs[elementType] = {
|
if skillEntity then
|
||||||
icon = uiMap[prefix],
|
self.skillNodeCells[elementType]:refresh(skillEntity)
|
||||||
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())
|
|
||||||
end
|
end
|
||||||
|
self.skillNodeCells[elementType]:getBaseObject():setActive(skillEntity ~= nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
uiMap["battle_ui.bg_2.skill_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT):RefreshLayout()
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleUI:initBattlefield()
|
function BattleUI:initBattlefield()
|
||||||
@ -90,11 +89,10 @@ function BattleUI:getBattleNumber()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function BattleUI:initHpNode()
|
function BattleUI:initHpNode()
|
||||||
self.hpNode = self.uiMap["battle_ui.battle_hp_node"]
|
self.hpProgressLeft = self.uiMap["battle_ui.top_node.bg_l.atk_slider_green"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
|
||||||
self.hpProgressLeft = self.uiMap["battle_ui.battle_hp_node.progress_left"]: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.hpProgressRight = self.uiMap["battle_ui.battle_hp_node.progress_right"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
|
self.hpTextRight = self.uiMap["battle_ui.top_node.atk_hp"]
|
||||||
self.hpTextRight = self.uiMap["battle_ui.battle_hp_node.text_right"]
|
self.hpTextLeft = self.uiMap["battle_ui.top_node.def_hp"]
|
||||||
self.hpTextLeft = self.uiMap["battle_ui.battle_hp_node.text_left"]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleUI:refreshAtkHp(num, percent)
|
function BattleUI:refreshAtkHp(num, percent)
|
||||||
@ -108,21 +106,15 @@ function BattleUI:refreshDefHp(num, percent)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function BattleUI:refreshSkill(elementMap)
|
function BattleUI:refreshSkill(elementMap)
|
||||||
if not self.skillObjs then
|
if not self.skillNodeCells then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
for elementType, skillEntity in pairs(DataManager.BattleData:getSkillEntities()) do
|
for elementType, skillEntity in pairs(DataManager.BattleData:getSkillEntities()) do
|
||||||
if not self.skillObjs[elementType] then
|
if not self.skillNodeCells[elementType] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local add = 0
|
self.skillNodeCells[elementType]:refresh(skillEntity, elementMap)
|
||||||
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
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -242,7 +234,7 @@ function BattleUI:eliminationAni(sequence, callback)
|
|||||||
baseObject:setAnchoredPositionX(DEFAULT_X)
|
baseObject:setAnchoredPositionX(DEFAULT_X)
|
||||||
else
|
else
|
||||||
self.eliminationAniSeq:Insert(index * 0.01, baseObject:getTransform():DOScale(1.3, 0.1))
|
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))
|
self.eliminationAniSeq:Insert(index * 0.01 + 0.2, baseObject:getTransform():DOScale(1, 0.3))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -263,6 +255,62 @@ function BattleUI:eliminationAni(sequence, callback)
|
|||||||
end)
|
end)
|
||||||
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)
|
function BattleUI:fallGrid(listInfo, callback)
|
||||||
self:showMask(false)
|
self:showMask(false)
|
||||||
self.fallAniCount = 0
|
self.fallAniCount = 0
|
||||||
@ -442,6 +490,46 @@ function BattleUI:showMask(show)
|
|||||||
self.boardMask:setVisible(show)
|
self.boardMask:setVisible(show)
|
||||||
end
|
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()
|
function BattleUI:clear()
|
||||||
if self.alreadyClear then
|
if self.alreadyClear then
|
||||||
return
|
return
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
local GridCell = class("GridCell", BaseCell)
|
local GridCell = class("GridCell", BaseCell)
|
||||||
|
|
||||||
function GridCell:refresh(gridEntity, curElement)
|
function GridCell:refresh(gridEntity, curElement)
|
||||||
|
self.gridEntity = gridEntity
|
||||||
local uiMap = self:getUIMap()
|
local uiMap = self:getUIMap()
|
||||||
|
local downBg = uiMap["grid_cell.touch_node.ani_node.down_bg"]
|
||||||
local elementType = gridEntity:getElementType()
|
local elementType = gridEntity:getElementType()
|
||||||
local elementIcon = uiMap["grid_cell.touch_node.ani_node.middle_bg"]
|
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
|
if self.lastElementType ~= elementType then
|
||||||
self.lastElementType = elementType
|
self.lastElementType = elementType
|
||||||
local atlas, icon = ModuleManager.BattleManager:getElementIcon(elementType)
|
local atlas, icon = ModuleManager.BattleManager:getElementIcon(elementType)
|
||||||
elementIcon:setSprite(atlas, icon)
|
elementIcon:setSprite(atlas, icon)
|
||||||
highLightIcon:setSprite(atlas, icon .. "_1")
|
|
||||||
end
|
end
|
||||||
elementIcon:setVisible(true)
|
elementIcon:setVisible(true)
|
||||||
|
|
||||||
@ -29,7 +29,6 @@ function GridCell:refresh(gridEntity, curElement)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local skillIcon = uiMap["grid_cell.touch_node.ani_node.skill_icon"]
|
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()
|
local skillId = gridEntity:getSkillId()
|
||||||
if skillId then
|
if skillId then
|
||||||
elementIcon:setVisible(false)
|
elementIcon:setVisible(false)
|
||||||
@ -40,7 +39,6 @@ function GridCell:refresh(gridEntity, curElement)
|
|||||||
local cfg = ModuleManager.BattleManager.SKILL_HERO_CFG[skillId]
|
local cfg = ModuleManager.BattleManager.SKILL_HERO_CFG[skillId]
|
||||||
if cfg then
|
if cfg then
|
||||||
skillIcon:setSprite(GConst.ATLAS_PATH.ICON_SKILL, tostring(cfg.battle_icon))
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -70,12 +68,39 @@ function GridCell:showCircle(show)
|
|||||||
uiMap["grid_cell.touch_node.ani_node.circle"]:setVisible(show == true)
|
uiMap["grid_cell.touch_node.ani_node.circle"]:setVisible(show == true)
|
||||||
end
|
end
|
||||||
|
|
||||||
function GridCell:showHighLight(show)
|
function GridCell:showHighLight(show, mainElementType)
|
||||||
|
if not self.gridEntity then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local uiMap = self:getUIMap()
|
local uiMap = self:getUIMap()
|
||||||
local highLightIcon = uiMap["grid_cell.touch_node.ani_node.middle_bg.high_light_icon"]
|
local downBg = uiMap["grid_cell.touch_node.ani_node.down_bg"]
|
||||||
local skillHighLightIcon = uiMap["grid_cell.touch_node.ani_node.skill_icon.high_light_icon"]
|
|
||||||
highLightIcon:setVisible(show)
|
local skillId = self.gridEntity:getSkillId()
|
||||||
skillHighLightIcon:setVisible(show)
|
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
|
end
|
||||||
|
|
||||||
function GridCell:resetTranform()
|
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.check = uiMap["hero_cell.hero_bg.mask"]
|
||||||
self.matchImg = uiMap["hero_cell.hero_bg.match_img"]
|
self.matchImg = uiMap["hero_cell.hero_bg.match_img"]
|
||||||
self.infoBtnDesc = uiMap["large_hero_cell.hero_bg.info_btn.desc"]
|
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.isGray = false
|
||||||
|
|
||||||
|
self.useBtnDesc:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_8))
|
||||||
uiMap["large_hero_cell.hero_bg.info_btn"]:addClickListener(function()
|
uiMap["large_hero_cell.hero_bg.info_btn"]:addClickListener(function()
|
||||||
if not self.heroId or not self.matchType then
|
if not self.heroId or not self.matchType then
|
||||||
return
|
return
|
||||||
@ -30,6 +31,13 @@ function LargeHeroCell:refresh(heroEntity, isGray)
|
|||||||
self.matchType = heroEntity:getMatchType()
|
self.matchType = heroEntity:getMatchType()
|
||||||
local heroInfo = heroEntity:getConfig()
|
local heroInfo = heroEntity:getConfig()
|
||||||
self:_refresh(heroInfo, isGray)
|
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
|
end
|
||||||
|
|
||||||
function LargeHeroCell:refreshWithCfgId(id, isGray)
|
function LargeHeroCell:refreshWithCfgId(id, isGray)
|
||||||
@ -37,6 +45,7 @@ function LargeHeroCell:refreshWithCfgId(id, isGray)
|
|||||||
self.heroId = id
|
self.heroId = id
|
||||||
self.matchType = heroInfo.position
|
self.matchType = heroInfo.position
|
||||||
self:_refresh(heroInfo, isGray)
|
self:_refresh(heroInfo, isGray)
|
||||||
|
self.infoBtnDesc:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_9))
|
||||||
end
|
end
|
||||||
|
|
||||||
function LargeHeroCell:_refresh(heroInfo, isGray)
|
function LargeHeroCell:_refresh(heroInfo, isGray)
|
||||||
|
|||||||
@ -14,7 +14,7 @@ function RewardCell:refresh(reward)
|
|||||||
local id
|
local id
|
||||||
if reward.type == GConst.REWARD_TYPE.ITEM then
|
if reward.type == GConst.REWARD_TYPE.ITEM then
|
||||||
self:_refreshItem(reward.item)
|
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
|
-- elseif reward.type == GConst.REWARD_TYPE.EQUIP then
|
||||||
-- self:_refreshEquip(reward.equip)
|
-- self:_refreshEquip(reward.equip)
|
||||||
-- id = reward.equip.id
|
-- id = reward.equip.id
|
||||||
@ -55,7 +55,7 @@ function RewardCell:_refreshItem(item)
|
|||||||
self.numTx:setVisible(true)
|
self.numTx:setVisible(true)
|
||||||
self.frameBg:setSprite(GConst.ATLAS_PATH.ICON_ITEM, "frame_0")
|
self.frameBg:setSprite(GConst.ATLAS_PATH.ICON_ITEM, "frame_0")
|
||||||
self.icon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, info.icon)
|
self.icon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, info.icon)
|
||||||
self.numTx:setText(item.count)
|
self.numTx:setText(item.count or item.num)
|
||||||
end
|
end
|
||||||
|
|
||||||
function RewardCell:_refreshEquip(equip)
|
function RewardCell:_refreshEquip(equip)
|
||||||
|
|||||||
@ -37,7 +37,7 @@ function HeroListCell:refresh(index, heroList, stageFormation, allHeroCount, act
|
|||||||
end
|
end
|
||||||
local heroStartIndex = (index-1)*4 + 1
|
local heroStartIndex = (index-1)*4 + 1
|
||||||
if heroStartIndex > activeCount then
|
if heroStartIndex > activeCount then
|
||||||
heroStartIndex = heroStartIndex - activeCount%4
|
heroStartIndex = heroStartIndex - (4 - activeCount%4)
|
||||||
end
|
end
|
||||||
local heroIndex = heroStartIndex
|
local heroIndex = heroStartIndex
|
||||||
for i = 1, 4 do
|
for i = 1, 4 do
|
||||||
|
|||||||
@ -40,6 +40,18 @@ function HeroComp:init()
|
|||||||
self.content:addClickListener(function()
|
self.content:addClickListener(function()
|
||||||
self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X)
|
self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X)
|
||||||
end)
|
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
|
end
|
||||||
|
|
||||||
function HeroComp:refresh()
|
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())
|
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():setAnchoredPosition(targetPos.x, targetPos.y)
|
||||||
self.largeHeroCell:getBaseObject():getTransform():SetAsLastSibling()
|
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
|
else
|
||||||
ModuleManager.HeroManager:showHeroDetailUI(heroId)
|
ModuleManager.HeroManager:showHeroDetailUI(heroId)
|
||||||
self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X)
|
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.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.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_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()))
|
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 = {
|
local BOX_ICON = {
|
||||||
"common_chest_1",
|
"common_chest_1",
|
||||||
"common_chest_2"
|
"common_chest_4"
|
||||||
}
|
}
|
||||||
|
|
||||||
function MainComp:init()
|
function MainComp:init()
|
||||||
@ -58,7 +58,7 @@ function MainComp:refresh()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function MainComp:onFightBtnClick()
|
function MainComp:onFightBtnClick()
|
||||||
ModuleManager.BattleManager:playBattle(GConst.BattleConst.BATTLE_TYPE.STAGE)
|
ModuleManager.ChapterManager:startFight()
|
||||||
end
|
end
|
||||||
|
|
||||||
function MainComp:refreshChapter(force)
|
function MainComp:refreshChapter(force)
|
||||||
@ -85,15 +85,19 @@ function MainComp:refreshChapter(force)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local curMaxWave = DataManager.ChapterData:getChapterMaxWave()
|
||||||
local boxCount = DataManager.ChapterData:getChapterBoxCount()
|
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
|
for index, objs in ipairs(self.boxObjs) do
|
||||||
local show = boxCount >= index
|
local show = boxCount >= index
|
||||||
objs.box:setActive(show)
|
objs.box:setActive(show)
|
||||||
objs.desc:setActive(show)
|
objs.desc:setActive(show)
|
||||||
if show then
|
if show then
|
||||||
|
local needWave = DataManager.ChapterData:getChapterBoxNum(chapterId, index)
|
||||||
local x = 370 * (index / boxCount)
|
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 num = DataManager.ChapterData:getChapterBoxNum(nil, index)
|
||||||
local rewardGot = DataManager.ChapterData:getChapterBoxRewardGot(nil, index)
|
local rewardGot = DataManager.ChapterData:getChapterBoxRewardGot(nil, index)
|
||||||
local icon = BOX_ICON[1]
|
local icon = BOX_ICON[1]
|
||||||
@ -101,7 +105,11 @@ function MainComp:refreshChapter(force)
|
|||||||
icon = BOX_ICON[2]
|
icon = BOX_ICON[2]
|
||||||
end
|
end
|
||||||
objs.box:addClickListener(function()
|
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)
|
end)
|
||||||
objs.box:setSprite(GConst.ATLAS_PATH.COMMON, icon)
|
objs.box:setSprite(GConst.ATLAS_PATH.COMMON, icon)
|
||||||
objs.box:setAnchoredPositionX(x)
|
objs.box:setAnchoredPositionX(x)
|
||||||
|
|||||||
@ -93,7 +93,7 @@ end
|
|||||||
function MainCityUI:_bind()
|
function MainCityUI:_bind()
|
||||||
self:bind(DataManager.ChapterData, "isDirty", function()
|
self:bind(DataManager.ChapterData, "isDirty", function()
|
||||||
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN then
|
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN then
|
||||||
self.subComps[self.selectedIndex]:refreshChapter()
|
self.subComps[self.selectedIndex]:refreshChapter(true)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
self:bind(DataManager.PlayerData, "dirty", function(binder, value)
|
self:bind(DataManager.PlayerData, "dirty", function(binder, value)
|
||||||
|
|||||||
@ -19,7 +19,7 @@ function RewardsTips:init()
|
|||||||
if not self.rewardCells then
|
if not self.rewardCells then
|
||||||
self.rewardCells = {}
|
self.rewardCells = {}
|
||||||
for i = 1, 3 do
|
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
|
end
|
||||||
end
|
end
|
||||||
@ -38,7 +38,7 @@ function RewardsTips:onRefresh()
|
|||||||
self:closeUI()
|
self:closeUI()
|
||||||
end)
|
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
|
if self.params.rewards then
|
||||||
for i, cell in ipairs(self.rewardCells) do
|
for i, cell in ipairs(self.rewardCells) do
|
||||||
if self.params.rewards[i] then
|
if self.params.rewards[i] then
|
||||||
|
|||||||
@ -5,13 +5,18 @@ local BattleData = class("BattleData", BaseData)
|
|||||||
local SKILL_HERO_CFG = ConfigManager:getConfig("skill")
|
local SKILL_HERO_CFG = ConfigManager:getConfig("skill")
|
||||||
local BattleConst = GConst.BattleConst
|
local BattleConst = GConst.BattleConst
|
||||||
local BATTLE_GRID_ENTITY = require "app/userdata/battle/battle_grid_entity"
|
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 ATTR_TYPE = GConst.ATTR_TYPE
|
||||||
local DEFAULT_FACTOR = BattleConst.DEFAULT_FACTOR
|
local DEFAULT_FACTOR = BattleConst.DEFAULT_FACTOR
|
||||||
|
|
||||||
function BattleData:init()
|
function BattleData:init()
|
||||||
self:clear()
|
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.atkTeam = self:initTeam(BattleConst.SIDE_ATK)
|
||||||
self.defTeam = self:initTeam(BattleConst.SIDE_DEF)
|
self.defTeam = self:initTeam(BattleConst.SIDE_DEF)
|
||||||
self:initRogueSkills()
|
self:initRogueSkills()
|
||||||
@ -297,6 +302,46 @@ function BattleData:clearCacheBoardSkill()
|
|||||||
self.cacheSkillCount = 0
|
self.cacheSkillCount = 0
|
||||||
end
|
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)
|
function BattleData:initTeam(side)
|
||||||
local data = nil
|
local data = nil
|
||||||
if side == BattleConst.SIDE_ATK then
|
if side == BattleConst.SIDE_ATK then
|
||||||
|
|||||||
@ -6,6 +6,8 @@ function BattleBoardSkillEnity:ctor(skillId)
|
|||||||
self.addRange = {}
|
self.addRange = {}
|
||||||
self.linkAtkp = 0
|
self.linkAtkp = 0
|
||||||
self.inInfluenceAtkp = 0
|
self.inInfluenceAtkp = 0
|
||||||
|
self.generalAttackEffect = {}
|
||||||
|
self.elementCountEffect = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleBoardSkillEnity:refreshSkillId(skillId)
|
function BattleBoardSkillEnity:refreshSkillId(skillId)
|
||||||
@ -167,4 +169,28 @@ function BattleBoardSkillEnity:addInInfluenceAtkp(atkp)
|
|||||||
self.inInfluenceAtkp = self.inInfluenceAtkp + atkp
|
self.inInfluenceAtkp = self.inInfluenceAtkp + atkp
|
||||||
end
|
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
|
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 = {}
|
self.data.chapterFightInfo = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChapterData:init(data)
|
function ChapterData:init(data, notChangeChapterId)
|
||||||
self.data.chapterId = data and data.chapterId or MIN_CHAPTER_ID
|
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.maxChapterId = data and data.maxChapterId or self.data.chapterId - 1
|
||||||
-- self.data.chapterBoxInfo = {}
|
self.data.chapterBoxInfo = data and data.chapterBoxInfo or {}
|
||||||
-- self.data.chapterFightInfo = {}
|
self.data.chapterFightInfo = data and data.chapterFightInfo or {}
|
||||||
|
end
|
||||||
|
|
||||||
|
function ChapterData:setDirty()
|
||||||
|
self.data.isDirty = not self.data.isDirty
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChapterData:getChapterId()
|
function ChapterData:getChapterId()
|
||||||
@ -83,18 +89,6 @@ function ChapterData:getChapterBoxNum(chapterId, index)
|
|||||||
end
|
end
|
||||||
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)
|
function ChapterData:getChapterBoxRewardGot(chapterId, index)
|
||||||
chapterId = tostring(chapterId or self:getChapterId())
|
chapterId = tostring(chapterId or self:getChapterId())
|
||||||
local list = self.data.chapterBoxInfo[chapterId]
|
local list = self.data.chapterBoxInfo[chapterId]
|
||||||
@ -111,6 +105,18 @@ function ChapterData:getChapterBoxRewardGot(chapterId, index)
|
|||||||
return false
|
return false
|
||||||
end
|
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)
|
function ChapterData:getChapterMaxWave(chapterId)
|
||||||
chapterId = tostring(chapterId or self:getChapterId())
|
chapterId = tostring(chapterId or self:getChapterId())
|
||||||
if self.data.chapterFightInfo[chapterId] then
|
if self.data.chapterFightInfo[chapterId] then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user