章节障碍物和棋盘地图
This commit is contained in:
parent
f8044eb0de
commit
c30fe950b2
@ -161,6 +161,15 @@ function BattleController:onEliminationBegin()
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---- 障碍格子图片
|
||||||
|
function BattleController:getBlockIcon()
|
||||||
|
return "battle_hinder_4"
|
||||||
|
end
|
||||||
|
|
||||||
|
function BattleController:getChessBoardBgName()
|
||||||
|
return "chessboard_1"
|
||||||
|
end
|
||||||
|
|
||||||
-- *************各个子模块的战斗需要重写的方法 END*************
|
-- *************各个子模块的战斗需要重写的方法 END*************
|
||||||
|
|
||||||
function BattleController:ctor()
|
function BattleController:ctor()
|
||||||
@ -258,6 +267,7 @@ function BattleController:prepareFight()
|
|||||||
self.battleUI:getBattleNumberBlue())
|
self.battleUI:getBattleNumberBlue())
|
||||||
self:initAtkUnits(onPreloadFinished)
|
self:initAtkUnits(onPreloadFinished)
|
||||||
self:initDefUnits(onPreloadFinished)
|
self:initDefUnits(onPreloadFinished)
|
||||||
|
self.battleUI:refreshChessBoard(self:getChessBoardBgName())
|
||||||
end)
|
end)
|
||||||
BattleHelper:setBaseOrder(self.battleUI:getUIOrder())
|
BattleHelper:setBaseOrder(self.battleUI:getUIOrder())
|
||||||
self:loadOtherRes(onPreloadFinished)
|
self:loadOtherRes(onPreloadFinished)
|
||||||
@ -1145,7 +1155,7 @@ function BattleController:generateBoard(isFirst)
|
|||||||
self.curBoardIndex = (self.curBoardIndex or 0) + 1
|
self.curBoardIndex = (self.curBoardIndex or 0) + 1
|
||||||
local board = boardList[self.curBoardIndex]
|
local board = boardList[self.curBoardIndex]
|
||||||
self.battleUI:switchBoard(function()
|
self.battleUI:switchBoard(function()
|
||||||
self.battleData:refreshBoard(board)
|
self.battleData:refreshBoard(board, self:getBlockIcon())
|
||||||
self.battleUI:initGridCell()
|
self.battleUI:initGridCell()
|
||||||
end, function()
|
end, function()
|
||||||
-- self:enterRoundBegin()
|
-- self:enterRoundBegin()
|
||||||
|
|||||||
@ -8,11 +8,30 @@ function BattleControllerStage:getChapterId()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function BattleControllerStage:getMaxWave()
|
function BattleControllerStage:getMaxWave()
|
||||||
local chapterId = DataManager.ChapterData:getChapterId()
|
local chapterInfo = ConfigManager:getConfig("chapter")[self.chapterId]
|
||||||
local chapterInfo = ConfigManager:getConfig("chapter")[chapterId]
|
if not chapterInfo then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
return #chapterInfo.monster
|
return #chapterInfo.monster
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleControllerStage:getBlockIcon()
|
||||||
|
local chapterInfo = ConfigManager:getConfig("chapter")[self.chapterId]
|
||||||
|
if not chapterInfo then
|
||||||
|
return "battle_hinder_4"
|
||||||
|
end
|
||||||
|
return chapterInfo.block_icon
|
||||||
|
end
|
||||||
|
|
||||||
|
function BattleControllerStage:getChessBoardBgName()
|
||||||
|
local chapterInfo = ConfigManager:getConfig("chapter")[self.chapterId]
|
||||||
|
if not chapterInfo then
|
||||||
|
return "chessboard_1"
|
||||||
|
end
|
||||||
|
return chapterInfo.chess_board
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function BattleController:initOther()
|
function BattleController:initOther()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
local BattleSkillSelectUI = class("BattleSkillSelectUI", BaseUI)
|
local BattleSkillSelectUI = class("BattleSkillSelectUI", BaseUI)
|
||||||
|
|
||||||
local SELECT_SKILL_CELL = "app/ui/battle/cell/battle_select_skill_cell"
|
local SELECT_SKILL_CELL = "app/ui/battle/cell/battle_select_skill_cell"
|
||||||
|
local BATTLE_COMMON_PATH = "assets/arts/textures/background/battle_common/%s.png"
|
||||||
|
|
||||||
local SKILL_ICON_POS = {
|
local SKILL_ICON_POS = {
|
||||||
{x =-240, y= 165},
|
{x =-240, y= 165},
|
||||||
@ -32,7 +33,16 @@ end
|
|||||||
function BattleSkillSelectUI:_display()
|
function BattleSkillSelectUI:_display()
|
||||||
local uiMap = self.root:genAllChildren()
|
local uiMap = self.root:genAllChildren()
|
||||||
uiMap["battle_skill_select_ui.skill_node.ad_btn.tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_3))
|
uiMap["battle_skill_select_ui.skill_node.ad_btn.tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_3))
|
||||||
uiMap["battle_skill_select_ui.bg_1"]:setVisible(true)
|
local bg = uiMap["battle_skill_select_ui.bg_1"]
|
||||||
|
if ModuleManager.BattleManager.battleController then
|
||||||
|
bg:setVisible(false)
|
||||||
|
bg:setTexture(string.format(BATTLE_COMMON_PATH, ModuleManager.BattleManager.battleController:getChessBoardBgName() .. "_1"), function()
|
||||||
|
bg:setVisible(true)
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
bg:setVisible(true)
|
||||||
|
end
|
||||||
|
|
||||||
self:refreshRogueSkill()
|
self:refreshRogueSkill()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
local UIPrefabObject = require "app/bf/unity/uiprefab_object"
|
local UIPrefabObject = require "app/bf/unity/uiprefab_object"
|
||||||
|
|
||||||
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"
|
||||||
@ -14,6 +13,7 @@ local CacheVector2 = CS.UnityEngine.Vector2(0, 0)
|
|||||||
|
|
||||||
local CACHE_SKILL_POS_1 = {x = 0, y = 360}
|
local CACHE_SKILL_POS_1 = {x = 0, y = 360}
|
||||||
local CACHE_SKILL_POS_2 = {x = 0, y = 420}
|
local CACHE_SKILL_POS_2 = {x = 0, y = 420}
|
||||||
|
local BATTLE_COMMON_PATH = "assets/arts/textures/background/battle_common/%s.png"
|
||||||
|
|
||||||
function BattleUI:getPrefabPath()
|
function BattleUI:getPrefabPath()
|
||||||
return "assets/prefabs/ui/battle/battle_ui.prefab"
|
return "assets/prefabs/ui/battle/battle_ui.prefab"
|
||||||
@ -38,6 +38,7 @@ function BattleUI:_display()
|
|||||||
self.uiMap = uiMap
|
self.uiMap = uiMap
|
||||||
self.gridNode = uiMap["battle_ui.bg_2.board_node.grid_node"]
|
self.gridNode = uiMap["battle_ui.bg_2.board_node.grid_node"]
|
||||||
self.boardNode = uiMap["battle_ui.bg_2.board_node"]
|
self.boardNode = uiMap["battle_ui.bg_2.board_node"]
|
||||||
|
self.boardNode:setAnchoredPositionX(DEFAULT_X)
|
||||||
self.boardMask2D = self.gridNode:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_RECT_MASK_2D)
|
self.boardMask2D = self.gridNode:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_RECT_MASK_2D)
|
||||||
self.boardMask = uiMap["battle_ui.bg_2.board_node.grid_node.board_mask"]
|
self.boardMask = uiMap["battle_ui.bg_2.board_node.grid_node.board_mask"]
|
||||||
self.boardMask:setVisible(false)
|
self.boardMask:setVisible(false)
|
||||||
@ -85,6 +86,12 @@ function BattleUI:initBg()
|
|||||||
self.bg:setAnchoredPositionX(width/4)
|
self.bg:setAnchoredPositionX(width/4)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleUI:refreshChessBoard(boardBg)
|
||||||
|
self.boardNode:setTexture(string.format(BATTLE_COMMON_PATH, boardBg), function()
|
||||||
|
self.boardNode:setAnchoredPositionX(0)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
function BattleUI:loadBg(bgName)
|
function BattleUI:loadBg(bgName)
|
||||||
self.bg:setTexture(string.format(BG_PATH, bgName), function()
|
self.bg:setTexture(string.format(BG_PATH, bgName), function()
|
||||||
self.bg:setLocalScale(1, 1, 1)
|
self.bg:setLocalScale(1, 1, 1)
|
||||||
|
|||||||
@ -20,7 +20,12 @@ function GridCell:refresh(gridEntity, curElement, skillPosId)
|
|||||||
self.curElement = curElement
|
self.curElement = curElement
|
||||||
|
|
||||||
|
|
||||||
uiMap["grid_cell.touch_node.ani_node.obstacle"]:setVisible(gridEntity:isObstacleType())
|
local obstacleObj = uiMap["grid_cell.touch_node.ani_node.obstacle"]
|
||||||
|
obstacleObj:setVisible(gridEntity:isObstacleType())
|
||||||
|
if self.lastObstacleIcon ~= gridEntity:getObstacleIcon() then
|
||||||
|
self.lastObstacleIcon = gridEntity:getObstacleIcon()
|
||||||
|
obstacleObj:setSprite(GConst.ATLAS_PATH.BATTLE, self.lastObstacleIcon)
|
||||||
|
end
|
||||||
|
|
||||||
if self.lastGridType ~= gridEntity:getGridType() then
|
if self.lastGridType ~= gridEntity:getGridType() then
|
||||||
self.lastGridType = gridEntity:getGridType()
|
self.lastGridType = gridEntity:getGridType()
|
||||||
|
|||||||
@ -116,7 +116,7 @@ function BattleData:initRogueSkills()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleData:refreshBoard(board)
|
function BattleData:refreshBoard(board, blockIcon)
|
||||||
self.elementTypeMap = {}
|
self.elementTypeMap = {}
|
||||||
for i, info in ipairs(board) do
|
for i, info in ipairs(board) do
|
||||||
local r = 1
|
local r = 1
|
||||||
@ -148,6 +148,7 @@ function BattleData:refreshBoard(board)
|
|||||||
self.elementTypeMap[data.elementType] = (self.elementTypeMap[data.elementType] or 0) + 1
|
self.elementTypeMap[data.elementType] = (self.elementTypeMap[data.elementType] or 0) + 1
|
||||||
end
|
end
|
||||||
self.gridEntities[data.posId]:determineIdleStatus()
|
self.gridEntities[data.posId]:determineIdleStatus()
|
||||||
|
self.gridEntities[data.posId]:setObstacleIcon(blockIcon)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -226,4 +226,16 @@ function BattleGridEntity:determineIdleStatus()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleGridEntity:getObstacleIcon()
|
||||||
|
if not self.obstacleIcon then
|
||||||
|
return "battle_hinder_1"
|
||||||
|
end
|
||||||
|
|
||||||
|
return self.obstacleIcon
|
||||||
|
end
|
||||||
|
|
||||||
|
function BattleGridEntity:setObstacleIcon(icon)
|
||||||
|
self.obstacleIcon = icon
|
||||||
|
end
|
||||||
|
|
||||||
return BattleGridEntity
|
return BattleGridEntity
|
||||||
Loading…
x
Reference in New Issue
Block a user