HaoYueTunnel/ClientCore/Manager/AppLogin.cs

33 lines
904 B
C#
Raw Normal View History

2023-05-24 18:31:11 +08:00
using AxibugProtobuf;
2023-05-25 18:30:22 +08:00
using ClientCore.Common;
2023-06-15 15:45:58 +08:00
using ClientCore.Event;
using ClientCore.Network;
2023-05-24 18:31:11 +08:00
2023-05-25 18:30:22 +08:00
namespace ClientCore.Manager
2023-05-24 18:31:11 +08:00
{
public class AppLogin
{
2023-06-15 15:45:58 +08:00
public AppLogin()
{
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdLogin, RecvCmdLogin);
}
2023-05-25 13:24:51 +08:00
public void Login(string Account)
2023-05-24 18:31:11 +08:00
{
Protobuf_Login msg = new Protobuf_Login()
{
LoginType = 0,
2023-05-25 13:24:51 +08:00
Account = Account,
2023-05-24 18:31:11 +08:00
};
2023-06-15 15:45:58 +08:00
App.networkMain.SendToServer((int)CommandID.CmdLogin, ProtoBufHelper.Serizlize(msg));
}
public void RecvCmdLogin(byte[] reqData)
{
Protobuf_Login_RESP msg = ProtoBufHelper.DeSerizlize<Protobuf_Login_RESP>(reqData);
App.userMgr.SetMainPlayer(msg.UID, msg.NickName, 0);
EventSystem.Instance.PostEvent(EEvent.UserLogin);
2023-05-24 18:31:11 +08:00
}
}
}