c1_lua/lua/app/module/login/login_manager.lua
2023-04-07 15:22:56 +08:00

72 lines
2.4 KiB
Lua

local LoginManager = class("LoginManager", BaseModule)
LoginManager.TRY_LOGIN_TIME = 5
LoginManager.SERVER_LIST = {}
LoginManager.selectIndex = 0
function LoginManager:showLoginUI()
if not Platform:getIsPublishChannel() then
self:showTestLoginUI()
return
end
UIManager:showUI("app/module/login/login_ui")
end
function LoginManager:showTestLoginUI()
UIManager:showUI("app/module/login/test_login_ui")
end
---- 登录界面资源加载完毕后调用
function LoginManager:loginGame()
BIReport:postAdjustSimpleTrackEvent("modt3z", {})
CS.BF.BFMain.IsGotServerTime = true
ServerDataManager:dataOperate(GConst.ServerDataConst.DATA_OP_BEHAVIOR.SYNC_DATA, GConst.EMPTY_TABLE, function(msgData)
DataManager:initWithServerData(msgData)
ConfigManager:preLoadConfig()
ModuleManager.MaincityManager:firstEnterMainCity()
-- local data = {}
-- data.max_chapter = DataManager.StageData:getNewChapterId()
-- data.ads_num = DataManager.PlayerData:getAdCount()
-- data.pay_money = DataManager.PlayerData:getPaymentCount()
-- data.play_days = DataManager:getLoginCount()
-- data.now_version = Platform:getClientVersion()
-- CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(data)
end)
end
function LoginManager:goToLoginScene()
ModuleManager.BattleManager:clearOnExitScene()
NetManager:closeAndClear()
UIManager:backToLoginWithoutLogout()
DataManager:clear()
end
function LoginManager:getClientInfo()
local clientInfo = {}
local bundleId = Platform:getIdentifier()
local version = Platform:getClientVersion()
local device = DeviceHelper:getDeviceModel()
local deviceId = DeviceHelper:getDeviceId()
local deviceOS = DeviceHelper:getOSVersion()
local platform = Platform:getPlatform()
local accountType = SDKManager.LOGIN_TYPE[LocalData:getInt(LocalData.KEYS.SDK_LOGIN_TYPE, SDKManager.BF_LOGIN_TYPE.GUEST)]
local ip = LocalData:getLastLoginIp()
local networkType = DeviceHelper:getNetworkType()
local language = I18N:getLanguageAndArea()
local timezone = SDKManager:getTimeZone()
clientInfo.bundle_id = bundleId
clientInfo.version = version
clientInfo.device = device
clientInfo.device_id = deviceId
clientInfo.os_version = deviceOS
clientInfo.platform = platform
clientInfo.account_type = accountType
clientInfo.ip = ip
clientInfo.network_type = networkType
clientInfo.language = language
clientInfo.timezone = timezone
return clientInfo
end
return LoginManager