再次修复登录时区服显示错误的问题

dev_chengFeng
gaoxin 2020-10-10 09:55:15 +08:00 committed by JieLing
parent bd09adfcba
commit b95a75310c
1 changed files with 16 additions and 20 deletions

View File

@ -13,7 +13,6 @@ local IsDevelopLogin = true
local openIdkey = "openIdkey"
local openIdPw = "openIdPw"
local lastServerIndex = "lastServerIndex"
local defaultOpenIdkey = Language[11118]
local defaultOpenIdPw = ""
local LoginRoot_Url = VersionManager:GetVersionInfo("serverUrl")
@ -96,7 +95,6 @@ function this:BindEvent()
recommend = this.recommend,
callback = function(index)
local list = this.serverList[index]
PlayerPrefs.SetInt(lastServerIndex, index)
PlayerManager.serverInfo = list
LoginManager.SocketAddress = list.ip
LoginManager.SocketPort = list.port
@ -348,28 +346,26 @@ end
function this.SetServerList(data)
this.CacheLoginData(data)
-- 默认选择第一个服务器
local lastIndex = 1
-- 判断要显示的服务器
local showServer
local lastIndex = PlayerPrefs.GetInt(lastServerIndex, 1)
if this.lastServer then --有最近登录显示最近登录,没有显示推荐,否则显示第一个服
--for i = 1, #this.serverList do
-- if this.serverList[i].server_id == this.lastServer.serverid then
-- lastIndex = i
-- break
-- end
--end
if this.lastServer then --有最近登录显示最近登录,没有显示推荐,否则显示第一个服
showServer = this.lastServer.serverid
else
if this.recommend then
for i = 1, #this.serverList do
if this.serverList[i].server_id == this.recommend then
lastIndex = i
break
end
end
if this.recommend then
showServer = this.recommend
end
end
if not this.serverList[lastIndex] then
lastIndex = 1
PlayerPrefs.SetInt(lastServerIndex, 1)
-- 如果有要显示的服务器判断位置
if showServer then
for i = 1, #this.serverList do
if this.serverList[i].server_id == showServer then
lastIndex = i
break
end
end
end
PlayerManager.serverInfo = this.serverList[lastIndex]
LoginManager.SocketAddress = this.serverList[lastIndex].ip