diff --git a/lua/app/ui/game_setting/account_binding_ui.lua b/lua/app/ui/game_setting/account_binding_ui.lua index e56a6c34..3a3d06e9 100644 --- a/lua/app/ui/game_setting/account_binding_ui.lua +++ b/lua/app/ui/game_setting/account_binding_ui.lua @@ -14,7 +14,7 @@ function AccountBindUI:onLoadRootComplete() self.uiMap["account_bind_ui.title_bg_img.title_text"]:setText(I18N:getGlobalText(I18N.GlobalConst.MESSAGE_BOX_TITLE)) self.uiMap["account_bind_ui.title_bg_img.bg.content_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BIND_TIPS_DESC)) self:initBindBtn() - self.uiMap["account_bind_ui.close_btn"]:addClickListener(function() + self.uiMap["account_bind_ui.title_bg_img.close_btn"]:addClickListener(function() self:closeUI() end) diff --git a/lua/app/ui/game_setting/cell/language_cell.lua b/lua/app/ui/game_setting/cell/language_cell.lua index 17d909a2..a5f77551 100644 --- a/lua/app/ui/game_setting/cell/language_cell.lua +++ b/lua/app/ui/game_setting/cell/language_cell.lua @@ -1,17 +1,17 @@ local LanguageCell = class("LanguageCell", BaseCell) function LanguageCell:refresh(language) - local uiMap = self:getUIMap() - if language == I18N:getCurLanguage() then - uiMap["language_cell.bg"]:setSprite(GConst.ATLAS_PATH.COMMON, "common_btn_blue_3") - else - uiMap["language_cell.bg"]:setSprite(GConst.ATLAS_PATH.COMMON, "common_btn_dark_4") - end - uiMap["language_cell.name_bg"]:setSprite(GConst.ATLAS_PATH.UI_SETTING, "language_" .. language) + local uiMap = self:getUIMap() + if language == I18N:getCurLanguage() then + uiMap["language_cell.bg"]:setSprite(GConst.ATLAS_PATH.UI_SETTING, "setting_bg_2") + else + uiMap["language_cell.bg"]:setSprite(GConst.ATLAS_PATH.UI_SETTING, "setting_bg_1") + end + uiMap["language_cell.name_bg"]:setSprite(GConst.ATLAS_PATH.UI_SETTING, "language_" .. language) end function LanguageCell:addClickListener(func) - self:getBaseObject():addClickListener(func) + self:getBaseObject():addClickListener(func) end return LanguageCell \ No newline at end of file diff --git a/lua/app/ui/game_setting/game_setting_ui.lua b/lua/app/ui/game_setting/game_setting_ui.lua index a43b8ccb..e99f67f4 100644 --- a/lua/app/ui/game_setting/game_setting_ui.lua +++ b/lua/app/ui/game_setting/game_setting_ui.lua @@ -5,25 +5,25 @@ local GameSettingConst = GConst.GameSettingConst local BG_DEFAULT_H = 881 function GameSettingUI:ctor() - self.clickMusicCount = 0 + self.clickMusicCount = 0 end function GameSettingUI:isFullScreen() - return false + return false end function GameSettingUI:getPrefabPath() - return "assets/prefabs/ui/setting/game_setting_ui.prefab" + return "assets/prefabs/ui/setting/game_setting_ui.prefab" end function GameSettingUI:onLoadRootComplete() - self.uiMap = self.root:genAllChildren() - self:_display() - self:_addListeners() - self:_bind() - self:addEventListener(EventManager.CUSTOM_EVENT.BIND_ACCOUNT_SUCCESS, function() - self:refreshAccountInfo() - end) + self.uiMap = self.root:genAllChildren() + self:_display() + self:_addListeners() + self:_bind() + self:addEventListener(EventManager.CUSTOM_EVENT.BIND_ACCOUNT_SUCCESS, function() + self:refreshAccountInfo() + end) end function GameSettingUI:onPressBackspace() @@ -31,286 +31,300 @@ function GameSettingUI:onPressBackspace() end function GameSettingUI:_display() - self.uiMap["game_setting_ui.bg.title"]:setText(I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC)) - self.uiMap["game_setting_ui.bg.music_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_MUSIC)) - self.uiMap["game_setting_ui.bg.voice_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_VOICE)) - self.uiMap["game_setting_ui.bg.language_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_LANGUAGE)) - self.uiMap["game_setting_ui.bg.tx_1"]:setText(I18N:getGlobalText(I18N.GlobalConst.SERVICE_DESC)) - self.uiMap["game_setting_ui.bg.tx_2"]:setText(I18N:getGlobalText(I18N.GlobalConst.PRIVACY_DESC)) - local version = CS.BF.BFMain.Instance.GameLaunchMgr:GetCurrentVersion() + self.uiMap["game_setting_ui.bg.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC)) + self.uiMap["game_setting_ui.bg.music_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_MUSIC)) + self.uiMap["game_setting_ui.bg.voice_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_VOICE)) + self.uiMap["game_setting_ui.bg.language_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_LANGUAGE)) + self.uiMap["game_setting_ui.bg.tx_1"]:setText(I18N:getGlobalText(I18N.GlobalConst.SERVICE_DESC)) + self.uiMap["game_setting_ui.bg.tx_2"]:setText(I18N:getGlobalText(I18N.GlobalConst.PRIVACY_DESC)) + local version = CS.BF.BFMain.Instance.GameLaunchMgr:GetCurrentVersion() self.uiMap["game_setting_ui.bg.version_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.CLIENT_VERSION, version)) - local language = I18N:getCurLanguage() - -- 超框选择小字体特殊处理 - if language == "id" or language == "pt" then - language = language .."_1" - end - self.uiMap["game_setting_ui.bg.language_btn.status"]:setSprite(GConst.ATLAS_PATH.UI_SETTING, "language_" .. language) - local acountId = DataManager.PlayerData:getAcountId() or GConst.EMPTY_STRING - self.uiMap["game_setting_ui.bg.player_bg.player_id"]:setText(I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_1, acountId)) + local language = I18N:getCurLanguage() + -- 超框选择小字体特殊处理 + if language == "id" or language == "pt" then + language = language .."_1" + end + self.uiMap["game_setting_ui.bg.language_btn.status"]:setSprite(GConst.ATLAS_PATH.UI_SETTING, "language_" .. language) + local acountId = DataManager.PlayerData:getAcountId() or GConst.EMPTY_STRING + self.uiMap["game_setting_ui.bg.player_bg.player_id"]:setText(I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_1, acountId)) - self:initLoginBtn() - self:initCDKeyBtn() - self:initSupportBtn() - self:refreshMusic() - self:refreshVoice() - self:refreshLinkBtns() + self:initLoginBtn() + self:initCDKeyBtn() + self:initSupportBtn() + self:refreshMusic() + self:refreshVoice() + self:refreshLinkBtns() end function GameSettingUI:initLoginBtn() - self:initGoogleLoginBtn() - self:initAppleLoginBtn() - local deleteBtn = self.uiMap["game_setting_ui.bg.delete_btn"] - deleteBtn:addClickListener(function() - ModuleManager.AccountManager:showDeleteUI() - end) - self:refreshAccountInfo() + self:initGoogleLoginBtn() + self:initAppleLoginBtn() + local deleteTx = self.uiMap["game_setting_ui.bg.delete_tx"] + deleteTx:addClickListener(function() + ModuleManager.AccountManager:showDeleteUI() + end) + self:refreshAccountInfo() end function GameSettingUI:initGoogleLoginBtn() - if Platform:isIosPlatform() then - self.uiMap["game_setting_ui.bg.google_sign_btn"]:setVisible(false) - self.uiMap["game_setting_ui.bg.google_switch_btn"]:setVisible(false) - else - self.uiMap["game_setting_ui.bg.google_sign_btn"]:setVisible(true) - self.uiMap["game_setting_ui.bg.google_sign_btn"]:addClickListener(function() - if ModuleManager.AccountManager:getIsBinded() then - GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ACCOUNT_ALREADY_BINDED_DESC)) - return - end - ModuleManager.AccountManager:bindAccount() - end) + if Platform:isIosPlatform() then + self.uiMap["game_setting_ui.bg.google_sign_btn"]:setVisible(false) + self.uiMap["game_setting_ui.bg.google_switch_btn"]:setVisible(false) + else + self.uiMap["game_setting_ui.bg.google_sign_btn"]:setVisible(true) + self.uiMap["game_setting_ui.bg.google_sign_btn"]:addClickListener(function() + if ModuleManager.AccountManager:getIsBinded() then + GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ACCOUNT_ALREADY_BINDED_DESC)) + return + end + ModuleManager.AccountManager:bindAccount() + end) - self.uiMap["game_setting_ui.bg.google_switch_btn"]:setVisible(true) - self.uiMap["game_setting_ui.bg.google_switch_btn"]:addClickListener(function() - if ModuleManager.AccountManager:getIsBinded() then - ModuleManager.AccountManager:changeAccount() - else - local params = { - content = I18N:getGlobalText(I18N.GlobalConst.CHANGE_ACCOUNT_TIPS_DESC), - boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL, - okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK), - okFunc = function() - ModuleManager.AccountManager:changeAccount() - end - } - GFunc.showMessageBox(params) - end - end) - self.uiMap["game_setting_ui.bg.google_switch_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.CHANGE_ACCOUNT_DESC)) - end + self.uiMap["game_setting_ui.bg.google_switch_btn"]:setVisible(true) + self.uiMap["game_setting_ui.bg.google_switch_btn"]:addClickListener(function() + if ModuleManager.AccountManager:getIsBinded() then + ModuleManager.AccountManager:changeAccount() + else + local params = { + content = I18N:getGlobalText(I18N.GlobalConst.CHANGE_ACCOUNT_TIPS_DESC), + boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL, + okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK), + okFunc = function() + ModuleManager.AccountManager:changeAccount() + end + } + GFunc.showMessageBox(params) + end + end) + self.uiMap["game_setting_ui.bg.google_switch_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.CHANGE_ACCOUNT_DESC)) + end end function GameSettingUI:initAppleLoginBtn() - if Platform:isIosPlatform() then - self.uiMap["game_setting_ui.bg.apple_sign_btn"]:setVisible(true) - self.uiMap["game_setting_ui.bg.apple_sign_btn"]:addClickListener(function() - if ModuleManager.AccountManager:getIsBinded() then - GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ACCOUNT_ALREADY_BINDED_DESC)) - return - end - ModuleManager.AccountManager:bindAccount() - end) - self.uiMap["game_setting_ui.bg.apple_switch_btn"]:setVisible(true) - self.uiMap["game_setting_ui.bg.apple_switch_btn"]:addClickListener(function() - if ModuleManager.AccountManager:getIsBinded() then - ModuleManager.AccountManager:changeAccount() - else - local params = { - content = I18N:getGlobalText(I18N.GlobalConst.CHANGE_ACCOUNT_TIPS_DESC), - boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL, - okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK), - okFunc = function() - ModuleManager.AccountManager:changeAccount() - end - } - GFunc.showMessageBox(params) - end - end) - self.uiMap["game_setting_ui.bg.apple_switch_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.CHANGE_ACCOUNT_DESC)) - else - self.uiMap["game_setting_ui.bg.apple_sign_btn"]:setVisible(false) - self.uiMap["game_setting_ui.bg.apple_switch_btn"]:setVisible(false) - end + if Platform:isIosPlatform() then + self.uiMap["game_setting_ui.bg.apple_sign_btn"]:setVisible(true) + self.uiMap["game_setting_ui.bg.apple_sign_btn"]:addClickListener(function() + if ModuleManager.AccountManager:getIsBinded() then + GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ACCOUNT_ALREADY_BINDED_DESC)) + return + end + ModuleManager.AccountManager:bindAccount() + end) + self.uiMap["game_setting_ui.bg.apple_switch_btn"]:setVisible(true) + self.uiMap["game_setting_ui.bg.apple_switch_btn"]:addClickListener(function() + if ModuleManager.AccountManager:getIsBinded() then + ModuleManager.AccountManager:changeAccount() + else + local params = { + content = I18N:getGlobalText(I18N.GlobalConst.CHANGE_ACCOUNT_TIPS_DESC), + boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL, + okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK), + okFunc = function() + ModuleManager.AccountManager:changeAccount() + end + } + GFunc.showMessageBox(params) + end + end) + self.uiMap["game_setting_ui.bg.apple_switch_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.CHANGE_ACCOUNT_DESC)) + else + self.uiMap["game_setting_ui.bg.apple_sign_btn"]:setVisible(false) + self.uiMap["game_setting_ui.bg.apple_switch_btn"]:setVisible(false) + end end function GameSettingUI:initCDKeyBtn() - if GFunc.isShenhe() then - self.uiMap["game_setting_ui.bg.cdkey_tx"]:setActive(false) - self.uiMap["game_setting_ui.bg.cdkey_icon"]:setActive(false) - self.uiMap["game_setting_ui.bg.cdkey_btn"]:setActive(false) - return - else - self.uiMap["game_setting_ui.bg.cdkey_tx"]:setActive(true) - self.uiMap["game_setting_ui.bg.cdkey_icon"]:setActive(true) - self.uiMap["game_setting_ui.bg.cdkey_btn"]:setActive(true) - end - self.uiMap["game_setting_ui.bg.cdkey_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.CDKEY_NAME)) - self.uiMap["game_setting_ui.bg.cdkey_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.CDKEY_EXCHANGE)) - self.uiMap["game_setting_ui.bg.cdkey_btn"]:addClickListener(function() - ModuleManager.GameSettingManager:showCDKeyUI() - end) + if GFunc.isShenhe() then + self.uiMap["game_setting_ui.bg.cdkey_tx"]:setActive(false) + self.uiMap["game_setting_ui.bg.cdkey_icon"]:setActive(false) + self.uiMap["game_setting_ui.bg.cdkey_btn"]:setActive(false) + return + else + self.uiMap["game_setting_ui.bg.cdkey_tx"]:setActive(true) + self.uiMap["game_setting_ui.bg.cdkey_icon"]:setActive(true) + self.uiMap["game_setting_ui.bg.cdkey_btn"]:setActive(true) + end + self.uiMap["game_setting_ui.bg.cdkey_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.CDKEY_NAME)) + self.uiMap["game_setting_ui.bg.cdkey_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.CDKEY_EXCHANGE)) + self.uiMap["game_setting_ui.bg.cdkey_btn"]:addClickListener(function() + ModuleManager.GameSettingManager:showCDKeyUI() + end) end function GameSettingUI:initSupportBtn() - if GFunc.isShenhe() then - self.uiMap["game_setting_ui.bg.support_tx"]:setAnchoredPositionY(-370) - self.uiMap["game_setting_ui.bg.support_icon"]:setAnchoredPositionY(-370) - self.uiMap["game_setting_ui.bg.support_btn"]:setAnchoredPositionY(-370) - else - self.uiMap["game_setting_ui.bg.support_tx"]:setAnchoredPositionY(-450) - self.uiMap["game_setting_ui.bg.support_icon"]:setAnchoredPositionY(-450) - self.uiMap["game_setting_ui.bg.support_btn"]:setAnchoredPositionY(-450) - end + -- if GFunc.isShenhe() then + -- self.uiMap["game_setting_ui.bg.support_tx"]:setAnchoredPositionY(-370) + -- self.uiMap["game_setting_ui.bg.support_icon"]:setAnchoredPositionY(-370) + -- self.uiMap["game_setting_ui.bg.support_btn"]:setAnchoredPositionY(-370) + -- else + -- self.uiMap["game_setting_ui.bg.support_tx"]:setAnchoredPositionY(-450) + -- self.uiMap["game_setting_ui.bg.support_icon"]:setAnchoredPositionY(-450) + -- self.uiMap["game_setting_ui.bg.support_btn"]:setAnchoredPositionY(-450) + -- end - self.uiMap["game_setting_ui.bg.support_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUPPORT_DESC_1)) - self.uiMap["game_setting_ui.bg.support_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUPPORT_DESC_2)) - self.uiMap["game_setting_ui.bg.support_btn"]:addClickListener(function() - ModuleManager.GameSettingManager:showSupport() - DataManager.AIHelperData:clearRp() - end) + self.uiMap["game_setting_ui.bg.support_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUPPORT_DESC_1)) + self.uiMap["game_setting_ui.bg.support_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUPPORT_DESC_2)) + self.uiMap["game_setting_ui.bg.support_btn"]:addClickListener(function() + ModuleManager.GameSettingManager:showSupport() + DataManager.AIHelperData:clearRp() + end) end function GameSettingUI:_addListeners() - self.uiMap["game_setting_ui.bg.close_btn"]:addClickListener(function() - self:closeUI() - end) + self.uiMap["game_setting_ui.bg.close_btn"]:addClickListener(function() + self:closeUI() + end) - self.uiMap["game_setting_ui.bg.music_bg"]:addClickListener(function() - local status = AudioManager:isMusicEnabled() - if not status then - AudioManager:setMusicVolume(1) - else - AudioManager:setMusicVolume(0) - end + self.uiMap["game_setting_ui.bg.music_bg"]:addClickListener(function() + local status = AudioManager:isMusicEnabled() + if not status then + AudioManager:setMusicVolume(1) + else + AudioManager:setMusicVolume(0) + end - if GFunc.isInWhitelist() then - self.clickMusicCount = self.clickMusicCount + 1 - if self.clickMusicCount > CHECK_WHITE_LIST_COUNT then - GFunc.showToast("Please don't frequently operate") - end - end + if GFunc.isInWhitelist() then + self.clickMusicCount = self.clickMusicCount + 1 + if self.clickMusicCount > CHECK_WHITE_LIST_COUNT then + GFunc.showToast("Please don't frequently operate") + end + end - self:refreshMusic() - end) + self:refreshMusic() + end) - self.uiMap["game_setting_ui.bg.voice_bg"]:addClickListener(function() - local status = AudioManager:isEffectEnabled() - if not status then - AudioManager:setEffectVolume(1) - else - AudioManager:setEffectVolume(0) - end - self:refreshVoice() - end) + self.uiMap["game_setting_ui.bg.voice_bg"]:addClickListener(function() + local status = AudioManager:isEffectEnabled() + if not status then + AudioManager:setEffectVolume(1) + else + AudioManager:setEffectVolume(0) + end + self:refreshVoice() + end) - self.uiMap["game_setting_ui.bg.language_btn"]:addClickListener(function() - ModuleManager.GameSettingManager:showLanguageUI() - end) - self.uiMap["game_setting_ui.bg.player_bg.player_id_btn"]:addClickListener(function() - local acountId = DataManager.PlayerData:getAcountId() or GConst.EMPTY_STRING - GFunc.copyStr(acountId) - end) + self.uiMap["game_setting_ui.bg.shake_bg"]:addClickListener(function() + -- local status = AudioManager:isEffectEnabled() + -- if not status then + -- AudioManager:setEffectVolume(1) + -- else + -- AudioManager:setEffectVolume(0) + -- end + -- self:refreshVoice() + GFunc.showToast("震动") + end) - self.uiMap["game_setting_ui.bg.tx_1"]:addClickListener(function() - GFunc.openUrl("https://perfeggsgame.com/tos.html") - end) + self.uiMap["game_setting_ui.bg.language_btn"]:addClickListener(function() + ModuleManager.GameSettingManager:showLanguageUI() + end) - self.uiMap["game_setting_ui.bg.tx_2"]:addClickListener(function() - GFunc.openUrl("https://perfeggsgame.com/pp.html") - end) + self.uiMap["game_setting_ui.bg.player_bg.player_id_btn"]:addClickListener(function() + local acountId = DataManager.PlayerData:getAcountId() or GConst.EMPTY_STRING + GFunc.copyStr(acountId) + end) + + self.uiMap["game_setting_ui.bg.tx_1"]:addClickListener(function() + -- GFunc.openUrl("https://perfeggsgame.com/tos.html") + GFunc.openUrl("https://www.baidu.com") + end) + + self.uiMap["game_setting_ui.bg.tx_2"]:addClickListener(function() + -- GFunc.openUrl("https://perfeggsgame.com/pp.html") + GFunc.openUrl("https://www.baidu.com") + end) end function GameSettingUI:_bind() - self:bind(DataManager.AIHelperData, "isDirty", function() - local supportBtn = self.uiMap["game_setting_ui.bg.support_btn"] - if DataManager.AIHelperData:getRp() then - supportBtn:addRedPoint(88, 24, 0.8) - else - supportBtn:removeRedPoint() - end - end, true) + self:bind(DataManager.AIHelperData, "isDirty", function() + local supportBtn = self.uiMap["game_setting_ui.bg.support_btn"] + if DataManager.AIHelperData:getRp() then + supportBtn:addRedPoint(88, 24, 0.8) + else + supportBtn:removeRedPoint() + end + end, true) end function GameSettingUI:refreshMusic() - local offIcon = self.uiMap["game_setting_ui.bg.music_bg.off"] - local onIcon = self.uiMap["game_setting_ui.bg.music_bg.on"] + local offIcon = self.uiMap["game_setting_ui.bg.music_bg.off"] + local onIcon = self.uiMap["game_setting_ui.bg.music_bg.on"] - local status = AudioManager:isMusicEnabled() - offIcon:setVisible(status ~= true) - onIcon:setVisible(status == true) + local status = AudioManager:isMusicEnabled() + offIcon:setVisible(status ~= true) + onIcon:setVisible(status == true) end function GameSettingUI:refreshVoice() - local offIcon = self.uiMap["game_setting_ui.bg.voice_bg.off"] - local onIcon = self.uiMap["game_setting_ui.bg.voice_bg.on"] + local offIcon = self.uiMap["game_setting_ui.bg.voice_bg.off"] + local onIcon = self.uiMap["game_setting_ui.bg.voice_bg.on"] - local status = AudioManager:isEffectEnabled() - offIcon:setVisible(status ~= true) - onIcon:setVisible(status == true) + local status = AudioManager:isEffectEnabled() + offIcon:setVisible(status ~= true) + onIcon:setVisible(status == true) end function GameSettingUI:refreshAccountInfo() - if Platform:isIosPlatform() then - if ModuleManager.AccountManager:getIsBinded() then - self.uiMap["game_setting_ui.bg.apple_sign_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACCOUNT_ALREADY_BINDED_DESC)) - else - self.uiMap["game_setting_ui.bg.apple_sign_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.BIND_ACCOUNT_DESC)) - end - else - if ModuleManager.AccountManager:getIsBinded() then - self.uiMap["game_setting_ui.bg.google_sign_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACCOUNT_ALREADY_BINDED_DESC)) - else - self.uiMap["game_setting_ui.bg.google_sign_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.BIND_ACCOUNT_DESC)) - end - end + if Platform:isIosPlatform() then + if ModuleManager.AccountManager:getIsBinded() then + self.uiMap["game_setting_ui.bg.apple_sign_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACCOUNT_ALREADY_BINDED_DESC)) + else + self.uiMap["game_setting_ui.bg.apple_sign_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.BIND_ACCOUNT_DESC)) + end + else + if ModuleManager.AccountManager:getIsBinded() then + self.uiMap["game_setting_ui.bg.google_sign_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACCOUNT_ALREADY_BINDED_DESC)) + else + self.uiMap["game_setting_ui.bg.google_sign_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.BIND_ACCOUNT_DESC)) + end + end end function GameSettingUI:refreshLinkBtns() - local uiMap = self.root:genAllChildren() - local bg = uiMap["game_setting_ui.bg"] - local node = uiMap["game_setting_ui.bg.community_node"] - local curLanguage = I18N:getCurLanguage() - if not GameSettingConst.COMMUNITY_URL[curLanguage] then - curLanguage = GConst.LANGUAGE.ENGLISH - end - if not GameSettingConst.COMMUNITY_URL[curLanguage] then - bg:setSizeDeltaY(BG_DEFAULT_H) - node:setVisible(false) - return - end - bg:setSizeDeltaY(BG_DEFAULT_H + 100) - node:setVisible(true) - local communityDesc = uiMap["game_setting_ui.bg.community_node.discord_desc"] - local communityBtn = uiMap["game_setting_ui.bg.community_node.discord"] - local socialDesc = uiMap["game_setting_ui.bg.community_node.facebook_desc"] - local socialBtn = uiMap["game_setting_ui.bg.community_node.facebook"] + local uiMap = self.root:genAllChildren() + local bg = uiMap["game_setting_ui.bg"] + local node = uiMap["game_setting_ui.bg.community_node"] + local curLanguage = I18N:getCurLanguage() + if not GameSettingConst.COMMUNITY_URL[curLanguage] then + curLanguage = GConst.LANGUAGE.ENGLISH + end + if not GameSettingConst.COMMUNITY_URL[curLanguage] then + -- bg:setSizeDeltaY(BG_DEFAULT_H) + node:setVisible(false) + return + end + -- bg:setSizeDeltaY(BG_DEFAULT_H + 100) + node:setVisible(true) + local communityDesc = uiMap["game_setting_ui.bg.community_node.discord_desc"] + local communityBtn = uiMap["game_setting_ui.bg.community_node.discord"] + local socialDesc = uiMap["game_setting_ui.bg.community_node.facebook_desc"] + local socialBtn = uiMap["game_setting_ui.bg.community_node.facebook"] - communityDesc:setText(I18N:getGlobalText(GameSettingConst.COMMUNITY_TXT[curLanguage])) - communityBtn:addClickListener(function() - local url = GameSettingConst.COMMUNITY_URL[I18N:getCurLanguage()] - if not url then - url = GameSettingConst.COMMUNITY_URL[GConst.LANGUAGE.ENGLISH] - end - GFunc.openUrl(url) - end) - communityBtn:setVisible(false) - communityBtn:setSprite(GConst.ATLAS_PATH.UI_SETTING, GameSettingConst.COMMUNITY_ICON[curLanguage], function() - communityBtn:setVisible(true) - end) + communityDesc:setText(I18N:getGlobalText(GameSettingConst.COMMUNITY_TXT[curLanguage])) + communityBtn:addClickListener(function() + local url = GameSettingConst.COMMUNITY_URL[I18N:getCurLanguage()] + if not url then + url = GameSettingConst.COMMUNITY_URL[GConst.LANGUAGE.ENGLISH] + end + GFunc.openUrl(url) + end) + communityBtn:setVisible(false) + communityBtn:setSprite(GConst.ATLAS_PATH.UI_SETTING, GameSettingConst.COMMUNITY_ICON[curLanguage], function() + communityBtn:setVisible(true) + end) - socialDesc:setText(I18N:getGlobalText(GameSettingConst.SOCIAL_DESC[curLanguage])) - socialBtn:addClickListener(function() - local url = GameSettingConst.SOCIAL_URL[I18N:getCurLanguage()] - if not url then - url = GameSettingConst.SOCIAL_URL[GConst.LANGUAGE.ENGLISH] - end - GFunc.openUrl(url) - end) - socialBtn:setVisible(false) - socialBtn:setSprite(GConst.ATLAS_PATH.UI_SETTING, GameSettingConst.SOCIAL_ICON[curLanguage], function() - socialBtn:setVisible(true) - end) + socialDesc:setText(I18N:getGlobalText(GameSettingConst.SOCIAL_DESC[curLanguage])) + socialBtn:addClickListener(function() + local url = GameSettingConst.SOCIAL_URL[I18N:getCurLanguage()] + if not url then + url = GameSettingConst.SOCIAL_URL[GConst.LANGUAGE.ENGLISH] + end + GFunc.openUrl(url) + end) + socialBtn:setVisible(false) + socialBtn:setSprite(GConst.ATLAS_PATH.UI_SETTING, GameSettingConst.SOCIAL_ICON[curLanguage], function() + socialBtn:setVisible(true) + end) end return GameSettingUI \ No newline at end of file diff --git a/lua/app/ui/game_setting/language_ui.lua b/lua/app/ui/game_setting/language_ui.lua index d31da973..d93d1cf4 100644 --- a/lua/app/ui/game_setting/language_ui.lua +++ b/lua/app/ui/game_setting/language_ui.lua @@ -7,7 +7,7 @@ function LanguageUI:isFullScreen() end function LanguageUI:ctor() - self.languageList = I18N:getSupportLanguageList() + self.languageList = I18N:getSupportLanguageList() end function LanguageUI:getPrefabPath() @@ -19,53 +19,53 @@ function LanguageUI:onPressBackspace() end function LanguageUI:onLoadRootComplete() - self.uiMap = self.root:genAllChildren() + self.uiMap = self.root:genAllChildren() - self:_display() - self:_addListeners() + self:_display() + self:_addListeners() - self:refreshScrollRect() + self:refreshScrollRect() end function LanguageUI:_display() - local titleTx = self.uiMap["language_ui.bg.title_tx"] - titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.LANGUAGE_DESC)) + local titleTx = self.uiMap["language_ui.bg.title_tx"] + titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.LANGUAGE_DESC)) end function LanguageUI:_addListeners() - local closeBtn = self.uiMap["language_ui.bg.close_btn"] - closeBtn:addClickListener(function() + local closeBtn = self.uiMap["language_ui.bg.close_btn"] + closeBtn:addClickListener(function() self:closeUI() end) end function LanguageUI:refreshScrollRect() - local scroll = self.uiMap["language_ui.bg.scrollrect"] - self.scrollRect = scroll:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE) - self.scrollRect:addInitCallback(function() - return LANGUAGE_CELL - end) - self.scrollRect:addRefreshCallback(function(index, cell) - local language = self.languageList[index] - cell:refresh(language) - cell:addClickListener(function() - self:closeUI() - local changeStatus = I18N:setLanguage(language) - if changeStatus then - local FontManager = require "app/common/font_manager" - FontManager:changeLanguage(I18N:getCurLanguage() or GConst.LANGUAGE.ENGLISH, function() - EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.I18N_CHANGE_LANGUAGE) + local scroll = self.uiMap["language_ui.bg.scrollrect"] + self.scrollRect = scroll:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE) + self.scrollRect:addInitCallback(function() + return LANGUAGE_CELL + end) + self.scrollRect:addRefreshCallback(function(index, cell) + local language = self.languageList[index] + cell:refresh(language) + cell:addClickListener(function() + self:closeUI() + local changeStatus = I18N:setLanguage(language) + if changeStatus then + local FontManager = require "app/common/font_manager" + FontManager:changeLanguage(I18N:getCurLanguage() or GConst.LANGUAGE.ENGLISH, function() + EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.I18N_CHANGE_LANGUAGE) UIManager:closeAllUI() UIManager:hideToastAndMessageBox() UIManager:clearUIPrefabCache() UIManager:refreshOnChangeLanguage() ModuleManager.MaincityManager:showMainCityUI() - end) - end - end) - end) - self.scrollRect:clearCells() - self.scrollRect:refillCells(#self.languageList) + end) + end + end) + end) + self.scrollRect:clearCells() + self.scrollRect:refillCells(#self.languageList) end return LanguageUI \ No newline at end of file