2024-06-28 18:08:25 +08:00
|
|
|
|
using AxibugEmuOnline.Client.ClientCore;
|
|
|
|
|
using AxibugEmuOnline.Client.Common;
|
|
|
|
|
using AxibugEmuOnline.Client.Network;
|
|
|
|
|
using AxibugProtobuf;
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace AxibugEmuOnline.Client.Manager
|
|
|
|
|
{
|
|
|
|
|
public class AppLogin
|
|
|
|
|
{
|
|
|
|
|
static string LastLoginGuid = "";
|
|
|
|
|
public AppLogin()
|
|
|
|
|
{
|
|
|
|
|
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdLogin, RecvLoginMsg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Login()
|
|
|
|
|
{
|
|
|
|
|
AppAxibugEmuOnline.log.Debug("-->Login");
|
2024-08-16 10:20:00 +08:00
|
|
|
|
if (string.IsNullOrEmpty(LastLoginGuid))
|
2024-06-28 18:08:25 +08:00
|
|
|
|
LastLoginGuid = Guid.NewGuid().ToString();
|
|
|
|
|
|
|
|
|
|
AppAxibugEmuOnline.user.userdata.Account = LastLoginGuid;
|
|
|
|
|
Protobuf_Login msg = new Protobuf_Login()
|
|
|
|
|
{
|
|
|
|
|
LoginType = 0,
|
|
|
|
|
Account = AppAxibugEmuOnline.user.userdata.Account,
|
|
|
|
|
};
|
|
|
|
|
AppAxibugEmuOnline.networkHelper.SendToServer((int)CommandID.CmdLogin, ProtoBufHelper.Serizlize(msg));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RecvLoginMsg(byte[] reqData)
|
|
|
|
|
{
|
|
|
|
|
Protobuf_Login_RESP msg = ProtoBufHelper.DeSerizlize<Protobuf_Login_RESP>(reqData);
|
|
|
|
|
if (msg.Status == LoginResultStatus.Ok)
|
|
|
|
|
{
|
|
|
|
|
AppAxibugEmuOnline.log.Info("登录成功");
|
2024-08-16 10:20:00 +08:00
|
|
|
|
AppAxibugEmuOnline.user.InitMainUserData(AppAxibugEmuOnline.user.userdata.Account, msg.UID);
|
2024-06-28 18:08:25 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
AppAxibugEmuOnline.log.Info("登录失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|