c1_lua/lua/app/ui/common/cheat_message_box.lua
xiekaidong 55ec0dd76c 联网
2023-05-08 09:47:58 +08:00

80 lines
3.0 KiB
Lua

local CheatMessageBox = {}
function CheatMessageBox:showCheatMessageBox(params)
if params and params.noDeleteBtn then
CheatMessageBox.noDeleteBtn = true
end
UIManager:getCheatMessageBox(function(prefabObject)
local uiMap = prefabObject:genAllChildren()
uiMap["message_box.title_bg_img.title_text"]:setText(I18N:getGlobalText(I18N.GlobalConst.MESSAGE_BOX_TITLE))
uiMap["cheating_ui.title_bg_img.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.CHEATING_DESC_1))
uiMap["message_box.title_bg_img.ok_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUPPORT_DESSC))
uiMap["cheating_box.title_bg_img.delete_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.DELETE_ACCOUNT_DESC))
uiMap["cheating_ui.title_bg_img.bg1.player_id_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.COPY_ID))
uiMap["cheating_ui.title_bg_img.bg2.player_id_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.COPY_MAIL))
local objectId = ""
uiMap["cheating_ui.title_bg_img.bg1.player_id"]:setText("PlayerID:" .. objectId)
uiMap["cheating_ui.title_bg_img.bg2.player_id"]:setText("LonelySurvivorTech@cobbygame.com")
uiMap["cheating_ui.title_bg_img.bg1.player_id_btn"]:addClickListener(function()
-- local objectId = :getServerPlayerId() or ""
-- GFunc.copyStr(objectId)
end)
uiMap["cheating_ui.title_bg_img.bg2.player_id_btn"]:addClickListener(function()
GFunc.copyStr("LonelySurvivorTech@cobbygame.com")
end)
local okBtn = uiMap["message_box.title_bg_img.ok_btn"]
okBtn:addClickListener(function()
local subject = "Lonely Survivor(" .. Platform:getClientVersion() .. ")'s Feedback"
local platform = "Android"
if Platform:isIosPlatform() then
platform = "IOS"
end
local objectId = ""
local body = "\nPlease don't delete the information below\n===========\nGameName: Lonely Survivor\n"
body = body .. "GameVersion: " .. Platform:getClientVersion() .. "\n"
body = body .. "Device Model: " .. DeviceHelper:getDeviceModel() .. "\n"
body = body .. "Platform: " .. platform .. "\n"
body = body .. "OSversion: " .. DeviceHelper:getOSVersion() .. "\n"
body = body .. "User ID: " .. objectId .. "\n"
body = body .. "===========\nPlease don't delete the information above"
local uri = CS.System.Uri("mailto:LonelySurvivorTech@cobbygame.com?subject=" .. subject .. "&body=" .. body)
GFunc.openUrl(uri.AbsoluteUri)
end)
local deleteBtn = uiMap["cheating_box.title_bg_img.delete_btn"]
deleteBtn:addClickListener(function()
local sortingOrder = prefabObject:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS).sortingOrder + 1
local obj = ModuleManager.AccountManager:showDeleteUI()
obj:setUIOrder(0, sortingOrder)
end)
local showDeleteBtn = true
if CheatMessageBox.noDeleteBtn then
showDeleteBtn = false
end
deleteBtn:setActive(showDeleteBtn)
if showDeleteBtn then
okBtn:setAnchoredPositionX(132)
else
okBtn:setAnchoredPositionX(0)
end
end)
end
function CheatMessageBox:hideCheatMessageBox()
if not CheatMessageBox.noDeleteBtn then
UIManager:hideCheatMessageBox()
end
end
return CheatMessageBox