cdkey临时界面

This commit is contained in:
chenxi 2023-06-13 20:53:53 +08:00
parent 3c54f4e9c8
commit 8eed1c6a97
4 changed files with 79 additions and 2 deletions

View File

@ -16,8 +16,8 @@ function GameSettingManager:showPlayerUpUI(params)
UIManager:showUI("app/ui/player/player_up_ui", params) UIManager:showUI("app/ui/player/player_up_ui", params)
end end
function GameSettingManager:showCDKeyUI(params) function GameSettingManager:showCDKeyUI()
UIManager:showUI("app/ui/game_setting/cdkey_ui", params) UIManager:showUI("app/ui/game_setting/cdkey_ui")
end end
return GameSettingManager return GameSettingManager

View File

@ -0,0 +1,59 @@
local CdkeyUI = class("CdkeyUI", BaseUI)
function CdkeyUI:getPrefabPath()
return "assets/prefabs/ui/setting/cdkey_ui.prefab"
end
function CdkeyUI:isFullScreen()
return false
end
function CdkeyUI:onLoadRootComplete()
local uiMap = self.root:genAllChildren()
uiMap["cdkey_ui.title_bg_img.title_text"]:setText("临时文本:兑换码")
uiMap["cdkey_ui.title_bg_img.close_btn"]:addClickListener(function()
self:closeUI()
end)
uiMap["cdkey_ui.title_bg_img.cancel_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_CANCEL))
uiMap["cdkey_ui.title_bg_img.cancel_btn"]:addClickListener(function()
self:closeUI()
end)
uiMap["cdkey_ui.title_bg_img.confirm_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK))
uiMap["cdkey_ui.title_bg_img.confirm_btn"]:addClickListener(function()
local text = self.inputField:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TMP_INPUT_FIELD).text
if not text or text == "" then
GFunc.showToast("临时文本:请输入兑换码")
return
end
end)
uiMap["cdkey_ui.title_bg_img.desc_1"]:setText("临时文本:每个兑换码仅能使用一次")
self.desc2 = uiMap["cdkey_ui.title_bg_img.desc_2"]
self.desc2:setText(GConst.EMPTY_STRING)
local placeholder = uiMap["cdkey_ui.title_bg_img.input_field.text_area.placeholder"]
placeholder:setText("临时文本:请输入兑换码")
self.inputField = uiMap["cdkey_ui.title_bg_img.input_field"]
self.inputField:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TMP_INPUT_FIELD).text = ""
-- self:addEventListener(EventManager.CUSTOM_EVENT.CDKEY_FINISH, function(code)
-- if not code or code == 0 then
-- self.inputField:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TMP_INPUT_FIELD).text = ""
-- -- GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.SETTING_CDKEY_DESC_3))
-- end
-- self:updateErrorCode(code or 0)
-- end)
end
function CdkeyUI:updateErrorCode(errorCode)
if errorCode == 0 then
self.desc2:setText(GConst.EMPTY_STRING)
else
-- self.desc2:setText(I18N:getGlobalText(I18N.GlobalConst["ERROR_CODE_" .. errorCode]))
end
end
return CdkeyUI

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: cbc9f4e216a40f3479cc06c12f2c5f4a
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -42,6 +42,7 @@ function GameSettingUI:_display()
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:refreshMusic() self:refreshMusic()
self:refreshVoice() self:refreshVoice()
end end
@ -123,6 +124,13 @@ function GameSettingUI:initAppleLoginBtn()
end end
end end
function GameSettingUI:initCDKeyBtn()
self.uiMap["game_setting_ui.bg.cdkey_btn.text"]:setText("临时文本:兑换码")
self.uiMap["game_setting_ui.bg.cdkey_btn"]:addClickListener(function()
ModuleManager.GameSettingManager:showCDKeyUI()
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()