Merge branch 'dev' of git.juzugame.com:b6-client/b6-lua into dev

This commit is contained in:
chenxi 2023-04-26 10:20:35 +08:00
commit 8fc0090b76
6 changed files with 152 additions and 44 deletions

View File

@ -14,10 +14,6 @@ function BattleManager:showPauseUI()
UIManager:showUI("app/ui/battle/battle_pause_ui")
end
function BattleManager:showSelectSkillUI(skillList)
UIManager:showUI(UIManager.UI_PATH.ROGUE_SKILL_UI, {skillList = skillList})
end
function BattleManager:showBattleResultUI(rewards, combatReport)
UIManager:showUI("app/ui/battle/battle_result_ui", {rewards = rewards, combatReport = combatReport})
end

View File

@ -1038,7 +1038,7 @@ end
function BattleUnitComp:onSkillTakeEffect(skill)
skill:endUse()
if skill:getIsEliminateType() then
self.battleController:generateGridType(skill:getEliminateSkillParameter())
self.battleController:generateGridType(skill:getEliminateSkillParameter(), self.baseObject:getTransform().position)
end
local effectList = skill:getEffectList()
if effectList == nil then

View File

@ -405,11 +405,11 @@ function BattleController:enterElimination(needDelay)
if self.battleData:useAddlvCount() then
if needDelay then
self.showSelectSkillSid = ModuleManager.BattleManager:performWithDelayGlobal(function()
ModuleManager.BattleManager:showSelectSkillUI(self:getRandomSkillList())
self.battleUI:showSelectSkillComp(self:getRandomSkillList())
self.showSelectSkillSid = nil
end, 0.3)
else
ModuleManager.BattleManager:showSelectSkillUI(self:getRandomSkillList())
self.battleUI:showSelectSkillComp(self:getRandomSkillList())
end
else
-- 检查棋盘
@ -1249,7 +1249,7 @@ function BattleController:setGridSkillId(posId, skillId)
end
end
function BattleController:generateGridType(skillTypeParameter)
function BattleController:generateGridType(skillTypeParameter, monsterPos)
if not skillTypeParameter then
return
end
@ -1264,11 +1264,21 @@ function BattleController:generateGridType(skillTypeParameter)
end
list = table.shuffle(list)
if count > 0 then
local map = {}
local minCount = math.min(skillTypeParameter[2], count)
for i = minCount, 1, -1 do
local entity = table.remove(list, math.random(1, i))
self.battleData:setGridInfo(entity:getPosId(), {gridType = skillTypeParameter[1], elementType = entity:getElementType()})
map[entity:getPosId()] = {
gridType = skillTypeParameter[1],
elementType = entity:getElementType()
}
end
self.battleUI:showMonsterSkillAni(map, monsterPos, function()
for posId, info in pairs(map) do
self.battleData:setGridInfo(posId, info)
end
end)
end
end

View File

