This commit is contained in:
puxuan 2025-11-08 15:47:39 +08:00
parent eec5738408
commit 159a3d1a15
6 changed files with 33 additions and 11 deletions

View File

@ -100,6 +100,14 @@ function BattleBaseController:getChessBoardBgName()
return chapterInfo.chess_board return chapterInfo.chess_board
end 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() function BattleBaseController:getScene()
local chapterInfo = self:getChapterConfig()[self.chapterId] local chapterInfo = self:getChapterConfig()[self.chapterId]
if not chapterInfo then if not chapterInfo then
@ -733,6 +741,7 @@ function BattleBaseController:prepareFight()
self:initAtkUnits(onPreloadFinished) self:initAtkUnits(onPreloadFinished)
self:initDefUnits(onPreloadFinished) self:initDefUnits(onPreloadFinished)
self.battleUI:refreshChessBoard(self:getChessBoardBgName()) self.battleUI:refreshChessBoard(self:getChessBoardBgName())
self.battleUI:initChapterBg(self:getIcon())
self.battleUI:loadBg(self:getScene()) self.battleUI:loadBg(self:getScene())
end) end)
BattleHelper:setBaseOrder(self.battleUI:getUIOrder()) BattleHelper:setBaseOrder(self.battleUI:getUIOrder())

View File

@ -289,7 +289,7 @@ function BattleBaseUI:_display()
self:initBossEnterAni() self:initBossEnterAni()
self:initCounterAttack() self:initCounterAttack()
self:initTouchCancel() self:initTouchCancel()
self:initChapterBg() -- self:initChapterBg()
self:initSpeedBtn() self:initSpeedBtn()
self:hideMonsterSkillGridCells() self:hideMonsterSkillGridCells()
end end
@ -1253,10 +1253,13 @@ function BattleBaseUI:refreshSkill(elementMap, showSfx, side)
end end
end end
function BattleBaseUI:initChapterBg() function BattleBaseUI:initChapterBg(icon)
local chapterId = DataManager.ChapterData:getChapterId() if not icon then
local icon = DataManager.ChapterData:getChapterCfg()[chapterId].icon return
local scene = DataManager.ChapterData:getChapterCfg()[chapterId].scene 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)) -- self.bg:setTexture(string.format(CHAPTER_PATH, scene))
local bgPath = string.format(CHAPTER_BG_PATH, icon) local bgPath = string.format(CHAPTER_BG_PATH, icon)
CellManager:loadCellAsync(bgPath, CHAPTER_BG_COMP, self.mapNode, function(cell) CellManager:loadCellAsync(bgPath, CHAPTER_BG_COMP, self.mapNode, function(cell)

View File

@ -95,6 +95,7 @@ function BattleResultUI:onLoadRootComplete()
self.unitTxDesc1 = uiMap["battle_result_ui.unit_node.desc_1"] self.unitTxDesc1 = uiMap["battle_result_ui.unit_node.desc_1"]
self.unitTxDesc2 = uiMap["battle_result_ui.unit_node.desc_2"] self.unitTxDesc2 = uiMap["battle_result_ui.unit_node.desc_2"]
self.unitTxDesc3 = uiMap["battle_result_ui.unit_node.desc_3"] 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.unitImgReportV = uiMap["battle_result_ui.unit_node.report_img_v"]
-- self.unitImgReportD = uiMap["battle_result_ui.unit_node.report_img_d"] -- self.unitImgReportD = uiMap["battle_result_ui.unit_node.report_img_d"]
if not self.unitResultReportCells then if not self.unitResultReportCells then
@ -379,6 +380,8 @@ function BattleResultUI:refreshRewards()
self.rewardNode:setVisible(true) self.rewardNode:setVisible(true)
self.rewardTxTitle:setText(I18N:getGlobalText(I18N.GlobalConst.REWARD_DESC)) 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.continue:setText(I18N:getGlobalText(I18N.GlobalConst.CONTINUE_DESC))
self.rewardScrollRectComp:addInitCallback(function() self.rewardScrollRectComp:addInitCallback(function()
return GConst.TYPEOF_LUA_CLASS.REWARD_CELL return GConst.TYPEOF_LUA_CLASS.REWARD_CELL
@ -443,18 +446,20 @@ function BattleResultUI:refreshUnitInfo()
end end
self.unitTxDesc2:setText(self.wave) 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 if self.battleType == GConst.BattleConst.BATTLE_TYPE.DUNGEON_GOLD then
iconName = "common_dec_3" -- iconName = "common_dec_3"
local round = self.remainRound or 0 local round = self.remainRound or 0
self.unitTxDesc2:setText(round) self.unitTxDesc2:setText(round)
self.unitTxDesc1:setText(I18N:getGlobalText(I18N.GlobalConst.ROUND_LEFT)) self.unitTxDesc1:setText(I18N:getGlobalText(I18N.GlobalConst.ROUND_LEFT))
else else
self.unitTxDesc1:setText(GConst.EMPTY_STRING) self.unitTxDesc1:setText(GConst.EMPTY_STRING)
end 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() self.unitImgBattleIcon:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE):SetNativeSize()
end) end)

View File

@ -243,6 +243,9 @@ function BattleUIPVP:loadBg(bgName)
self.bg:setLocalScale(1, 1, 1) self.bg:setLocalScale(1, 1, 1)
end end
function BattleUIPVP:initChapterBg()
end
function BattleUIPVP:showLeftBuffTips(buffList, autoClose) function BattleUIPVP:showLeftBuffTips(buffList, autoClose)
local addY = self:showBuffTips(buffList, autoClose) local addY = self:showBuffTips(buffList, autoClose)
self.battleBuffTipsBg:setAnchoredPosition(-175, -1050 + addY) self.battleBuffTipsBg:setAnchoredPosition(-175, -1050 + addY)

View File

@ -226,6 +226,7 @@ function SummonMainUI:onLoadRootComplete()
self:updateTime() self:updateTime()
self:refreshShopItem() self:refreshShopItem()
self:refreshSkip()
end end
--每秒刷新单抽红点 --每秒刷新单抽红点
@ -245,7 +246,6 @@ end
--刷新 --刷新
function SummonMainUI:onRefresh() function SummonMainUI:onRefresh()
self:refreshSkip()
self:refreshSummonBtn() self:refreshSummonBtn()
self:refreshSummonDesc() self:refreshSummonDesc()
-- self:refreshBtnRedPoint() -- self:refreshBtnRedPoint()
@ -508,7 +508,7 @@ function SummonMainUI:onSummonRsp(result, newHero)
end end
self.aniSeq:AppendInterval(1.5) self.aniSeq:AppendInterval(1.5)
self.aniSeq:AppendCallback(function() self.aniSeq:AppendCallback(function()
self.touchNodeDescTx:setActive(self.canSkip1) self.touchNodeDescTx:setActive(self.canSkip1 and #self.summonResult ~= 1)
self.showIdx = 1 self.showIdx = 1
self:showHero() self:showHero()
end) end)

View File

@ -128,6 +128,7 @@ function HeroEntity:_updateAllAttr()
local allAtkP = self:getGlobalAttrByType(GConst.ATTR_ALL.ATTR_ATKP_ALL) 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[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.MATCH_ATTACK_ADD_NAME[self:getMatchType()]] = nil
self.allAttr[GConst.ATTR_PERSIONAL.ATTR_ATK] = nil
-- 生命(百分比) -- 生命(百分比)
local hpType = GConst.MATCH_HP_NAME[self:getMatchType()] 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) 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[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.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[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) 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)