diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index 9655de3b..f66c5772 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -1201,8 +1201,8 @@ function BattleController:setGridSkillId(posId, skillId) end end -function BattleController:generateGridType(gridType) - if not gridType then +function BattleController:generateGridType(skillTypeParameter) + if not skillTypeParameter then return end @@ -1215,8 +1215,11 @@ function BattleController:generateGridType(gridType) end end if count > 0 then - local entity = list[math.random(1, count)] - self.battleData:setGridInfo(entity:getPosId(), {gridType = gridType, elementType = entity:getElementType()}) + 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()}) + end end end diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index 980048dc..8faa24ff 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -56,6 +56,7 @@ function BattleUI:_display() self:initTutorialNode() self:initUISfxs() self:initSkillSelectCells() + self:hideAllSfxSmoke() end function BattleUI:_addListeners() @@ -727,9 +728,7 @@ function BattleUI:eliminationAni(sequence, callback) for index, info in ipairs(sequence) do if not self.posIdMap[info.posId] then - self:getSfxSmoke(index, function(obj) - obj:play() - end) + local pos = ModuleManager.BattleManager:getPosInfo(info.posId) self.posIdMap[info.posId] = true local entity = DataManager.BattleData:getGridEntity(info.posId) @@ -740,6 +739,12 @@ function BattleUI:eliminationAni(sequence, callback) baseObject:setAnchoredPositionX(DEFAULT_X) else self.eliminationAniSeq:Insert(index * 0.01, baseObject:getTransform():DOScale(1.3, 0.1)) + self.eliminationAniSeq:InsertCallback(index * 0.01 + 0.2, function() + self:getSfxSmoke(index, function(obj) + obj:setAnchoredPosition(pos.x, pos.y) + obj:play() + end) + end) 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(0.5, 0.3)) end @@ -1244,7 +1249,8 @@ function BattleUI:getSfxSmoke(index, func) } EffectManager:loadUIEffectAsync(GConst.BattleConst.LINK_SMOKE, self, self.gridNode, 11, function(obj) self.root.smokeSfxObjs[index].obj = obj - if self.hidingAllSfxLine then + obj:setLocalScale(1.5, 1.5, 1.5) + if self.hidingAllSfxSmoke then obj:setActive(false) else if func then @@ -1296,6 +1302,16 @@ function BattleUI:initUISfxs() end end end + + if self.root.smokeSfxObjs then + for index, info in pairs(self.root.smokeSfxObjs) do + if info.obj then + info.obj:setActive(true) + info.obj:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_EFFECT_HELPER):SetSortingOrder(self:getUIOrder(), 11) + info.obj:setActive(false) + end + end + end end function BattleUI:showTutorialFinger(posIdList)