兑换码

This commit is contained in:
chenxi 2023-06-14 15:39:21 +08:00
parent 34332c6af9
commit d3a00e325c

View File

@ -10,7 +10,7 @@ end
function CdkeyUI:onLoadRootComplete() function CdkeyUI:onLoadRootComplete()
local uiMap = self.root:genAllChildren() local uiMap = self.root:genAllChildren()
uiMap["cdkey_ui.title_bg_img.title_text"]:setText("临时文本:兑换码") uiMap["cdkey_ui.title_bg_img.title_text"]:setText(I18N:getGlobalText(I18N.GlobalConst.CDKEY_NAME))
uiMap["cdkey_ui.title_bg_img.close_btn"]:addClickListener(function() uiMap["cdkey_ui.title_bg_img.close_btn"]:addClickListener(function()
self:closeUI() self:closeUI()
@ -24,18 +24,18 @@ function CdkeyUI:onLoadRootComplete()
uiMap["cdkey_ui.title_bg_img.confirm_btn"]:addClickListener(function() uiMap["cdkey_ui.title_bg_img.confirm_btn"]:addClickListener(function()
local text = self.inputField:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TMP_INPUT_FIELD).text local text = self.inputField:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TMP_INPUT_FIELD).text
if not text or text == "" then if not text or text == "" then
GFunc.showToast("临时文本:请输入兑换码") GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.CDKEY_DESC_1))
return return
end end
ModuleManager.GameSettingManager:exchangeCdkey(text) ModuleManager.GameSettingManager:exchangeCdkey(text)
end) end)
uiMap["cdkey_ui.title_bg_img.desc_1"]:setText("临时文本:每个兑换码仅能使用一次") uiMap["cdkey_ui.title_bg_img.desc_1"]:setText(I18N:getGlobalText(I18N.GlobalConst.CDKEY_DESC_2))
self.desc2 = uiMap["cdkey_ui.title_bg_img.desc_2"] self.desc2 = uiMap["cdkey_ui.title_bg_img.desc_2"]
self.desc2:setText(GConst.EMPTY_STRING) self.desc2:setText(GConst.EMPTY_STRING)
local placeholder = uiMap["cdkey_ui.title_bg_img.input_field.text_area.placeholder"] local placeholder = uiMap["cdkey_ui.title_bg_img.input_field.text_area.placeholder"]
placeholder:setText("临时文本:请输入兑换码") placeholder:setText(I18N:getGlobalText(I18N.GlobalConst.CDKEY_DESC_1))
self.inputField = uiMap["cdkey_ui.title_bg_img.input_field"] self.inputField = uiMap["cdkey_ui.title_bg_img.input_field"]
self.inputField:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TMP_INPUT_FIELD).text = "" self.inputField:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TMP_INPUT_FIELD).text = ""
@ -51,13 +51,13 @@ end
function CdkeyUI:updateErrorCode(errorCode) function CdkeyUI:updateErrorCode(errorCode)
local str = GConst.EMPTY_STRING local str = GConst.EMPTY_STRING
if errorCode == 1700 then if errorCode == 1700 then
str = "临时文本:兑换码不存在" str = I18N:getGlobalText(I18N.GlobalConst.CDKEY_ERROR_MSG_1)
elseif errorCode == 1701 then elseif errorCode == 1701 then
str = "临时文本:兑换码已使用" str = I18N:getGlobalText(I18N.GlobalConst.CDKEY_ERROR_MSG_2)
elseif errorCode == 1702 then elseif errorCode == 1702 then
str = "临时文本:兑换码已过期" str = I18N:getGlobalText(I18N.GlobalConst.CDKEY_ERROR_MSG_3)
elseif errorCode == 1703 then elseif errorCode == 1703 then
str = "临时文本:兑换码已达到使用次数上限" str = I18N:getGlobalText(I18N.GlobalConst.CDKEY_ERROR_MSG_4)
end end
self.desc2:setText(str) self.desc2:setText(str)
end end