2023-05-23 17:57:24 +08:00
|
|
|
|
using AxibugProtobuf;
|
2023-05-25 18:30:22 +08:00
|
|
|
|
using ServerCore.Common;
|
|
|
|
|
using ServerCore.NetWork;
|
2023-05-23 17:57:24 +08:00
|
|
|
|
using System.Net.Sockets;
|
|
|
|
|
|
2023-05-25 18:30:22 +08:00
|
|
|
|
namespace ServerCore.Manager
|
2023-05-23 17:57:24 +08:00
|
|
|
|
{
|
|
|
|
|
public class LoginManager
|
|
|
|
|
{
|
2023-05-25 18:30:22 +08:00
|
|
|
|
public LoginManager()
|
|
|
|
|
{
|
|
|
|
|
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdLogin, UserLogin);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UserLogin(Socket _socket, byte[] reqData)
|
2023-05-23 17:57:24 +08:00
|
|
|
|
{
|
|
|
|
|
ServerManager.g_Log.Debug("收到新的登录请求");
|
2023-05-25 18:30:22 +08:00
|
|
|
|
Protobuf_Login msg = ProtoBufHelper.DeSerizlize<Protobuf_Login>(reqData);
|
|
|
|
|
ClientInfo cinfo = ServerManager.g_ClientMgr.JoinNewClient(msg, _socket);
|
2023-05-23 17:57:24 +08:00
|
|
|
|
|
2023-05-25 18:30:22 +08:00
|
|
|
|
byte[] respData = ProtoBufHelper.Serizlize(new Protobuf_Login_RESP()
|
2023-05-23 17:57:24 +08:00
|
|
|
|
{
|
|
|
|
|
Status = LoginResultStatus.Ok,
|
|
|
|
|
RegDate = "",
|
|
|
|
|
LastLoginDate = "",
|
2023-06-15 15:45:58 +08:00
|
|
|
|
Token = "",
|
|
|
|
|
UID = cinfo.UID,
|
|
|
|
|
NickName= cinfo.NickName,
|
2023-05-23 17:57:24 +08:00
|
|
|
|
});
|
|
|
|
|
|
2023-05-25 18:30:22 +08:00
|
|
|
|
ServerManager.g_ClientMgr.ClientSend(cinfo, (int)CommandID.CmdLogin, (int)ErrorCode.ErrorOk, respData);
|
2023-05-23 17:57:24 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|