miduo_client/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua

694 lines
28 KiB
Lua

require("Base/BasePanel")
LoginPanel = Inherit(BasePanel)
local this = LoginPanel
this.LoginWay = { Account = 0, WeChat = 1 }
SERVER_VERSION = tonumber(ServerConfigManager.GetSettingValue(ServerConfigManager.SettingConfig.ServerVersion) or 0)
local ServerVersion = SERVER_VERSION
local IsShowNotice = SERVER_VERSION == 0 -- 正式服显示公告
local IsSDKLogin = AppConst.isSDK and AppConst.isSDKLogin
local IsDevelopLogin = true
local openIdkey = "openIdkey"
local openIdPw = "openIdPw"
local defaultOpenIdkey = Language[11135]
local defaultOpenIdPw = ""
local LoginRoot_Url = ServerConfigManager.GetVersionInfo("serverUrl")
local LoginRoot_SubChannel = ServerConfigManager.GetVersionInfo("subChannel")
local LoginRoot_Channel = ServerConfigManager.GetVersionInfo("channel")
local LoginRoot_Version = ServerConfigManager.GetVersionInfo("version")
local LoginRoot_PackageVersion = ServerConfigManager.GetVersionInfo("packageVersion")
local orginLayer
local timeStamp = Time.realtimeSinceStartup
local timeSign = Util.MD5Encrypt(string.format("%s%s", timeStamp, LoginManager.sign))
--初始化组件(用于子类重写)
function this:InitComponent()
orginLayer = 0
this.loginPart = this.gameObject
this.tip = Util.GetGameObject(this.loginPart, "tip/Text")
this.loginAnim = this.gameObject:GetComponent("Animator")
this.loginAnim.enabled = false
this.btnLoginPart = Util.GetGameObject(this.loginPart, "jinruyouxi")
this.btnLogin = Util.GetGameObject(this.loginPart, "jinruyouxi _wenzi")
this.inputField = Util.GetGameObject(this.loginPart, "InputField"):GetComponent("InputField")
this.UserBtn = Util.GetGameObject(this.loginPart, "userBtn")
this.UserBtnText = Util.GetGameObject(this.loginPart, "userBtn/Text"):GetComponent("Text")
this.btnUser = Util.GetGameObject(this.loginPart, "btnUser")
this.btnNotice = Util.GetGameObject(this.loginPart, "btnNotice")
this.btnNotice:SetActive(IsShowNotice)
---selectServerPart
this.serverSelectPart = Util.GetGameObject(this.loginPart, "serverSelect")
this.serverMes = Util.GetGameObject(this.serverSelectPart, "serverMes"):GetComponent("Text")
this.changeServerBtn = Util.GetGameObject(this.serverSelectPart, "changeServer")
this.sdkLoginBtn = Util.GetGameObject(this.loginPart, "loginBtn")
this.SetLoginPart(false)
this.loginMask = Util.GetGameObject(this.loginPart, "loginMask")
this.versionText = Util.GetGameObject(this.loginPart, "version"):GetComponent("Text")
this.versionText.text = Language[11136]..LoginRoot_Version
BindLightFlash(Util.GetGameObject(this.btnLoginPart, "effect (1)/saoguang"), Util.GetGameObject(this.gameObject, "logo"))
end
--绑定事件(用于子类重写)
function this:BindEvent()
Util.AddClick(this.btnLogin, this.OnLoginClick)
--this.dropDown:ClearOptions()
Util.AddInputField_OnEndEdit(this.inputField.gameObject, function(str)
PlayerPrefs.SetString(openIdkey, str)
end)
Util.AddClick(this.btnUser, function()
local user = PlayerPrefs.GetString(openIdkey, defaultOpenIdkey)
local userPw = PlayerPrefs.GetString(openIdPw, defaultOpenIdPw)
UIManager.OpenPanel(UIName.LoginPopup, user, userPw, function(str, pw)
this.UserBtnText.text = str
PlayerPrefs.SetString(openIdkey, str)
PlayerPrefs.SetString(openIdPw, pw)
end)
end)
Util.AddClick(this.btnNotice, function()
RequestPanel.Show(Language[11137])
networkMgr:SendGetHttp(LoginRoot_Url .. "jl_loginserver/getNotice?timestamp="..timeStamp.."&sign=".. timeSign,function (str)
UIManager.OpenPanel(UIName.NoticePopup,str)
end, nil, nil, nil)
end)
Util.AddClick(this.UserBtn, function()
local user = PlayerPrefs.GetString(openIdkey, defaultOpenIdkey)
local userPw = PlayerPrefs.GetString(openIdPw, defaultOpenIdPw)
UIManager.OpenPanel(UIName.LoginPopup, user, userPw, function(str, pw)
this.UserBtnText.text = str
PlayerPrefs.SetString(openIdkey, str)
PlayerPrefs.SetString(openIdPw, pw)
end)
end)
---SelectServer
Util.AddClick(this.changeServerBtn, function()
UIManager.OpenPanel(UIName.ServerListSelectPanel, {
serverList = this.serverList,
myServerList = this.myServerList,
lastServer = this.lastServer,
recommend = this.recommend,
callback = function(index)
local list = this.serverList[index]
PlayerManager.serverInfo = list
LoginManager.SocketAddress = list.ip
LoginManager.SocketPort = list.port
LoginManager.ServerId = list.server_id
LoginManager.state = list.state
local severArea = tonumber(string.sub(list.server_id, 0, -5))
this.serverMes.text = PlayerManager.serverInfo.name .. "\t<color=#56F384FF>" .. severArea .. "</color>" .. Language[11138]
end
})
end)
--SDK 登录
Util.AddClick(this.sdkLoginBtn, function()
this.sdkLoginBtn:SetActive(false)
this.SDKLogin()
end)
end
--添加事件监听(用于子类重写)
function this:AddListener()
Game.GlobalEvent:AddEvent(Protocal.Connect, this.OnConnect)
Game.GlobalEvent:AddEvent(Protocal.Disconnect, this.OnDisconnect)
Game.GlobalEvent:AddEvent(GameEvent.LoginSuccess.OnLoginSuccess, this.RefreshLoginStatus)
Game.GlobalEvent:AddEvent(GameEvent.LoginSuccess.OnLogout, this.OnLogout)
end
--移除事件监听(用于子类重写)
function this:RemoveListener()
Game.GlobalEvent:RemoveEvent(Protocal.Connect, this.OnConnect)
Game.GlobalEvent:RemoveEvent(Protocal.Disconnect, this.OnDisconnect)
Game.GlobalEvent:RemoveEvent(GameEvent.LoginSuccess.OnLoginSuccess, this.RefreshLoginStatus)
Game.GlobalEvent:RemoveEvent(GameEvent.LoginSuccess.OnLogout, this.OnLogout)
end
function this:OnLogout()
if IsSDKLogin then
this.SetLoginPart(false)
this.sdkLoginBtn:SetActive(false)
this.inputField.gameObject:SetActive(false)
this.UserBtn:SetActive(false)
this.btnUser:SetActive(false)
this.btnNotice.transform.position = this.btnUser.transform.position
this.SDKLogin()
else
this.sdkLoginBtn:SetActive(false)
local userId = PlayerPrefs.GetString(openIdkey, defaultOpenIdkey)
if IsDevelopLogin then
this.UserBtn:SetActive(false)
this.btnUser:SetActive(false)
this.inputField.gameObject:SetActive(true)
this.inputField.text = userId
else
this.UserBtn:SetActive(true)
this.btnUser:SetActive(true)
this.inputField.gameObject:SetActive(false)
this.UserBtnText.text = userId
end
RequestPanel.Show(Language[11139])
this.SetLoginPart(true)
-- 获取服务器列表
this.RequestServerList(userId, this.OnReceiveServerList)
end
end
function this:OnSortingOrderChange()
Util.AddParticleSortLayer(self.gameObject, self.sortingOrder - orginLayer)
orginLayer = this.sortingOrder
end
--界面打开时调用(用于子类重写)
function this:OnOpen(...)
if AppConst.Code ~= "" then
MsgPanel.ShowOne(GetLanguageStrById(AppConst.Code))
AppConst.Code = ""
end
if IsSDKLogin then
this.SetLoginPart(false)
this.sdkLoginBtn:SetActive(false)
this.inputField.gameObject:SetActive(false)
this.UserBtn:SetActive(false)
this.btnUser:SetActive(false)
this.btnNotice.transform.position = this.btnUser.transform.position
this.SDKLogin()
else
this.sdkLoginBtn:SetActive(false)
local userId = PlayerPrefs.GetString(openIdkey, defaultOpenIdkey)
if IsDevelopLogin then
this.UserBtn:SetActive(false)
this.btnUser:SetActive(false)
this.inputField.gameObject:SetActive(true)
this.inputField.text = userId
else
this.UserBtn:SetActive(true)
this.btnUser:SetActive(true)
this.inputField.gameObject:SetActive(false)
this.UserBtnText.text = userId
end
RequestPanel.Show(Language[11139])
this.SetLoginPart(true)
-- 获取服务器列表
this.RequestServerList(userId, this.OnReceiveServerList)
end
local tran = this.tip:GetComponent("RectTransform")
--LayoutUtility.GetPreferredWidth(tran)
local offsetX = (GetPreferredWidth(tran) + Screen.width) / 2
tran.anchoredPosition = Vector2.New(offsetX, 0)
tran:DOAnchorPosX(-offsetX, 30, false):SetEase(Ease.Linear):SetLoops(-1)
SoundManager.PlayMusic(SoundConfig.BGM_Login)
SoundManager.PlayAmbient(SoundConfig.Ambient_Login)
end
--界面关闭时调用(用于子类重写)
function this:OnClose()
this.SetLoginPart(false)
SoundManager.PauseAmbient()
end
-- 请求获取服务器列表
function this.RequestServerList(userId, callback)
RequestPanel.Show(Language[11139])
Log(string.format(
"%sjl_loginserver/getServerList?openId=%s&channel=%s&plat=android&sub_channel=%s&server_version=%s",
LoginRoot_Url, userId, LoginRoot_Channel, LoginRoot_SubChannel, ServerVersion))
networkMgr:SendGetHttp(string.format(
"%sjl_loginserver/getServerList?openId=%s&channel=%s&plat=android&sub_channel=%s&server_version=%s",
LoginRoot_Url, userId, LoginRoot_Channel, LoginRoot_SubChannel, ServerVersion),
callback, nil, nil, nil)
end
--界面销毁时调用(用于子类重写)
function this:OnDestroy()
end
this.isWaiting = false
function this.SDKLogin()
if not this.isWaiting then
this.isWaiting = true
Timer.New(function()
SDKMgr:Login()
this.isWaiting = false
end, 1, 1):Start()
end
end
function this.RefreshLoginStatus(result)
if result == SDK_RESULT.SUCCESS then
RequestPanel.Show(Language[11139])
this.SetLoginPart(true)
-- 获取服务器列表
this.RequestServerList(AppConst.OpenId, this.OnReceiveServerList)
else
this.sdkLoginBtn:SetActive(true)
end
end
function this.SetSDKExtensionParams(params)
if not params or params == "" then
return
end
local json = require 'cjson'
local context = json.decode(params)
BindPhoneNumberManager.SetPtToken(context.token)
LoginManager.pt_pId = context.pid
LoginManager.pt_gId = context.gid
end
--收到公告
function this.OnReceiveAnnouncement(str)
if str == nil then
return
end ;
pcall(function()
local json = require 'cqueryAllies'
local data = json.decode(str);
if data.content ~= nil and data.content ~= "" then
UIManager.OpenPanel(UIName.GongGaoPanel, data.content)
end
end);
end
--获取服务器列表地址
function this.OnReceiveServerList(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)
if not IsSDKLogin and not IsDevelopLogin then
local user = PlayerPrefs.GetString(openIdkey, defaultOpenIdkey)
local userPw = PlayerPrefs.GetString(openIdPw, defaultOpenIdPw)
if user == defaultOpenIdkey or userPw == defaultOpenIdPw then
UIManager.OpenPanel(UIName.RegistPopup, function(str, pw)
this.UserBtnText.text = str
PlayerPrefs.SetString(openIdkey, str)
PlayerPrefs.SetString(openIdPw, pw)
end)
else
LoginManager.RequestUser(user, userPw, function(code)
if code ~= 0 then
UIManager.OpenPanel(UIName.LoginPopup, user, userPw, function(str, pw)
this.UserBtnText.text = str
PlayerPrefs.SetString(openIdkey, str)
PlayerPrefs.SetString(openIdPw, pw)
end)
else
if IsShowNotice then
this.loginMask:SetActive(true)
Timer.New(function()
RequestPanel.Show(Language[11137])
networkMgr:SendGetHttp(LoginRoot_Url .. "jl_loginserver/getNotice?timestamp="..timeStamp.."&sign=".. timeSign,function (str)
UIManager.OpenPanel(UIName.NoticePopup,str)
end, nil, nil, nil)
this.loginMask:SetActive(false)
end, 2.5, 1):Start()
end
end
end)
end
else
if IsShowNotice then
this.loginMask:SetActive(true)
Timer.New(function()
RequestPanel.Show(Language[11137])
networkMgr:SendGetHttp(LoginRoot_Url .. "jl_loginserver/getNotice?timestamp="..timeStamp.."&sign=".. timeSign,function (str)
UIManager.OpenPanel(UIName.NoticePopup,str)
end, nil, nil, nil)
this.loginMask:SetActive(false)
end, 2.5, 1):Start()
end
end
end)
end
end
function this.SetServerList(data)
this.CacheLoginData(data)
-- 默认选择第一个服务器
local lastIndex = 1
-- 判断要显示的服务器
local showServer
if this.lastServer then --有最近登录显示最近登录,没有显示推荐,否则显示第一个服
showServer = this.lastServer.serverid
else
if this.recommend then
showServer = this.recommend
end
end
-- 如果有要显示的服务器判断位置
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
LoginManager.SocketPort = tonumber(this.serverList[lastIndex].port)
LoginManager.ServerId = this.serverList[lastIndex].server_id
LoginManager.state = this.serverList[lastIndex].state
local severArea = tonumber(string.sub(this.serverList[lastIndex].server_id, 0, -5))
this.serverMes.text = PlayerManager.serverInfo.name .. "\t<color=#56F384FF>" .. severArea .. "</color>" .. Language[11138]
RequestPanel.Hide()
end
function this.CacheLoginData(data)
this.serverList = {}
for i = 1, #data.serverList do
this.serverList[i] = data.serverList[i]
end
table.sort(this.serverList, function(a, b)
if a.isnew == b.isnew then
return a.server_id < b.server_id
else
return a.isnew > b.isnew
end
end)
this.myServerList = {}
for i = 1, #data.myServerList do
this.myServerList[i] = data.myServerList[i]
end
this.lastServer = data.lastServer
this.recommend = data.recommend
end
--用户id登录
function this.OnReceiveLogin(str)
RequestPanel.Hide()
if str == nil then
return
end
if str ~= nil and str ~= "" then
MyPCall(function()
Log(str)
local json = require 'cjson'
local data = json.decode(str)
Log("uid:" .. data.uid)
Log("token:" .. data.token)
if data.uid and data.token and not LoginManager.IsLogin then
AppConst.UserId = data.uid
AppConst.Token = data.token
local openId = AppConst.isSDKLogin and AppConst.OpenId or PlayerPrefs.GetString(openIdkey)
NetManager.LoginRequest(openId, function()
if not LoginManager.IsLogin then
LoginManager.IsLogin = true
this.ExecuteLoading()
end
end)
end
end)
end
end
--登录进主界面之前需要依次请求玩家数据,物品数据,装备数据,英雄数据,编队数据,任务数据, 异妖数据,工坊数据, 冒险数据
function this.ExecuteLoading()
local requestList = {
--[[[1] = ]]function() NetManager.PlayerInfoRequest(LoadingPanel.OnStep) end, -- 基础信息
--[[[2] = ]]function() NetManager.RequestMission(LoadingPanel.OnStep) end, -- 任务信息
--[[[3] = ]]function() NetManager.ItemInfoRequest(0, LoadingPanel.OnStep) end, -- 物品信息
--[[[4] = ]]function() NetManager.AllEquipRequest(0, LoadingPanel.OnStep) end, -- 装备
--[[[5] = ]]function() NetManager.AllEquipTreasureRequest(0, LoadingPanel.OnStep) end, --
--[[[6] = ]]function() NetManager.GetSoulPrintDataRequest(0, LoadingPanel.OnStep) end, -- 魂印
--[[[7] = ]]function() NetManager.DiffMonsterRequest(0,LoadingPanel.OnStep) end, -- 异妖
--[[[8] = ]]function() NetManager.HeroInfoRequest(0, LoadingPanel.OnStep) end, --
--[[[9] = ]]function() NetManager.TeamInfoRequest(LoadingPanel.OnStep) end, -- 编队
--[[[10] =]] function() NetManager.GetAllMailData(LoadingPanel.OnStep) end, -- 邮件
--[[[11] =]] function() NetManager.GetAllFightDataRequest(LoadingPanel.OnStep) end, --
--[[[12] =]] function() NetManager.GetActivityAllRewardRequest(LoadingPanel.OnStep) end, -- 活动奖励
--[[[13] =]] function() NetManager.RequestBaseArenaData(LoadingPanel.OnStep) end, -- 竞技场
--[[[14] =]] function() ShopManager.InitData(LoadingPanel.OnStep) end, -- 商店
--[[[15] =]] --function() NetManager.GetWorkShopInfoRequest(LoadingPanel.OnStep) end, -- 工坊?
--[[[16] =]] function() ChatManager.InitData(LoadingPanel.OnStep) end, -- 聊天
--[[[17] =]] function() NetManager.GetAllFunState(LoadingPanel.OnStep) end, -- 功能开启信息
--[[[18] =]] function() NetManager.RequestGetFriendInfo(1, LoadingPanel.OnStep) end, -- 好友
--[[[19] =]] function() NetManager.RequestGetFriendInfo(2, LoadingPanel.OnStep) end, -- 好友申请
--[[[20] =]] function() NetManager.RequestGetFriendInfo(3, LoadingPanel.OnStep) end, -- 好友搜索
--[[[21] =]] function() NetManager.RequestGetFriendInfo(4, LoadingPanel.OnStep) end, -- 黑名单
--[[[22] =]] function() FriendChatManager.InitData(LoadingPanel.OnStep) end, -- 好友消息
--[[[23] =]] function() MyGuildManager.InitBaseData(LoadingPanel.OnStep) end, -- 公会信息
--[[[24] =]] function() GuildFightManager.InitBaseData(LoadingPanel.OnStep) end, -- 公会战
--[[[25] =]] function() NetManager.GetAllGuildSkillData(LoadingPanel.OnStep) end, -- 公会技能
--[[[26] =]] function() NetManager.InitFightPointLevelInfo(LoadingPanel.OnStep) end, -- 关卡
--[[[27] =]] function() NetManager.GetExpeditionRequest(ExpeditionManager.expeditionLeve,LoadingPanel.OnStep) end, -- 大闹天宫
--[[[28] =]] function() NetManager.GuildHelpGetAllRequest(LoadingPanel.OnStep) end, -- 公会援助
--[[[29] =]] function() DeathPosManager.InitData(LoadingPanel.OnStep) end, -- 十绝阵
--[[[30] =]] function() NetManager.TreasureOfHeavenScoreRequest(LoadingPanel.OnStep) end, -- 天宫秘宝积分
--[[[31] =]] function() NetManager.RankFirstRequest({3,22,20,4,21},{0,0,0,0,20},LoadingPanel.OnStep) end, -- 排行榜数据
--[[[32] =]] function() NetManager.GetSituationInfoRequest(LoadingPanel.OnStep) end,
--[[[33] =]] function() NetManager.RefreshTimeSLRequest(LoadingPanel.OnStep) end,
--[[[34] =]] function() HeroManager.CheckRepeatTreasure(LoadingPanel.OnStep) end,
--[[[34] =]] function() XiaoYaoManager.GetOpenMapData(LoadingPanel.OnStep) end,
function() NetManager.GetHeroSkinData(LoadingPanel.OnStep) end,
function() NetManager.HongMengInfoResponse(LoadingPanel.OnStep) end,
--[[[35] =]] function() -- 登录请求最终接口,所有请求放在此接口之前
-- 登录成功确认
NetManager.LoginConfimRequest()
if AppConst.isGuide then
if GuideManager.GetCurId(GuideType.Force) == 1 and PlayerManager.nickName == tostring(PlayerManager.uid) and PlayerManager.level == 1 then
--创号阶段先进入剧情对话,进入假战斗,然后对话起名,最后进入主界面
StoryManager.EventTrigger(100001, function()
PatFaceManager.isLogin = true
UIManager.OpenPanel(UIName.FightPointPassMainPanel)
LoadingPanel.End()
end)
else
PatFaceManager.isLogin = true
UIManager.OpenPanel(UIName.FightPointPassMainPanel)
LoadingPanel.End()
end
else
UIManager.OpenPanelAsync(UIName.MainPanel, function()
if RoomManager.RoomAddress == nil or RoomManager.RoomAddress == "" then
RoomManager.IsMatch = 0
elseif RoomManager.RoomAddress == "1" then
RoomManager.IsMatch = 1
UIManager.OpenPanel(UIName.GMPanel)
PopupTipPanel.ShowTip(Language[11141])
else
if RoomManager.CurRoomType == 1 then
Log("在房间里,需要重新获取房间游戏数据~~~~~~~~~~")
RoomManager.RoomReGetGameRequest(RoomManager.RoomAddress)
end
end
LoadingPanel.End()
end)
end
-- 登录成功刷新红点数据
RedpotManager.CheckAllRedPointStatus()
-- 检查新字状态
FunctionOpenMananger.InitCheck()
this.SubmitGameData()
DataCenterManager.CommitBootStatus()
end,
}
--
for _, func in ipairs(requestList) do
LoadingPanel.AddStep(func)
end
LoadingPanel.Start()
this:ClosePanel()
end
this.isLoginClick = false
function this.OnLoginClick()
if LoginManager.state == 0 or LoginManager.state == 1 then
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)
-- 还是不可进状态则请求
if LoginManager.state == 0 or LoginManager.state == 1 then
PopupTipPanel.ShowTip(Language[11142])
RequestPanel.Hide()
else
-- 连接socket
this.RequestSocketLogin()
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
return
end
-- 连接socket
this.RequestSocketLogin()
end
-- 请求连接socket
function this.RequestSocketLogin()
LogRed("请求连接Socket")
RequestPanel.Show(Language[11143])
SocketManager.Disconnect(SocketType.LOGIN)
SocketManager.AddNetwork(SocketType.LOGIN, LoginManager.SocketAddress, LoginManager.SocketPort)
SocketManager.TryConnect(SocketType.LOGIN)
end
function this.OnConnect(network)
RequestPanel.Hide()
if network.type ~= SocketType.LOGIN then
return
end
RequestPanel.Show(Language[11144])
if IsSDKLogin then
Log(LoginRoot_Url
.. "jl_loginserver/getHwUserInfo?openId=" .. AppConst.OpenId
.. "&serverId=" .. LoginManager.ServerId
.. "&token=" .. AppConst.TokenStr
.. "&platform=" .. 1
.. "&sub_channel=" .. LoginRoot_SubChannel
.. "&pid=" .. AppConst.SdkChannel --LoginManager.pt_pId
.. "&gid=" .. AppConst.SdkPackageName --LoginManager.pt_gId
.. "&version=" .. LoginRoot_PackageVersion)
networkMgr:SendGetHttp(LoginRoot_Url
.. "jl_loginserver/getHwUserInfo?openId=" .. AppConst.OpenId
.. "&serverId=" .. LoginManager.ServerId
.. "&token=" .. AppConst.TokenStr
.. "&platform=" .. 1
.. "&sub_channel=" .. LoginRoot_SubChannel
.. "&pid=" .. AppConst.SdkChannel --LoginManager.pt_pId
.. "&gid=" .. AppConst.SdkPackageName --LoginManager.pt_gId
.. "&version=" .. LoginRoot_PackageVersion,
this.OnReceiveLogin, nil, nil, nil)
else
if IsDevelopLogin then
-- 开发用
local str = this.inputField.text
PlayerPrefs.SetString(openIdkey, str)
networkMgr:SendGetHttp(LoginRoot_Url
.. "jl_loginserver/getUserInfo?openId=" .. str
.. "&serverId=" .. LoginManager.ServerId
.. "&token=111"
.. "&platform=1"
.. "&sub_channel=" .. LoginRoot_SubChannel
.. "&admin=d53b3e8ef74bf72d8aafce3a1c8671a0"
.. "&version=" .. LoginRoot_PackageVersion,
this.OnReceiveLogin, nil, nil, nil)
else
networkMgr:SendGetHttp(LoginRoot_Url
.. "jl_loginserver/getUserInfo?openId=" ..LoginManager.openId
.. "&serverId=" .. LoginManager.ServerId
.. "&token=" .. LoginManager.token
.. "&platform=4"
.. "&sub_channel=" .. LoginRoot_SubChannel
.. "&admin=d53b3e8ef74bf72d8aafce3a1c8671a0"
.. "&version=" .. LoginRoot_PackageVersion,
this.OnReceiveLogin, nil, nil, nil)
end
-- if IsTestLogin then
-- networkMgr:SendGetHttp(LoginRoot_Url
-- .. "jl_loginserver/getUserInfo?openId=" .. LoginManager.openId
-- .. "&serverId=" .. LoginManager.ServerId
-- .. "&token=" .. LoginManager.token
-- .. "&platform="..4
-- .. "&version=" .. LoginRoot_PackageVersion,
-- this.OnReceiveLogin, nil, nil, nil)
-- else
-- --
-- networkMgr:SendGetHttp(LoginRoot_Url
-- .. "jl_loginserver/getUserInfo?openId=" .. str
-- .. "&platform=3&sub_channel=" .. LoginRoot_SubChannel
-- .. "&serverId=" .. LoginManager.ServerId
-- .. "&token=" .. AppConst.Token
-- .. "&version=" .. LoginRoot_PackageVersion,
-- this.OnReceiveLogin, nil, nil, nil)
-- --TODO:线上调试用
-- -- networkMgr:SendGetHttp(LoginRoot_Url
-- -- .. "jl_loginserver/getUserInfo?openId=" .. str
-- -- .. "&platform=1&sub_channel=" .. LoginRoot_SubChannel
-- -- .. "&serverId=" .. LoginManager.ServerId
-- -- .. "&token=111&admin=d53b3e8ef74bf72d8aafce3a1c8671a0"
-- -- .. "&version=" .. LoginRoot_PackageVersion,
-- -- this.OnReceiveLogin, nil, nil, nil)
-- end
end
end
function this.OnDisconnect(network)
RequestPanel.Hide()
PopupTipPanel.ShowTip(Language[11145])
end
function this.SetLoginPart(flag)
this.loginAnim.enabled = flag
this.btnLoginPart:SetActive(flag)
this.btnLogin:SetActive(flag)
this.serverSelectPart:SetActive(flag)
end
function this.SubmitGameData()
local isNewRole = PlayerPrefs.GetString(tostring(PlayerManager.uid), "")
if isNewRole == "" then
PlayerPrefs.SetString(tostring(PlayerManager.uid), tostring(PlayerManager.uid))
SubmitExtraData({ type = SDKSubMitType.TYPE_CREATE_ROLE })
end
SubmitExtraData({ type = SDKSubMitType.TYPE_ENTER_GAME })
end
return LoginPanel