维护公告

This commit is contained in:
chenxi 2023-06-16 15:11:37 +08:00
parent e402550d92
commit fb671ca1af
3 changed files with 36 additions and 20 deletions

View File

@ -381,6 +381,7 @@ function SDKManager:getServerList(callback)
bundle_id = Platform:getIdentifier(),
version = Platform:getClientVersion(),
device_id = DeviceHelper:getDeviceId(),
language = I18N:getLanguageAndArea(),
env = "release",-- 暂时写死
}
local loginCenterUrl = CS.BF.BFPlatform.GetLoginCenterURL()

View File

@ -16,8 +16,12 @@ function LoginManager:showTestLoginUI()
UIManager:showUI("app/module/login/test_login_ui")
end
function LoginManager:showMaintenanceNoticeUI()
UIManager:showUI("app/module/login/maintenance_notice_ui")
function LoginManager:showMaintenanceNoticeUI(content, openTime)
local params = {
content = content,
openTime = openTime,
}
UIManager:showUI("app/module/login/maintenance_notice_ui", params)
end
---- 登录界面资源加载完毕后调用
@ -232,18 +236,6 @@ function LoginManager:removeAllLoginData()
self.retryTimes = 0
end
function LoginManager:showServerNotOpenMessage()
local params = {
content = I18N:getGlobalText(I18N.GlobalConst.SERVER_MAINTAINED),
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK,
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
okFunc = function()
self:checkServerOpen()
end,
}
GFunc.showMessageBox(params)
end
function LoginManager:getIsNeedHotUpdate()
local serverVersion = self.versionInfo.version
local clientVersion = CS.BF.BFMain.Instance.GameLaunchMgr:GetCurrentVersion()
@ -286,10 +278,10 @@ function LoginManager:getIsclientLessThanMinVersion()
end
function LoginManager:checkServerOpen()
local serverOpenTime = tonumber(self.versionInfo.open_time or 0)
local clientTime = os.time()*1000
local serverOpenTime = tonumber(self.versionInfo.open_at or 0)
local clientTime = Time:getServerTime()*1000
if clientTime < serverOpenTime then -- 未开服
self:showServerNotOpenMessage()
self:showMaintenanceNoticeUI(self.versionInfo.notice, serverOpenTime)
return
end
@ -314,7 +306,7 @@ function LoginManager:checkServerOpen()
end
end
function LoginManager:getServerList(callback)
function LoginManager:getServerList()
if self.accountLoginSuccess then
if self.authSid then
self:unscheduleGlobal(self.authSid)
@ -359,8 +351,11 @@ function LoginManager:getServerList(callback)
self.authSid = nil
end
local serverTime = (jsonData.now or 0)
if serverTime > 0 then
Time:updateServerTime(serverTime)
end
self.versionInfo = jsonData
Logger.printTable(jsonData)
self:checkServerOpen()
else
-- BIReport:postRequestVersionFailed(self.loginCenterUrl, (os.clock() - self.connectStartTimes)*1000, self.retryTimes - 1)

View File

@ -1,6 +1,8 @@
local MaintenanceNoticeUI = class("MaintenanceNoticeUI", BaseUI)
function MaintenanceNoticeUI:ctor()
function MaintenanceNoticeUI:ctor(params)
self.content = params and params.content
self.openTime = params and params.openTime or 0
end
function MaintenanceNoticeUI:getPrefabPath()
@ -9,6 +11,24 @@ end
function MaintenanceNoticeUI:onLoadRootComplete()
local uiMap = self.root:genAllChildren()
uiMap["maintenance_notice_ui.bg.title_bg.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.NOTICE_TITLE))
if self.content == nil or self.content == "" then
uiMap["maintenance_notice_ui.bg.img_2.content_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.MAINTENANCE_NOTICE_DEFAULT))
else
uiMap["maintenance_notice_ui.bg.img_2.content_tx"]:setText(self.content)
end
uiMap["maintenance_notice_ui.bg.ok_btn"]:addClickListener(function()
local clientTime = Time:getServerTime()*1000
if clientTime >= self.openTime then
self:closeUI()
self:getServerList()
end
end)
uiMap["maintenance_notice_ui.bg.ok_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK))
end
function MaintenanceNoticeUI:getServerList()
ModuleManager.LoginManager:getServerList()
end
return MaintenanceNoticeUI