@ -1,4 +1,4 @@
local BattleSkillSelectUI = class("BattleSkillSelectUI", BaseUI)
local BattleSkillSelectComp = class("BattleSkillSelectComp", LuaComponent)
local SELECT_SKILL_CELL = "app/ui/battle/cell/battle_select_skill_cell"
local BATTLE_COMMON_PATH = "assets/arts/textures/background/battle_common/%s.png"
@ -9,31 +9,17 @@ local SKILL_ICON_POS = {
{x =-240, y= -165}
}
function BattleSkillSelectUI:isFullScreen()
return false
end
function BattleSkillSelectUI:showCommonBG()
return false
end
function BattleSkillSelectUI:getPrefabPath()
return "assets/prefabs/ui/battle/battle_skill_select_ui.prefab"
end
function BattleSkillSelectUI:ctor(params)
self.skillList = params.skillList or {}
end
function BattleSkillSelectUI:onLoadRootComplete()
function BattleSkillSelectComp:refresh(skillList)
self.skillList = skillList
self:_playPop()
self:_display()
self:_addListeners()
end
function BattleSkillSelectUI:_display()
local uiMap = self.root:genAllChildren()
uiMap["battle_skill_select_ui.skill_node.ad_btn.tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_3))
local bg = uiMap["battle_skill_select_ui.bg_1"]
function BattleSkillSelectComp:_display()
local uiMap = self:getUIMap()
uiMap["battle_select_skill_comp.skill_node.ad_btn.tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_3))
local bg = uiMap["battle_select_skill_comp.bg_1"]
if ModuleManager.BattleManager.battleController then
bg:setVisible(false)
bg:setTexture(string.format(BATTLE_COMMON_PATH, ModuleManager.BattleManager.battleController:getChessBoardBgName() .. "_1"), function()
@ -46,9 +32,9 @@ function BattleSkillSelectUI:_display()
self:refreshRogueSkill()
end
function BattleSkillSelectUI:_addListeners()
local uiMap = self.root:genAllChildren()
uiMap["battle_skill_select_ui.skill_node.ad_btn"]:addClickListener(function()
function BattleSkillSelectComp:_addListeners()
local uiMap = self:getUIMap()
uiMap["battle_select_skill_comp.skill_node.ad_btn"]:addClickListener(function()
if not ModuleManager.BattleManager.battleController then
return
end
@ -59,10 +45,10 @@ function BattleSkillSelectUI:_addListeners()
end)
end)
self.canvasGroup = uiMap["battle_skill_select_ui.skill_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
self.canvasGroup = uiMap["battle_select_skill_comp.skill_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
self.canvasGroup.alpha = 1
self.bg = uiMap["battle_skill_select_ui.bg_1"]
uiMap["battle_skill_select_ui.look_btn"]:addTouchListener(function(eventType, x, y)
self.bg = uiMap["battle_select_skill_comp.bg_1"]
uiMap["battle_select_skill_comp.look_btn"]:addTouchListener(function(eventType, x, y)
if eventType == GConst.TOUCH_EVENT.DOWN or eventType == GConst.TOUCH_EVENT.DRAG then
self.canvasGroup.alpha = 0.3
self.bg:setVisible(false)
@ -73,12 +59,12 @@ function BattleSkillSelectUI:_addListeners()
end)
end
function BattleSkillSelectUI:refreshRogueSkill()
local uiMap = self.root:genAllChildren()
function BattleSkillSelectComp:refreshRogueSkill()
local uiMap = self:getUIMap()
if not self.selectSkillCells then
self.selectSkillCells = {}
for i = 1, 3 do
self.selectSkillCells[i] = CellManager:addCellComp(uiMap["battle_skill_select_ui.skill_node.skill_select_cell_" .. i], SELECT_SKILL_CELL)
self.selectSkillCells[i] = CellManager:addCellComp(uiMap["battle_select_skill_comp.skill_node.skill_select_cell_" .. i], SELECT_SKILL_CELL)
end
end
@ -93,9 +79,32 @@ function BattleSkillSelectUI:refreshRogueSkill()
end
end
function BattleSkillSelectUI:onClickSkill(skillId, value, pos)
self:closeUI()
function BattleSkillSelectComp:onClickSkill(skillId, value, pos)
if self.isInAni then
return
end
self:hide()
ModuleManager.BattleManager:onSelectSkill(skillId, value, pos)
end
return BattleSkillSelectUI
function BattleSkillSelectComp:hide()
self.baseObject:setVisible(false)
end
function BattleSkillSelectComp:_playPop()
self.isInAni = true
self.popSequence = self.baseObject:createBindTweenSequence()
local scaleTween1 = self.baseObject:getTransform():DOScale(1.05, 0.15)
self.popSequence:Append(scaleTween1)
local scaleTween2 = self.baseObject:getTransform():DOScale(1, 0.2)
self.popSequence:Append(scaleTween2)
self.popSequence:AppendCallback(function()
self.isInAni = false
self.popSequence = nil
end)
end
return BattleSkillSelectComp

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 9489f9db09c66f74691dba45aa6ef6fa
guid: e9999623abbb58541a25612464750444
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}

View File

@ -4,6 +4,7 @@ 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 BATTLE_SELECT_SKILL_COMP = "app/ui/battle/battle_skill_select_comp"
local DEFAULT_X = 10000
local BOARD_POS_UP = BF.Vector2(0, 47)
@ -60,6 +61,7 @@ function BattleUI:_display()
self:hideAllSfxSmoke()
self:initSkillLineSfx()
self:initGenerateSkillEffect()
self:initSelectSkillNode()
end
function BattleUI:_addListeners()
@ -854,6 +856,74 @@ function BattleUI:hideGenerateSkillGridCells()
end
end
function BattleUI:showMonsterSkillAni(map, monsterPos, callback)
if table.nums(map) <= 0 then
if callback then
callback()
end
return
end
self:hideMonsterSkillGridCells()
if self.monsterSkillAniSeq then
self.monsterSkillAniSeq:Kill()
self.monsterSkillAniSeq = nil
end
local sPoint = UIManager:getUICameraComponent():WorldToScreenPoint(monsterPos)
monsterPos = CS.BF.Utils.RectTransformScreenPointToLocalPointInRectangle(self.boardNode:getTransform(), sPoint.x, sPoint.y, UIManager:getUICameraComponent())
self.monsterSkillAniSeq = self.root:createBindTweenSequence()
local count = 1
for posId, info in pairs(map) do
local entity = self.monsterSkillGridEntities[count]
if entity and entity:getCell() then
entity:setGridType(info.gridType)
entity:setElementType(GConst.BattleConst.ELEMENT_TYPE.EMPTY)
count = count + 1
local cell = entity:getCell()
cell:refresh(entity)
cell:getBaseObject():setAnchoredPosition(monsterPos.x, monsterPos.y)
cell:getBaseObject():setLocalScale(0.3, 0.3, 0.3)
local pos = ModuleManager.BattleManager:getPosInfo(posId)
if count == 1 then
self.monsterSkillAniSeq:Append(cell:getBaseObject():getTransform():DOAnchorPos(pos, 0.3))
else
self.monsterSkillAniSeq:Join(cell:getBaseObject():getTransform():DOAnchorPos(pos, 0.3))
end
self.monsterSkillAniSeq:Join(cell:getBaseObject():getTransform():DOScale(1, 0.3))
end
end
self.monsterSkillAniSeq:AppendCallback(function()
if callback then
callback()
end
self:hideMonsterSkillGridCells()
end)
end
function BattleUI:hideMonsterSkillGridCells()
if not self.monsterSkillGridEntities then
local uiMap = self.root:genAllChildren()
self.monsterSkillGridEntities = {}
for name, elementType in pairs(GConst.BattleConst.ELEMENT_TYPE) do
local obj = uiMap["battle_ui.bg_2.ani_node.grid_cell_m" .. elementType]
if obj then
local cell = CellManager:addCellComp(obj, GRID_CELL)
local entity = DataManager.BattleData:getNewGridEntity()
entity:setCell(cell)
self.monsterSkillGridEntities[elementType] = entity
end
end
end
for _, entity in pairs(self.monsterSkillGridEntities) do
if entity:getCell() then
entity:getCell():getBaseObject():setAnchoredPositionX(DEFAULT_X)
end
end
end
function BattleUI:initGenerateSkillEffect()
if not self.generateSkillSfxs then
local uiMap = self.root:genAllChildren()
@ -1581,6 +1651,24 @@ function BattleUI:showTutorialFinger(posIdList)
self.showTutorialFingerSeq:SetLoops(-1)
end
function BattleUI:initSelectSkillNode()
if not self.selectSkillComp then
local uiMap = self.root:genAllChildren()
local obj = uiMap["battle_ui.bg_2.battle_select_skill_comp"]
obj:initPrefabHelper()
obj:genAllChildren()
self.selectSkillComp = obj:addLuaComponent(BATTLE_SELECT_SKILL_COMP)
self.selectSkillComp:hide()
end
end
function BattleUI:showSelectSkillComp(skillList)
if not self.selectSkillComp then
return
end
self.selectSkillComp:refresh(skillList)
end
function BattleUI:clear()
if self.alreadyClear then
return
@ -1671,6 +1759,11 @@ function BattleUI:clear()
self.cacheSkillAniSeq:Kill()
self.cacheSkillAniSeq = nil
end
if self.monsterSkillAniSeq then
self.monsterSkillAniSeq:Kill()
self.monsterSkillAniSeq = nil
end
end
return BattleUI