c1_lua/lua/app/module/game_setting/game_setting_manager.lua
2025-09-28 16:09:37 +08:00

99 lines
4.0 KiB
Lua

local GameSettingManager = class("GameSettingManager", BaseModule)
function GameSettingManager:showSelectOtherBtnUI()
UIManager:showUI("app/ui/game_setting/select_other_btn_ui", {aniType = UIManager.ANI_TYPE.NONE})
end
function GameSettingManager:showSettingUI()
UIManager:showUI("app/ui/game_setting/game_setting_ui")
end
function GameSettingManager:showLanguageUI()
UIManager:showUI("app/ui/game_setting/language_ui")
end
function GameSettingManager:showPlayerUpUI(params)
UIManager:showUI("app/ui/player/player_up_ui", params)
end
function GameSettingManager:showCDKeyUI()
UIManager:showUI("app/ui/game_setting/cdkey_ui")
end
function GameSettingManager:exchangeCdkey(key)
local args = {
key = key
}
self:sendMessage(ProtoMsgType.FromMsgEnum.CDKeyUseReq, args, self.onExchangeCdkey, BIReport.ITEM_GET_TYPE.CDKEY)
end
function GameSettingManager:onExchangeCdkey(result)
if result.status == 0 then
if result.rewards and #result.rewards > 0 then
GFunc.showRewardBox(result.rewards)
end
end
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.CDKEY_FINISH, result.status)
end
function GameSettingManager:showSupport(objectId)
if not objectId then
objectId = DataManager.PlayerData:getAcountId() or ""
end
local url = "https://perfeggs.aihelp.net/webchatv3/#/appKey/perfeggs_app_b666f90daa2a40edab1e043f72869374/domain/perfeggs.aihelp.net/appId/perfeggs_platform_4f3578be7390d5e8264ddee5002e76ac/?mode=showAllFAQSections&showConversationMoment=1&conversationIntent=1&alwaysShowHumanSupportButtonInBotPage=true&sdkVersion=3.2.0"
local platform = "Android"
if Platform:isIosPlatform() then
platform = "IOS"
end
-- 繁体,日语和韩语跳对应的语言,其他语言跳英文
local language = "&language="
local currLanguage = I18N:getCurLanguage()
if currLanguage == GConst.LANGUAGE.CHINESE_TC then
language = language .. "zh-TW"
elseif currLanguage == GConst.LANGUAGE.CHINESE then
language = language .. "zh-CN"
elseif currLanguage == GConst.LANGUAGE.JAPANESE then
language = language .. "ja"
elseif currLanguage == GConst.LANGUAGE.KOREAN then
language = language .. "ko"
else
language = language .. "en"
end
local userId = string.format('&userId=%s', objectId)
-- local userName = string.format('&userName=%s',
-- DataManager.PlayerData:getName() -- 用户名
-- )
local applicationIdentifier = string.format('&applicationIdentifier=%s', Platform:getIdentifier())
local applicationVersion = string.format('&applicationVersion=%s', Platform:getClientVersion())
local applicationName = string.format('&applicationName=Knights Combo')
local deviceModel = string.format('&deviceModel=%s', DeviceHelper:getDeviceModel())
local osVersion = string.format('&osVersion=%s',DeviceHelper:getOSVersion())
local networkType = string.format('&networkType=%s',DeviceHelper:getNetworkType())
local customData = string.format('&customData={"UserID":"%s","GameName":"Knights Combo","GameVersion":"%s","DeviceModel":"%s","Platform":"%s","OSversion":"%s","ApplicationIdentifier":"%s","NetworkType":"%s"}',
objectId, -- 用户名
Platform:getClientVersion(), --应用版本
DeviceHelper:getDeviceModel(), -- 机型
platform, -- 安卓还是苹果
DeviceHelper:getOSVersion(), -- OS 版本
Platform:getIdentifier(), -- 应用包名
DeviceHelper:getNetworkType() -- 网络类型
)
local tempStr = applicationIdentifier .. applicationVersion .. applicationName .. deviceModel .. osVersion .. networkType
GFunc.openUrl(CS.System.Uri(url .. language .. userId .. tempStr .. customData).AbsoluteUri)
end
function GameSettingManager:reqAiHelper()
self:sendMessage(ProtoMsgType.FromMsgEnum.AIHelpUnreadReq, {}, self.rspAiHelper)
end
function GameSettingManager:rspAiHelper(result)
if result.error_code == GConst.ERROR_STR.SUCCESS then
-- DataManager.AIHelperData:init(result)
end
end
function GameSettingManager:rspAiHelperNtf(result)
DataManager.AIHelperData:init(result)
end
return GameSettingManager