diff --git a/lua/app/module/game_setting/game_setting_manager.lua b/lua/app/module/game_setting/game_setting_manager.lua index a5960745..8c37bed1 100644 --- a/lua/app/module/game_setting/game_setting_manager.lua +++ b/lua/app/module/game_setting/game_setting_manager.lua @@ -16,8 +16,8 @@ function GameSettingManager:showPlayerUpUI(params) UIManager:showUI("app/ui/player/player_up_ui", params) end -function GameSettingManager:showCDKeyUI(params) - UIManager:showUI("app/ui/game_setting/cdkey_ui", params) +function GameSettingManager:showCDKeyUI() + UIManager:showUI("app/ui/game_setting/cdkey_ui") end return GameSettingManager \ No newline at end of file diff --git a/lua/app/ui/game_setting/cdkey_ui.lua b/lua/app/ui/game_setting/cdkey_ui.lua new file mode 100644 index 00000000..7cc3db3b --- /dev/null +++ b/lua/app/ui/game_setting/cdkey_ui.lua @@ -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 \ No newline at end of file diff --git a/lua/app/ui/game_setting/cdkey_ui.lua.meta b/lua/app/ui/game_setting/cdkey_ui.lua.meta new file mode 100644 index 00000000..0cd5755d --- /dev/null +++ b/lua/app/ui/game_setting/cdkey_ui.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: cbc9f4e216a40f3479cc06c12f2c5f4a +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/ui/game_setting/game_setting_ui.lua b/lua/app/ui/game_setting/game_setting_ui.lua index 5a073e7c..59988cb8 100644 --- a/lua/app/ui/game_setting/game_setting_ui.lua +++ b/lua/app/ui/game_setting/game_setting_ui.lua @@ -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:initLoginBtn() + self:initCDKeyBtn() self:refreshMusic() self:refreshVoice() end @@ -123,6 +124,13 @@ function GameSettingUI:initAppleLoginBtn() 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() self.uiMap["game_setting_ui.bg.close_btn"]:addClickListener(function() self:closeUI()