【服务器】服务器选择界面每次打开时都重新获取一遍服务器列表数据

dev_chengFeng
gaoxin 2021-08-09 16:32:14 +08:00
parent c4c57893ea
commit 8e43418825
1 changed files with 36 additions and 15 deletions

View File

@ -145,6 +145,17 @@ function this:BindEvent()
---SelectServer
Util.AddClick(this.changeServerBtn, function()
local function reServerCallback(str)
if str == nil then
return
end
if str ~= nil and str ~= "" then
MyPCall(function()
local json = require 'cjson'
local data = json.decode(str)
-- selectServerPart
this.SetServerList(data)
-- 打开服务器选择界面
UIManager.OpenPanel(UIName.ServerListSelectPanel, {
serverList = this.serverList,
myServerList = this.myServerList,
@ -162,6 +173,16 @@ function this:BindEvent()
end
})
end)
end
end
-- 判断获取服务器的id
if IsSDKLogin then
this.RequestServerList(AppConst.OpenId, reServerCallback)
else
local userId = PlayerPrefs.GetString(openIdkey, defaultOpenIdkey)
this.RequestServerList(userId, reServerCallback)
end
end)
--SDK 登录