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