From 9752a8ff72b332917011bc75efa5d9bb172ef74c Mon Sep 17 00:00:00 2001 From: puxuan <413323644@qq.com> Date: Fri, 15 Aug 2025 20:18:13 +0800 Subject: [PATCH] c --- .../localization_global_const.lua | 4 +-- lua/app/config/strings/cn/global.lua | 4 +-- lua/app/ui/main_city/component/main_comp.lua | 32 +++++++++++++++---- lua/app/ui/summon/summon_main_ui.lua | 4 +-- 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/lua/app/config/localization/localization_global_const.lua b/lua/app/config/localization/localization_global_const.lua index 96ec44d6..02a84f28 100644 --- a/lua/app/config/localization/localization_global_const.lua +++ b/lua/app/config/localization/localization_global_const.lua @@ -640,8 +640,8 @@ local LocalizationGlobalConst = ITEM_NOT_ENOUGH_DESC = "ITEM_NOT_ENOUGH_DESC", SUMMON_ONE = "SUMMON_ONE", SUMMON_TEN = "SUMMON_TEN", - FREE_THIS_TIME_DESC_1 = "FREE_THIS_TIME_DESC_1", - SUMMON_DESC_22 = "SUMMON_DESC_22", + FREE_DESC_1 = "FREE_DESC_1", + SUMMON_DESC_1 = "SUMMON_DESC_1", SUMMON_WISH_OK = "SUMMON_WISH_OK", SUMMON_WISH_TITLE = "SUMMON_WISH_TITLE", SUMMON_WISH_UNSELECT = "SUMMON_WISH_UNSELECT", diff --git a/lua/app/config/strings/cn/global.lua b/lua/app/config/strings/cn/global.lua index d4f0c64b..c2799681 100644 --- a/lua/app/config/strings/cn/global.lua +++ b/lua/app/config/strings/cn/global.lua @@ -640,8 +640,8 @@ local localization_global = ["ITEM_NOT_ENOUGH_DESC"] = "是否使用钻石*{0}补充魔法石*{1},进行召唤?", ["SUMMON_ONE"] = "召唤1次", ["SUMMON_TEN"] = "召唤10次", - ["FREE_THIS_TIME_DESC_1"] = "本次免费", - ["SUMMON_DESC_22"] = "点击广告召唤", + ["FREE_DESC_1"] = "本次免费", + ["SUMMON_DESC_1"] = "点击广告召唤", ["SUMMON_WISH_OK"] = "确定选择", ["SUMMON_WISH_TITLE"] = "心愿英雄", ["SUMMON_WISH_UNSELECT"] = "暂未选择", diff --git a/lua/app/ui/main_city/component/main_comp.lua b/lua/app/ui/main_city/component/main_comp.lua index 5dd80f17..eb3b7c09 100644 --- a/lua/app/ui/main_city/component/main_comp.lua +++ b/lua/app/ui/main_city/component/main_comp.lua @@ -4,14 +4,9 @@ local UISpineObject = require "app/bf/unity/ui_spine_object" -- local CHAPTER_PATH = "assets/arts/textures/background/chapter/%s.png" local HERO_SPINE_ASSET_PATH = "assets/arts/spines/characters/%s/%s_skeletondata.asset" -local CHAPTER_PATH = "assets/arts/textures/background/main/%s.png" +local CHAPTER_PATH = "assets/arts/prefabs/ui/chapter/%s.prefab" local CHAPTER_PAGE = 5 -local BOX_ICON = { - "common_chest_1", - "common_chest_4" -} - function MainComp:onOpen() self.startMonsterAction = true if self.bossNode then @@ -60,6 +55,7 @@ function MainComp:init() -- uiMap["main_comp.right_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE)) uiMap["main_comp.left_btn.text"]:setText("游历") uiMap["main_comp.right_btn.text"]:setText("限时祈愿") + self.backGroundNode = uiMap["main_comp.back_ground"] self.chapterBg = uiMap["main_comp.bg"] self.chapterBg:setAnchoredPositionX(-720) @@ -163,6 +159,8 @@ function MainComp:init() local chapterId = DataManager.ChapterData:getChapterId() self.chapterPage = DataManager.ChapterData:getChapterPage(chapterId) self.chapterStage = DataManager.ChapterData:getChapterStage(chapterId) + + self.chapterScenes = {} end function MainComp:refresh() @@ -174,6 +172,7 @@ function MainComp:refreshChapter(force) self.chapterList = DataManager.ChapterData:getChapterList(self.chapterPage) self.currChapterId = chapterId if self.currChapterId ~= chapterId or force then + self:refreshChapterBg() self:refreshFightBtn() self:doBossAction() end @@ -183,6 +182,27 @@ function MainComp:refreshChapter(force) self:refreshChapterBtn() end +function MainComp:refreshChapterBg() + local chapterId = DataManager.ChapterData:getChapterId() + local icon = DataManager.ChapterData:getChapterCfg()[chapterId].icon + local bgPath = string.format(CHAPTER_PATH, icon) + if self.chapterScenes[bgPath] then + self.chapterScenes[bgPath]:setActive(true) + if self.currScenePath and self.chapterScenes[self.currScenePath] then + self.chapterScenes[self.currScenePath]:setActive(false) + end + self.currScenePath = bgPath + else + UIPrefabManager:loadUIWidgetAsync(bgPath, self.backGroundNode, function(prefab) + if self.currScenePath and self.chapterScenes[self.currScenePath] then + self.chapterScenes[self.currScenePath]:setActive(false) + end + self.currScenePath = bgPath + self.chapterScenes[self.currScenePath] = prefab + end) + end +end + function MainComp:refreshChapterBtn() local chapterNewId = DataManager.ChapterData:getNewChapterId() local maxPage = DataManager.ChapterData:getChapterPage(chapterNewId) diff --git a/lua/app/ui/summon/summon_main_ui.lua b/lua/app/ui/summon/summon_main_ui.lua index 28479fc7..c399fa9f 100755 --- a/lua/app/ui/summon/summon_main_ui.lua +++ b/lua/app/ui/summon/summon_main_ui.lua @@ -111,8 +111,8 @@ function SummonMainUI:onLoadRootComplete() self.summonBg = uiMap['summon_main_ui.bg'] uiMap["summon_main_ui.node.btn_summon_one.text_one"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_ONE)) uiMap["summon_main_ui.node.btn_summon_ten.text_ten"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_TEN)) - uiMap["summon_main_ui.node.btn_summon_free.text_free"]:setText(I18N:getGlobalText(I18N.GlobalConst.FREE_THIS_TIME_DESC_1)) - uiMap["summon_main_ui.node.btn_summon_ad.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_DESC_22)) + uiMap["summon_main_ui.node.btn_summon_free.text_free"]:setText(I18N:getGlobalText(I18N.GlobalConst.FREE_DESC_1)) + uiMap["summon_main_ui.node.btn_summon_ad.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_DESC_1)) uiMap["summon_main_ui.node.btn_info.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_FORCE_3)) self.descBg = uiMap["summon_main_ui.node.desc_bg"] self.descTx = uiMap["summon_main_ui.node.desc_bg.desc_tx"]