From 159a3d1a1555039d6c7edce94d0ae05b62b76cdc Mon Sep 17 00:00:00 2001 From: puxuan <413323644@qq.com> Date: Sat, 8 Nov 2025 15:47:39 +0800 Subject: [PATCH] fix bug --- .../battle/controller/battle_base_controller.lua | 9 +++++++++ lua/app/ui/battle/battle_base_ui.lua | 13 ++++++++----- lua/app/ui/battle/battle_result_ui.lua | 13 +++++++++---- lua/app/ui/battle/battle_ui_pvp.lua | 3 +++ lua/app/ui/summon/summon_main_ui.lua | 4 ++-- lua/app/userdata/hero/hero_entity.lua | 2 ++ 6 files changed, 33 insertions(+), 11 deletions(-) diff --git a/lua/app/module/battle/controller/battle_base_controller.lua b/lua/app/module/battle/controller/battle_base_controller.lua index 93591ebb..354ad771 100644 --- a/lua/app/module/battle/controller/battle_base_controller.lua +++ b/lua/app/module/battle/controller/battle_base_controller.lua @@ -100,6 +100,14 @@ function BattleBaseController:getChessBoardBgName() return chapterInfo.chess_board end +function BattleBaseController:getIcon() + local chapterInfo = self:getChapterConfig()[self.chapterId] + if not chapterInfo then + return "chapter_1" + end + return chapterInfo.icon +end + function BattleBaseController:getScene() local chapterInfo = self:getChapterConfig()[self.chapterId] if not chapterInfo then @@ -733,6 +741,7 @@ function BattleBaseController:prepareFight() self:initAtkUnits(onPreloadFinished) self:initDefUnits(onPreloadFinished) self.battleUI:refreshChessBoard(self:getChessBoardBgName()) + self.battleUI:initChapterBg(self:getIcon()) self.battleUI:loadBg(self:getScene()) end) BattleHelper:setBaseOrder(self.battleUI:getUIOrder()) diff --git a/lua/app/ui/battle/battle_base_ui.lua b/lua/app/ui/battle/battle_base_ui.lua index 688e0b55..fb9d94a2 100644 --- a/lua/app/ui/battle/battle_base_ui.lua +++ b/lua/app/ui/battle/battle_base_ui.lua @@ -289,7 +289,7 @@ function BattleBaseUI:_display() self:initBossEnterAni() self:initCounterAttack() self:initTouchCancel() - self:initChapterBg() + -- self:initChapterBg() self:initSpeedBtn() self:hideMonsterSkillGridCells() end @@ -1253,10 +1253,13 @@ function BattleBaseUI:refreshSkill(elementMap, showSfx, side) end end -function BattleBaseUI:initChapterBg() - local chapterId = DataManager.ChapterData:getChapterId() - local icon = DataManager.ChapterData:getChapterCfg()[chapterId].icon - local scene = DataManager.ChapterData:getChapterCfg()[chapterId].scene +function BattleBaseUI:initChapterBg(icon) + if not icon then + return + end + -- local chapterId = DataManager.ChapterData:getChapterId() + -- local icon = DataManager.ChapterData:getChapterCfg()[chapterId].icon + -- local scene = DataManager.ChapterData:getChapterCfg()[chapterId].scene -- self.bg:setTexture(string.format(CHAPTER_PATH, scene)) local bgPath = string.format(CHAPTER_BG_PATH, icon) CellManager:loadCellAsync(bgPath, CHAPTER_BG_COMP, self.mapNode, function(cell) diff --git a/lua/app/ui/battle/battle_result_ui.lua b/lua/app/ui/battle/battle_result_ui.lua index 032c4c0e..73325ae0 100644 --- a/lua/app/ui/battle/battle_result_ui.lua +++ b/lua/app/ui/battle/battle_result_ui.lua @@ -95,6 +95,7 @@ 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.unitTxDesc4 = uiMap["battle_result_ui.unit_node.desc_4"] -- 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 @@ -379,6 +380,8 @@ function BattleResultUI:refreshRewards() self.rewardNode:setVisible(true) self.rewardTxTitle:setText(I18N:getGlobalText(I18N.GlobalConst.REWARD_DESC)) + local txW = self.rewardTxTitle:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredWidth + self.rewardTxTitle:setSizeDeltaX(math.min(txW, 134)) -- self.continue:setText(I18N:getGlobalText(I18N.GlobalConst.CONTINUE_DESC)) self.rewardScrollRectComp:addInitCallback(function() return GConst.TYPEOF_LUA_CLASS.REWARD_CELL @@ -443,18 +446,20 @@ function BattleResultUI:refreshUnitInfo() end self.unitTxDesc2:setText(self.wave) - self.unitTxDesc3:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_7, GFunc.num2Str(self.totalDmg))) + self.unitTxDesc3:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_7, "")) + self.unitTxDesc4:setText(GFunc.num2Str(self.totalDmg)) + GFunc.centerTxAndTx(self.unitTxDesc3, self.unitTxDesc4, 0) - local iconName = "common_dec_3" + local iconName = "battle_dec_1" if self.battleType == GConst.BattleConst.BATTLE_TYPE.DUNGEON_GOLD then - iconName = "common_dec_3" + -- iconName = "common_dec_3" local round = self.remainRound or 0 self.unitTxDesc2:setText(round) self.unitTxDesc1:setText(I18N:getGlobalText(I18N.GlobalConst.ROUND_LEFT)) else self.unitTxDesc1:setText(GConst.EMPTY_STRING) end - self.unitImgBattleIcon:setSprite(GConst.ATLAS_PATH.COMMON, iconName, function() + self.unitImgBattleIcon:setSprite(GConst.ATLAS_PATH.BATTLE, iconName, function() self.unitImgBattleIcon:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE):SetNativeSize() end) diff --git a/lua/app/ui/battle/battle_ui_pvp.lua b/lua/app/ui/battle/battle_ui_pvp.lua index 138f06d3..1862fa21 100644 --- a/lua/app/ui/battle/battle_ui_pvp.lua +++ b/lua/app/ui/battle/battle_ui_pvp.lua @@ -243,6 +243,9 @@ function BattleUIPVP:loadBg(bgName) self.bg:setLocalScale(1, 1, 1) end +function BattleUIPVP:initChapterBg() +end + function BattleUIPVP:showLeftBuffTips(buffList, autoClose) local addY = self:showBuffTips(buffList, autoClose) self.battleBuffTipsBg:setAnchoredPosition(-175, -1050 + addY) diff --git a/lua/app/ui/summon/summon_main_ui.lua b/lua/app/ui/summon/summon_main_ui.lua index c5288b94..d16cc8f1 100755 --- a/lua/app/ui/summon/summon_main_ui.lua +++ b/lua/app/ui/summon/summon_main_ui.lua @@ -226,6 +226,7 @@ function SummonMainUI:onLoadRootComplete() self:updateTime() self:refreshShopItem() + self:refreshSkip() end --每秒刷新单抽红点 @@ -245,7 +246,6 @@ end --刷新 function SummonMainUI:onRefresh() - self:refreshSkip() self:refreshSummonBtn() self:refreshSummonDesc() -- self:refreshBtnRedPoint() @@ -508,7 +508,7 @@ function SummonMainUI:onSummonRsp(result, newHero) end self.aniSeq:AppendInterval(1.5) self.aniSeq:AppendCallback(function() - self.touchNodeDescTx:setActive(self.canSkip1) + self.touchNodeDescTx:setActive(self.canSkip1 and #self.summonResult ~= 1) self.showIdx = 1 self:showHero() end) diff --git a/lua/app/userdata/hero/hero_entity.lua b/lua/app/userdata/hero/hero_entity.lua index 509a15fd..a51284d5 100644 --- a/lua/app/userdata/hero/hero_entity.lua +++ b/lua/app/userdata/hero/hero_entity.lua @@ -128,6 +128,7 @@ function HeroEntity:_updateAllAttr() local allAtkP = self:getGlobalAttrByType(GConst.ATTR_ALL.ATTR_ATKP_ALL) self.allAttr[atkType] = math.floor(atk * (1 + (factorValue + allFactorValue + allAtkP) / GConst.DEFAULT_FACTOR) + 0.0000001) self.allAttr[GConst.MATCH_ATTACK_ADD_NAME[self:getMatchType()]] = nil + self.allAttr[GConst.ATTR_PERSIONAL.ATTR_ATK] = nil -- 生命(百分比) local hpType = GConst.MATCH_HP_NAME[self:getMatchType()] @@ -143,6 +144,7 @@ function HeroEntity:_updateAllAttr() local allHpP = self:getGlobalAttrByType(GConst.ATTR_ALL.ATTR_HPP_ALL) self.allAttr[hpType] = math.floor(hp * (1 + (factorValue + allFactorValue + allHpP) / GConst.DEFAULT_FACTOR) + 0.0000001) self.allAttr[GConst.MATCH_HP_ADD_NAME[self:getMatchType()]] = nil + self.allAttr[GConst.ATTR_PERSIONAL.ATTR_HP] = nil self.allAttr[ATTR_NAME.DMGDEC] = (self.allAttr[ATTR_NAME.DMGDEC] or 0) + self:getGlobalAttrByType(GConst.ATTR_ALL.ATTR_DMGDEC_ALL) self.allAttr[GConst.MATCH_CRIT_NAME[self:getMatchType()]] = (self.allAttr[GConst.MATCH_CRIT_NAME[self:getMatchType()]] or 0) + self:getGlobalAttrByType(GConst.ATTR_ALL.ATTR_CRIT_ALL)