This commit is contained in:
xiekaidong 2023-04-23 15:29:22 +08:00
parent d8bf6274d8
commit 495f02084d
5 changed files with 68 additions and 11 deletions

View File

@ -37,12 +37,12 @@ function BattleManager:_play(battleType, params)
self.battleController:init(params)
end
function BattleManager:onSelectSkill(skillId, value)
function BattleManager:onSelectSkill(skillId, value, pos)
if not self.battleController then
return
end
self.battleController:onSelectSkill(skillId, value)
self.battleController:onSelectSkill(skillId, value, pos)
end
function BattleManager:endBattleAndExit()

View File

@ -1488,7 +1488,7 @@ function BattleController:getRandomSkillList(getCount)
return result
end
function BattleController:onSelectSkill(skillId, value)
function BattleController:onSelectSkill(skillId, value, pos)
self.battleData:addSkillCount(skillId, value)
BATTLE_ROGUE_SKILL_HANDLE.takeEffect(skillId, self.battleData, self, value)
@ -1497,11 +1497,19 @@ function BattleController:onSelectSkill(skillId, value)
entity:gotUpSKill(skillId)
end
self:enterElimination()
local elementType = ModuleManager.HeroManager:getSkillRoguePosition(skillId)
if elementType then
if self.battleUI then
self.battleUI:gotOneSkillAni(skillId, elementType, function()
self:enterElimination()
self.battleUI:refreshBoard()
self.battleUI:refreshSkill()
end, pos)
else
self:enterElimination()
end
else
self:enterElimination()
end
end

View File

@ -101,6 +101,11 @@ function HeroManager:getSkillRogueBg(skillId)
return cfg and "frame_" .. cfg.qlt
end
function HeroManager:getSkillRoguePosition(skillId)
local cfg = ConfigManager:getConfig("skill_rogue")[skillId]
return cfg and cfg.skill_position
end
function HeroManager:getActiveRogueLvs()
if not self.activeRogueLvs then
self.activeRogueLvs = {}

View File

@ -2,6 +2,12 @@ local BattleSkillSelectUI = class("BattleSkillSelectUI", BaseUI)
local SELECT_SKILL_CELL = "app/ui/battle/cell/battle_select_skill_cell"
local SKILL_ICON_POS = {
{x =-240, y= 165},
{x =-240, y= 0},
{x =-240, y= -165}
}
function BattleSkillSelectUI:isFullScreen()
return false
end
@ -71,15 +77,15 @@ function BattleSkillSelectUI:refreshRogueSkill()
cell:getBaseObject():setActive(skillId ~= nil)
if skillId then
cell:refresh(skillId, function(value)
self:onClickSkill(skillId, value)
self:onClickSkill(skillId, value, SKILL_ICON_POS[index])
end)
end
end
end
function BattleSkillSelectUI:onClickSkill(skillId, value)
function BattleSkillSelectUI:onClickSkill(skillId, value, pos)
self:closeUI()
ModuleManager.BattleManager:onSelectSkill(skillId, value)
ModuleManager.BattleManager:onSelectSkill(skillId, value, pos)
end
return BattleSkillSelectUI

View File

@ -4,6 +4,7 @@ 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 SELECT_SKILL_CELL = "app/ui/battle/cell/select_skill_cell"
local DEFAULT_X = 10000
local BOARD_POS_UP = BF.Vector2(0, 47)
@ -54,6 +55,7 @@ function BattleUI:_display()
self:hideGenerateSkillGridCells()
self:initTutorialNode()
self:initUISfxs()
self:initSkillSelectCells()
end
function BattleUI:_addListeners()
@ -815,6 +817,42 @@ function BattleUI:hideGenerateSkillGridCells()
end
end
function BattleUI:gotOneSkillAni(skillId, elementType, callback, startPos)
if not skillId or not self.skillSelectCell then
if callback then
callback()
end
return
end
self.skillSelectCell:refresh(skillId)
self.skillSelectCell:getBaseObject():setAnchoredPosition(startPos.x, startPos.y)
self.skillSelectCell:getBaseObject():setVisible(true)
if self.gotOneSkillAniSeq then
self.gotOneSkillAniSeq:Kill()
self.gotOneSkillAniSeq = nil
end
self.gotOneSkillAniSeq = self.root:createBindTweenSequence()
local pos = self:getElementSkillPos(elementType)
self.gotOneSkillAniSeq:Append(self.skillSelectCell:getBaseObject():getTransform():DOAnchorPos(pos, 0.7))
self.gotOneSkillAniSeq:Join(self.skillSelectCell:getBaseObject():getTransform():DOScale(0.76, 0.7))
self.gotOneSkillAniSeq:AppendCallback(function()
self.skillSelectCell:getBaseObject():setAnchoredPositionX(DEFAULT_X)
if callback then
callback()
end
end)
end
function BattleUI:initSkillSelectCells()
if not self.skillSelectCell then
local uiMap = self.root:genAllChildren()
self.skillSelectCell = CellManager:addCellComp(uiMap["battle_ui.bg_2.ani_node.skill_select_cell"], SELECT_SKILL_CELL)
self.skillSelectCell:getBaseObject():setAnchoredPositionX(DEFAULT_X)
end
end
function BattleUI:shuffleBoard(changeInfo, callback)
if self.shuffleBoardSeq then
self.shuffleBoardSeq:Kill()