From a34edc2fd73b19183726b5268ef481fbdc7a68ef Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Fri, 7 Jul 2023 11:39:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E5=88=87=E6=8D=A2=E5=A4=9A?= =?UTF-8?q?=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/game.lua | 41 +++++++++++++++++++++++++++ lua/app/ui/main_city/main_city_ui.lua | 1 + 2 files changed, 42 insertions(+) diff --git a/lua/app/game.lua b/lua/app/game.lua index cedb921e..a3941df6 100644 --- a/lua/app/game.lua +++ b/lua/app/game.lua @@ -420,6 +420,47 @@ if NOT_PUBLISH then end end + if Input.GetKeyDown(KeyCode.LeftArrow) and Input.GetKey(KeyCode.RightControl)then + local curLanguage = I18N:getCurLanguage() + local languageList = I18N:getSupportLanguageList() + local curIndex = 1 + for index, language in ipairs(languageList) do + if language == curLanguage then + curIndex = index + 1 + break + end + end + if not languageList[curIndex] then + curIndex = 1 + end + local language = languageList[curIndex] + local changeStatus = I18N:setLanguage(language) + if changeStatus then + local FontManager = require "app/common/font_manager" + FontManager:changeLanguage(I18N:getCurLanguage() or GConst.LANGUAGE.ENGLISH, function() + local topUi = UIManager:getTopUIObj() + if topUi:getUIIndex() == UIManager.UI_PATH.MAINCITY_UI then + EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.I18N_CHANGE_LANGUAGE) + UIManager:closeAllUI() + UIManager:hideToastAndMessageBox() + UIManager:clearUIPrefabCache() + UIManager:refreshOnChangeLanguage() + ModuleManager.MaincityManager:showMainCityUI() + else + EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.I18N_CHANGE_LANGUAGE) + UIManager:hideToastAndMessageBox() + UIManager:clearUIPrefabCache() + UIManager:refreshOnChangeLanguage() + for _, obj in ipairs(UIManager:getUIList()) do + obj:onClose() + obj:onLoadRootComplete() + obj:onRefresh() + end + end + end) + end + end + if (Input.GetKeyDown(KeyCode.RightArrow) or Input.GetKeyDown(KeyCode.LeftArrow)) and Input.GetKey(KeyCode.LeftControl) then if not ModuleManager.DevToolManager.set_board_info then Logger.logHighlight("请先去gm面板设置浏览的棋盘信息!") diff --git a/lua/app/ui/main_city/main_city_ui.lua b/lua/app/ui/main_city/main_city_ui.lua index 2616efef..09b68d92 100644 --- a/lua/app/ui/main_city/main_city_ui.lua +++ b/lua/app/ui/main_city/main_city_ui.lua @@ -105,6 +105,7 @@ end function MainCityUI:onClose() self.subComps[GConst.MainCityConst.BOTTOM_PAGE.MAIN]:onClose() + self.subComps = nil end function MainCityUI:refreshAllSideBars()