From aa9b35d053b53e0233e0c39c9636a4b2cfa73c81 Mon Sep 17 00:00:00 2001 From: puxuan <413323644@qq.com> Date: Fri, 15 Aug 2025 17:33:57 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=93=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/module/battle/battle_const.lua | 12 +-- .../controller/battle_base_controller.lua | 2 +- lua/app/module/hero/hero_manager.lua | 2 +- lua/app/ui/battle/battle_base_ui.lua | 34 +++---- lua/app/ui/battle/battle_result_ui.lua | 94 ++----------------- 5 files changed, 33 insertions(+), 111 deletions(-) diff --git a/lua/app/module/battle/battle_const.lua b/lua/app/module/battle/battle_const.lua index 47d89da7..1e58b56f 100644 --- a/lua/app/module/battle/battle_const.lua +++ b/lua/app/module/battle/battle_const.lua @@ -1001,17 +1001,17 @@ BattleConst.INSTRUCTION_NAME = { } BattleConst.OUTLINE_SFX = { - [BattleConst.ELEMENT_TYPE.RED] = "sfx_piece_qizi_b03", - [BattleConst.ELEMENT_TYPE.YELLOW] = "sfx_piece_qizi_b02", - [BattleConst.ELEMENT_TYPE.GREEN] = "sfx_piece_qizi_b04", - [BattleConst.ELEMENT_TYPE.BLUE] = "sfx_piece_qizi_b05", - [BattleConst.ELEMENT_TYPE.PURPLE] = "sfx_piece_qizi_b01", + [BattleConst.ELEMENT_TYPE.RED] = "sfx_c1_ui_qizi_b01", + [BattleConst.ELEMENT_TYPE.YELLOW] = "sfx_c1_ui_qizi_b02", + [BattleConst.ELEMENT_TYPE.GREEN] = "sfx_c1_ui_qizi_b03", + [BattleConst.ELEMENT_TYPE.BLUE] = "sfx_c1_ui_qizi_b04", + [BattleConst.ELEMENT_TYPE.PURPLE] = "sfx_c1_ui_qizi_b05", skill = "sfx_piece_qizi_b06", } BattleConst.SKILL_LIGHT_POINT_SFX = "assets/prefabs/effects/battle/sfx_skill_b05.prefab" BattleConst.SKILL_LIGHT_LINE_SFX = "assets/prefabs/effects/battle/sfx_skill_b04.prefab" -BattleConst.LINE_SFX = "assets/prefabs/effects/battle/sfx_piece_line_b01.prefab" +BattleConst.LINE_SFX = "assets/prefabs/effects/ui/sfx_c1_ui_line_b0%s.prefab" BattleConst.CHANGE_ELEMENT_SFX = "assets/prefabs/effects/battle/sfx_skill_b02.prefab" BattleConst.LINK_SMOKE = "assets/prefabs/effects/battle/sfx_piece_smoke_b01.prefab" BattleConst.LINK_SMOKE = "assets/prefabs/effects/battle/sfx_piece_smoke_b01.prefab" diff --git a/lua/app/module/battle/controller/battle_base_controller.lua b/lua/app/module/battle/controller/battle_base_controller.lua index 20c27dad..7230d940 100644 --- a/lua/app/module/battle/controller/battle_base_controller.lua +++ b/lua/app/module/battle/controller/battle_base_controller.lua @@ -309,7 +309,7 @@ function BattleBaseController:onLinkChange() end if index < count then local nextPosId = sequence[index + 1].posId - self.battleUI:getSfxLine(index, function(obj) + self.battleUI:getSfxLine(mainElementType, index, function(obj) local curPos = self:getPosInfo(info.posId) local nextPos = self:getPosInfo(nextPosId) local pos, z = ModuleManager.BattleManager:getPosCenterAndDir(curPos, nextPos) diff --git a/lua/app/module/hero/hero_manager.lua b/lua/app/module/hero/hero_manager.lua index fea57789..56c9336d 100644 --- a/lua/app/module/hero/hero_manager.lua +++ b/lua/app/module/hero/hero_manager.lua @@ -151,7 +151,7 @@ end function HeroManager:getSkillRogueBattleBg(skillId) local cfg = ConfigManager:getConfig("skill_rogue")[skillId] - return cfg and "battle_rouge_board_" .. cfg.qlt + return cfg and "battle_bg_" .. (cfg.qlt + 5) end function HeroManager:getSkillRogueBg(skillId, onlyQlt) diff --git a/lua/app/ui/battle/battle_base_ui.lua b/lua/app/ui/battle/battle_base_ui.lua index 999d202b..d3e0ffd4 100644 --- a/lua/app/ui/battle/battle_base_ui.lua +++ b/lua/app/ui/battle/battle_base_ui.lua @@ -2148,24 +2148,23 @@ end function BattleBaseUI:refreshWave(wave, iconAtlas, iconName) end -function BattleBaseUI:getSfxLine(index, func) +function BattleBaseUI:getSfxLine(elementType, index, func) self.hidingAllSfxLine = false - if not self.root.lineSfxObjs then - self.root.lineSfxObjs = {} - end - if self.root.lineSfxObjs[index] then - if self.root.lineSfxObjs[index].obj and func then - local obj = self.root.lineSfxObjs[index].obj - obj:setActive(true) - func(obj) - end + self.root.lineSfxObjs = self.root.lineSfxObjs or {} + self.root.lineSfxObjs[elementType] = self.root.lineSfxObjs[elementType] or {} + if self.root.lineSfxObjs[elementType] and self.root.lineSfxObjs[elementType][index] and self.root.lineSfxObjs[elementType][index].obj and func then + local obj = self.root.lineSfxObjs[elementType][index].obj + obj:setActive(true) + func(obj) else - self.root.lineSfxObjs[index] = { + self.root.lineSfxObjs[elementType][index] = { isLoaded = true } - EffectManager:loadUIEffectAsync(GConst.BattleConst.LINE_SFX, self, self.gridNode, BOARD_SFX_ORDER, function(obj) - self.root.lineSfxObjs[index].obj = obj + local path = string.format(GConst.BattleConst.LINE_SFX, elementType) + EffectManager:loadUIEffectAsync(path, self, self.gridNode, BOARD_SFX_ORDER, function(obj) + obj.elementType = elementType + self.root.lineSfxObjs[elementType][index].obj = obj if self.hidingAllSfxLine then obj:setActive(false) else @@ -2182,10 +2181,13 @@ function BattleBaseUI:hideAllSfxLine() if not self.root.lineSfxObjs then return end - for inde, info in pairs(self.root.lineSfxObjs) do - if info.obj then - info.obj:setActive(false) + for _, list in pairs(self.root.lineSfxObjs) do + for _, info in ipairs(list) do + if info.obj then + info.obj:setActive(false) + end end + end end diff --git a/lua/app/ui/battle/battle_result_ui.lua b/lua/app/ui/battle/battle_result_ui.lua index b2f1f30b..031ef77d 100644 --- a/lua/app/ui/battle/battle_result_ui.lua +++ b/lua/app/ui/battle/battle_result_ui.lua @@ -30,7 +30,6 @@ function BattleResultUI:ctor(params) self.incrScore = params.incrScore self.arenaTotalCount = params.arenaTotalCount - self.isTryShowGoldPig = false self.totalDmg = 0 if self.atkReport then for _, info in ipairs(self.atkReport) do @@ -52,9 +51,6 @@ function BattleResultUI:onClose() if self.animNode then self.animNode:Kill() end - if self.animPig then - self.animPig:Kill() - end if self.animRewards then for idx, anim in pairs(self.animRewards) do if anim then @@ -94,8 +90,8 @@ function BattleResultUI:onLoadRootComplete() self.unitTxDesc1 = uiMap["battle_result_ui.unit_node.desc_1"] self.unitTxDesc2 = uiMap["battle_result_ui.unit_node.desc_2"] self.unitTxDesc3 = uiMap["battle_result_ui.unit_node.desc_3"] - self.unitImgReportV = uiMap["battle_result_ui.unit_node.report_img_v"] - self.unitImgReportD = uiMap["battle_result_ui.unit_node.report_img_d"] + -- self.unitImgReportV = uiMap["battle_result_ui.unit_node.report_img_v"] + -- self.unitImgReportD = uiMap["battle_result_ui.unit_node.report_img_d"] if not self.unitResultReportCells then self.unitResultReportCells = {} for index = 1, 5 do @@ -107,15 +103,6 @@ function BattleResultUI:onLoadRootComplete() self.rewardTxTitle = uiMap["battle_result_ui.reward_node.reward_title"] self.rewardScrollRect = uiMap["battle_result_ui.reward_node.scroll_rect"] self.rewardScrollRectComp = self.rewardScrollRect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE) - -- 金猪存钱罐 - self.goldPigNode = uiMap["battle_result_ui.gold_pig"] - self.goldPigTxGem = uiMap["battle_result_ui.gold_pig.gem_bg.gem_tx"] - self.goldPigSlider = uiMap["battle_result_ui.gold_pig.slider_bg.slider"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER) - self.goldPigTxSlider = uiMap["battle_result_ui.gold_pig.slider_bg.text"] - self.goldPigImgGem = uiMap["battle_result_ui.gold_pig.gem_bg.gem_img"] - -- self.goldPigSpine = uiMap["battle_result_ui.gold_pig.spine_pig"] - self.goldPigGem = uiMap["battle_result_ui.gold_pig.gem_bg"] - self.canvasGroupPigGem = self.goldPigGem:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP) -- 竞技场 self.arenaNode = uiMap["battle_result_ui.arena_node"] self.arenaSpineRoot = uiMap["battle_result_ui.arena_node.spine_root"] @@ -147,13 +134,7 @@ function BattleResultUI:onLoadRootComplete() end function BattleResultUI:onClickMask() - if self.isTryShowGoldPig then - ModuleManager.BattleManager:endBattleAndExit() - else - if not self:tryShowGoldPig() then - ModuleManager.BattleManager:endBattleAndExit() - end - end + ModuleManager.BattleManager:endBattleAndExit() end function BattleResultUI:onRefresh() @@ -172,9 +153,9 @@ end function BattleResultUI:refreshVictoryNode() self.victoryNode:setVisible(true) - self.unitImgReportV:setVisible(true) + -- self.unitImgReportV:setVisible(true) self.defeatNode:setVisible(false) - self.unitImgReportD:setVisible(false) + -- self.unitImgReportD:setVisible(false) self.victoryTxTitle:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_5)) -- self.victorySpine:playAnimComplete("born", false, true, function() @@ -190,9 +171,9 @@ end function BattleResultUI:refreshDefeatNode() self.victoryNode:setVisible(false) - self.unitImgReportV:setVisible(false) + -- self.unitImgReportV:setVisible(false) self.defeatNode:setVisible(true) - self.unitImgReportD:setVisible(true) + -- self.unitImgReportD:setVisible(true) self.defeatTxTitle:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_6)) -- self.defeatSpine:playAnimComplete("born", false, true, function() @@ -359,7 +340,6 @@ end function BattleResultUI:refreshRewards() self.animRewards = {} self.rewardNode:setVisible(true) - self.goldPigNode:setVisible(false) self.rewardTxTitle:setText(I18N:getGlobalText(I18N.GlobalConst.REWARD_DESC)) self.continue:setText(I18N:getGlobalText(I18N.GlobalConst.CONTINUE_DESC)) @@ -439,66 +419,6 @@ function BattleResultUI:refreshUnitInfo() GFunc.centerImgAndTx(self.unitImgBattleIcon, self.unitTxDesc2, 7) end -function BattleResultUI:tryShowGoldPig() - self.isTryShowGoldPig = true - if self.battleType ~= GConst.BattleConst.BATTLE_TYPE.STAGE then - return false - end - if not DataManager.GoldPigData:getIsOpen() then - return false - end - self.rewardNode:setVisible(false) - self.goldPigNode:setVisible(true) - local lastGemCount = DataManager.GoldPigData:getLastCount() - local currGemCount = DataManager.GoldPigData:getCount() - local maxGemCount = DataManager.GoldPigData:getMaxCount() - if lastGemCount > currGemCount then - lastGemCount = currGemCount - end - - self.animPig = self.root:createBindTweenSequence() - self.animPig:Insert(0, self.canvasGroupPigGem:DOFade(0, 0)) - self.animPig:Insert(1.5, self.canvasGroupPigGem:DOFade(1, 0.3)) - self.animPig:SetAutoKill(false) - self.animPig:OnComplete(function() - self.animPig = nil - end) - - -- self.goldPigSpine:playAnimComplete("idle1", false, false, function() - -- self.goldPigSpine:playAnim("idle2", true, false) - -- end) - - self.goldPigTxGem:setText("+" .. currGemCount - lastGemCount) - GFunc.centerImgAndTx(self.goldPigImgGem, self.goldPigTxGem, 0, -4) - if currGemCount > lastGemCount then - self.sliderSequence = DOTweenManager:createSeqWithIntId() - local curProgress = 0 - local remain = currGemCount - lastGemCount - local startPercent = lastGemCount / maxGemCount - local remainPercent = currGemCount / maxGemCount - startPercent - self.goldPigSlider.value = startPercent - self.goldPigTxSlider:setText(lastGemCount .. "/" .. currGemCount) - local tween = DOTweenManager:createDOTweenTo( - function() - return curProgress - end, - function(value) - curProgress = value - self.goldPigSlider.value = startPercent + remainPercent*curProgress - self.goldPigTxSlider:setText(lastGemCount + math.floor(remain*curProgress) .. "/" .. maxGemCount) - end, - 1, 1) - self.sliderSequence:Append(tween) - self.sliderSequence:AppendCallback(function() - self.sliderSequence = nil - end) - else -- 相等就不跑动画了 - self.goldPigSlider.value = currGemCount / maxGemCount - self.goldPigTxSlider:setText(currGemCount .. "/" .. maxGemCount) - end - return true -end - -- 展示结算奖励的出现动画 function BattleResultUI:showRewardAppearAnim(idx, cell) local canvasGroup = cell.baseObject:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)