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

621 lines
25 KiB
Lua

require("Base/BasePanel")
LoginPanel = Inherit(BasePanel)
local this = LoginPanel
this.LoginWay = { Account = 0, WeChat = 1 }
local IsTestLogin = not AppConst.isSDK
local openIdkey = "openIdkey"
local openIdPw = "openIdPw"
local lastServerIndex = "lastServerIndex"
local defaultOpenIdkey = "请输入账号"
local defaultOpenIdPw = ""
local LoginRoot_Url = VersionManager:GetVersionInfo("serverUrl")
local LoginRoot_SubChannel = VersionManager:GetVersionInfo("subChannel")
local LoginRoot_Channel = VersionManager:GetVersionInfo("channel")
local LoginRoot_Version = VersionManager:GetVersionInfo("version")
local LoginRoot_PackageVersion = VersionManager:GetVersionInfo("packageVersion")
local orginLayer
--初始化组件(用于子类重写)
function this:InitComponent()
orginLayer = 0
this.loginPart = Util.GetGameObject(self.transform, "fx_map_Effect_youxikaishi/Image effect")
this.tip = Util.GetGameObject(this.loginPart, "tip/Text")
this.btnLoginPart = Util.GetGameObject(this.loginPart, "youxikaishi")
this.btnLogin = Util.GetGameObject(this.btnLoginPart, "btn")
--this.dropDownPart = Util.GetGameObject(this.loginPart, "quyuxuanzhe")
--this.dropDown = Util.GetGameObject(this.dropDownPart, "Dropdown"):GetComponent("Dropdown")
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")
---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.versionText = Util.GetGameObject(this.loginPart, "version"):GetComponent("Text")
this.versionText.text = "版本:"..LoginRoot_Version
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()
UIManager.OpenPanel(UIName.NoticePopup)
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]
PlayerPrefs.SetInt(lastServerIndex, index)
PlayerManager.serverInfo = list
LoginManager.SocketAddress = list.ip
LoginManager.SocketPort = list.port
LoginManager.ServerId = list.server_id
local severArea = tonumber(string.sub(list.server_id, 0, -5))
this.serverMes.text = PlayerManager.serverInfo.name .. "\t<color=#56F384FF>" .. severArea .. "</color>" .. ""
end
})
end)
--SDK 登录
Util.AddClick(this.sdkLoginBtn, function()
this.sdkLoginBtn:SetActive(false)
this.SDKLogin()
end)
this.inputField.gameObject:SetActive(not AppConst.isSDK and not IsTestLogin)
this.UserBtn:SetActive(IsTestLogin)
this.btnUser:SetActive(IsTestLogin)
if not IsTestLogin then
this.btnNotice.transform.position = this.btnUser.transform.position
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)
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)
end
function this:OnSortingOrderChange()
Util.AddParticleSortLayer(self.gameObject, self.sortingOrder - orginLayer)
orginLayer = this.sortingOrder
end
--界面打开时调用(用于子类重写)
function this:OnOpen(...)
if AppConst.Code ~= "" then
MsgPanel.ShowOne(AppConst.Code)
AppConst.Code = ""
end
this.sdkLoginBtn:SetActive(AppConst.isSDK)
if IsTestLogin then
this.UserBtnText.text = PlayerPrefs.GetString(openIdkey, defaultOpenIdkey)
else
this.inputField.text = PlayerPrefs.GetString(openIdkey, defaultOpenIdkey)
end
local tran = this.tip:GetComponent("RectTransform")
local offsetX = (LayoutUtility.GetPreferredWidth(tran) + Screen.width) / 2
tran.anchoredPosition = Vector2.New(offsetX, 0)
tran:DOAnchorPosX(-offsetX, 30, false):SetEase(Ease.Linear):SetLoops(-1)
if not AppConst.isSDK then
RequestPanel.Show("正在获取服务器列表")
this.SetLoginPart(true)
this.inputField.gameObject:SetActive(not IsTestLogin)
local userId = PlayerPrefs.GetString(openIdkey, defaultOpenIdkey)
networkMgr:SendGetHttp(string.format("%sjl_loginserver/getServerList?openId=%s&channel=%s&plat=android&sub_channel=%s", LoginRoot_Url, userId, LoginRoot_Channel, LoginRoot_SubChannel),
this.OnReceiveServerList, nil, nil, nil)
end
SoundManager.PlayMusic(SoundConfig.BGM_Login)
SoundManager.PlayAmbient(SoundConfig.Ambient_Login)
end
--界面关闭时调用(用于子类重写)
function this:OnClose()
this.SetLoginPart(false)
SoundManager.PauseAmbient()
end
--界面销毁时调用(用于子类重写)
function this:OnDestroy()
end
function this.SDKLogin()
KTSDK.Helper.Instance:Login()
end
function this.RefreshLoginStatus(loginResp)
local result = string.split(loginResp, "#")
if tonumber(result[1]) == SDKCodeResult.CODE_AUTH_TOKEN_SUCCESS then
RequestPanel.Show("正在获取服务器列表")
this.SetLoginPart(true)
AppConst.OpenId = result[2]
AppConst.TokenStr = result[3]
this.SetSDKExtensionParams(result[4])
networkMgr:SendGetHttp(string.format("%sjl_loginserver/getServerList?openId=%s&channel=%s&plat=android&sub_channel=%s", LoginRoot_Url, AppConst.OpenId, LoginRoot_Channel, LoginRoot_SubChannel),
this.OnReceiveServerList, nil, nil, nil)
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 IsTestLogin 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
UIManager.OpenPanel(UIName.NoticePopup)
end
end)
end
else
UIManager.OpenPanel(UIName.NoticePopup)
end
end)
end
end
function this.SetServerList(data)
this.CacheLoginData(data)
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
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
end
end
if not this.serverList[lastIndex] then
lastIndex = 1
PlayerPrefs.SetInt(lastServerIndex, 1)
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
local severArea = tonumber(string.sub(this.serverList[lastIndex].server_id, 0, -5))
this.serverMes.text = PlayerManager.serverInfo.name .. "\t<color=#56F384FF>" .. severArea .. "</color>" .. ""
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.isSDK and AppConst.OpenId or PlayerPrefs.GetString(openIdkey)
NetManager.LoginRequest(openId, LoginManager.pt_pId, LoginManager.pt_gId, function()
if not LoginManager.IsLogin then
LoginManager.IsLogin = true
this.ExecuteLoading()
end
end)
end
end)
end
end
--登录进主界面之前需要依次请求玩家数据,物品数据,装备数据,英雄数据,编队数据,任务数据, 异妖数据,工坊数据, 冒险数据
function this.ExecuteLoading()
LoadingPanel.AddStep(function()
NetManager.PlayerInfoRequest(LoadingPanel.OnStep)
end)
---获取任务信息
LoadingPanel.AddStep(function()
NetManager.RequestMission(LoadingPanel.OnStep)
end)
LoadingPanel.AddStep(function()
NetManager.ItemInfoRequest(0, LoadingPanel.OnStep)
end)
LoadingPanel.AddStep(function()
NetManager.AllEquipRequest(0, LoadingPanel.OnStep)
end)
LoadingPanel.AddStep(function()
NetManager.AllEquipTreasureRequest(0, LoadingPanel.OnStep)
end)
-- LoadingPanel.AddStep(function()
-- NetManager.AllTalismanRequest(0, LoadingPanel.OnStep)
-- end)
LoadingPanel.AddStep(function()
NetManager.GetSoulPrintDataRequest(0, LoadingPanel.OnStep)
end)
LoadingPanel.AddStep(function()
NetManager.DiffMonsterRequest(LoadingPanel.OnStep)
end)
--LoadingPanel.AddStep(function()
-- NetManager.TalentRequest(LoadingPanel.OnStep)
--end)
LoadingPanel.AddStep(function()
NetManager.HeroInfoRequest(0, LoadingPanel.OnStep)
end)
LoadingPanel.AddStep(function()
NetManager.TeamInfoRequest(LoadingPanel.OnStep)
end)
--LoadingPanel.AddStep(function ()
-- NetManager.MissionInfoRequest(LoadingPanel.OnStep)
--end)
LoadingPanel.AddStep(function()
NetManager.GetAllMailData(LoadingPanel.OnStep)
end)
LoadingPanel.AddStep(function()
NetManager.GetAllFightDataRequest(LoadingPanel.OnStep)
end)
LoadingPanel.AddStep(function()
NetManager.GetActivityAllRewardRequest(LoadingPanel.OnStep)
end)
LoadingPanel.AddStep(function()
NetManager.RequestBaseArenaData(LoadingPanel.OnStep)
end)
LoadingPanel.AddStep(function()
ShopManager.InitData(LoadingPanel.OnStep)
end)
LoadingPanel.AddStep(function()
NetManager.GetWorkShopInfoRequest(LoadingPanel.OnStep)
end)
LoadingPanel.AddStep(function()
ChatManager.InitData(LoadingPanel.OnStep)
end)
--LoadingPanel.AddStep(function()
-- NetManager.GetAdventureStateInfoRequest(LoadingPanel.OnStep)
--end)
LoadingPanel.AddStep(function()
NetManager.GetSecretBoxInfoRequest(LoadingPanel.OnStep)
end)
LoadingPanel.AddStep(function()
NetManager.GetAllFunState(LoadingPanel.OnStep)
end)
LoadingPanel.AddStep(function()
-- 好友列表
NetManager.RequestGetFriendInfo(1, LoadingPanel.OnStep)
end)
LoadingPanel.AddStep(function()
-- 推荐列表
NetManager.RequestGetFriendInfo(2, LoadingPanel.OnStep)
end)
LoadingPanel.AddStep(function()
-- 申请列表
NetManager.RequestGetFriendInfo(3, LoadingPanel.OnStep)
end)
LoadingPanel.AddStep(function()
-- 黑名单
NetManager.RequestGetFriendInfo(4, LoadingPanel.OnStep)
end)
-- 好友聊天数据放在好友数据后加载
LoadingPanel.AddStep(function()
FriendChatManager.InitData(LoadingPanel.OnStep)
end)
LoadingPanel.AddStep(function()
MyGuildManager.InitBaseData(LoadingPanel.OnStep)
end)
LoadingPanel.AddStep(function()
GuildFightManager.InitBaseData(LoadingPanel.OnStep)
end)
LoadingPanel.AddStep(function()
NetManager.GetAllGuildSkillData(LoadingPanel.OnStep)
end)
LoadingPanel.AddStep(function()
NetManager.InitFightPointLevelInfo(LoadingPanel.OnStep)
end)
--LoadingPanel.AddStep(function()
-- NetManager.InitPrayDataRequest(LoadingPanel.OnStep)
--end)
LoadingPanel.AddStep(function()
NetManager.InitFightPointLevelInfo(LoadingPanel.OnStep)
end)
LoadingPanel.AddStep(function()
NetManager.GetExpeditionRequest(LoadingPanel.OnStep)
end)
LoadingPanel.AddStep(function()
if AppConst.isGuide then
if GuideManager.GetCurId(1) == 1 and PlayerManager.nickName == tostring(PlayerManager.uid) then
--创号阶段先进入剧情对话,进入假战斗,然后对话起名,最后进入主界面
local exBattle = function ()
local testFightData = {enemyData={{{ai={0},camp=1,element=2,monsterId=10101131,passivity={},professionId=0,property={0,1290,1290,88,23,23,400,0,0,0.05,1,0.2,1.5,0,1,1,0,0,0,0,0,0,0,0,0},quality=0,roleId=1,skill={0,{40001,0.4,{1,2.4,1}}},superSkill={45000,{40001,0.8,{6,3,3,1.2,1}}},type=1},{ai={0},camp=1,element=4,monsterId=10101132,passivity={},professionId=0,property={0,1290,1290,88,23,23,400,0,0,0.05,1,0.2,1.5,0,1,1,0,0,0,0,0,0,0,0,0},quality=0,roleId=1,skill={0,{40001,0.4,{1,2.4,1}}},superSkill={45000,{40001,0.4,{6,3,3,1.2,1}}},type=1},{ai={0},camp=1,element=2,monsterId=10101133,passivity={},professionId=0,property={0,1290,1290,88,23,23,400,0,0,0.05,1,0.2,1.5,0,1,1,0,0,0,0,0,0,0,0,0},quality=0,roleId=1,skill={0,{40001,0.4,{1,2.4,1}}},superSkill={45000,{40001,0.4,{6,3,3,1.2,1}}},type=1},teamPassive={},teamSkill={}},{{ai={0},camp=1,element=1,monsterId=10001,passivity={},professionId=0,property={12,18000,18000,60,60,60,1080,0,0,0.05,1,0.2,1.5,0,1,1,0,0,0,0,0,0,0,0,0},quality=0,roleId=45,skill={0,{20003,0.4,{1,0.6,1},{13,3,0.2,1,5}}},superSkill={75000,{20000,0.4,{2,1.44,2},{3,0.3,1,4}}},type=1},teamPassive={},teamSkill={}}},playerData={{camp=0,element=3,passivity={{57,0.2,4}},professionId=2,property={1,1043,1043,115,100,72,295,0,0,0,1,0,1.5,0,1,1,0,0,0,0,0,0,0,0,0},quality=0,roleId=10023,skill={0,{40001,0.4,{1,2.2,1}}},type=1},{camp=0,element=5,passivity={{69,0.14,0.3,0.4}},professionId=2,property={1,1325,1325,145,111,78,300,0,0,0,1,0.15,1.5,0,1,1,0,0,0,0,0,0,0,0,0},quality=0,roleId=10015,skill={0,{40001,1.1,{62,5,5,0.45,1}}},type=1},{camp=0,element=6,passivity={},professionId=3,property={1,1322,1322,146,79,109,313,0,0,0,1,0,1.5,0,1,1,0,0,0,0,0,0,0,0,0},quality=0,roleId=10014,skill={0,{40001,0.4,{63,2.3,2,1}},{30001,0.4,{4,1,0.05,0,2},{4,9,0.05,0,1},{42,0.7,0.25,10}}},superSkill={45000,{20000,0.4,{64,2.2,2,0.1}}},type=1},{camp=0,element=1,passivity={},professionId=2,property={1,1195,1195,122,111,79,286,0,0,0,1,0.15,1.5,0,1,1,0,0,0,0,0,0,0,0,0},quality=0,roleId=10012,skill={0,{20803,0.4,{18,2.3,1,1.5}}},superSkill={45000,{40001,1.5,{50,42,1,0.1}}},type=1},{camp=0,element=3,passivity={},professionId=2,property={1,1195,1195,122,111,78,300,0,0,0,1,0,1.5,0,1,1,0,0,0,0,0,0,0,0,0},quality=0,roleId=10010,skill={0,{40001,0.4,{71,2,2,1.1,1,0.15,1,3,1}}},superSkill={45000,{40001,0.8,{98,4,4,1.3,1,0.2,1,3,1}}},type=1},teamPassive={},teamSkill={}}}
local testSeed = 1573538141
local testFightType = 2
local testFightTime = 90
local battlePanel = UIManager.OpenPanel(UIName.BattlePanel, testFightData, testSeed, testFightType, testFightTime, "back#1", nil, function (result)
StoryManager.EventTrigger(100001)
local triggerCallBack
triggerCallBack = function(panelType, panel)
if panelType == UIName.StoryDialoguePanel then
PatFaceManager.isLogin = true
UIManager.OpenPanelAsync(UIName.MainPanel, function ()
UIManager.OpenPanel(UIName.FightPointPassMainPanel)
LoadingPanel.End()
end)
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, triggerCallBack)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, triggerCallBack)
end)
battlePanel:InitNewEvent()
end
StoryManager.EventTrigger(138018, exBattle)
else
if PlayerManager.curMapId ~= 0 then
NetManager.MapInfoRequest(PlayerManager.curMapId, FormationManager.curFormationIndex, function()
UIManager.OpenPanelAsync(UIName.MapPanel, LoadingPanel.End)
end)
else
PatFaceManager.isLogin = true
UIManager.OpenPanelAsync(UIName.MainPanel, function ()
UIManager.OpenPanel(UIName.FightPointPassMainPanel)
LoadingPanel.End()
end)
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("您已经在请求匹配血战游戏了,请耐心等待匹配成功")
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)
LoadingPanel.Start()
this:ClosePanel()
end
function this.OnLoginClick()
RequestPanel.Show("正在连接服务器")
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("正在获取登录信息")
if AppConst.isSDK then
networkMgr:SendGetHttp(LoginRoot_Url
.. "jl_loginserver/getUserInfo?openId=" .. AppConst.OpenId
.. "&platform=1&sub_channel=" .. LoginRoot_SubChannel
.. "&serverId=" .. LoginManager.ServerId
.. "&token=" .. AppConst.TokenStr
.. "&pid=" .. LoginManager.pt_pId
.. "&gid=" .. LoginManager.pt_gId
.. "&version=" .. LoginRoot_PackageVersion,
this.OnReceiveLogin, nil, nil, nil)
else
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
local str = this.inputField.text
PlayerPrefs.SetString(openIdkey, str)
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("服务器正在维护中")
end
function this.SetLoginPart(flag)
this.btnLoginPart:SetActive(flag)
--this.dropDownPart: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