2023-05-25 13:46:54 +08:00
|
|
|
|
using AxibugProtobuf;
|
2023-12-14 18:15:04 +08:00
|
|
|
|
using ClientCore.Common;
|
2023-05-25 13:46:54 +08:00
|
|
|
|
using ClientCore.Network;
|
|
|
|
|
|
|
|
|
|
namespace ClientCore.Manager
|
|
|
|
|
{
|
|
|
|
|
public class AppLogin
|
|
|
|
|
{
|
2023-12-14 18:15:04 +08:00
|
|
|
|
public AppLogin()
|
|
|
|
|
{
|
|
|
|
|
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdLogin, RecvLoginMsg);
|
|
|
|
|
}
|
2023-05-25 13:46:54 +08:00
|
|
|
|
public void Login(string Account)
|
|
|
|
|
{
|
|
|
|
|
Protobuf_Login msg = new Protobuf_Login()
|
|
|
|
|
{
|
|
|
|
|
LoginType = 0,
|
|
|
|
|
Account = Account,
|
|
|
|
|
};
|
2023-12-19 18:00:46 +08:00
|
|
|
|
App.networkHelper.SendToServer((int)CommandID.CmdLogin, ProtoBufHelper.Serizlize(msg));
|
2023-05-25 13:46:54 +08:00
|
|
|
|
}
|
2023-12-14 18:15:04 +08:00
|
|
|
|
|
|
|
|
|
public void RecvLoginMsg(byte[] reqData)
|
|
|
|
|
{
|
|
|
|
|
Protobuf_Login_RESP msg = ProtoBufHelper.DeSerizlize<Protobuf_Login_RESP>(reqData);
|
|
|
|
|
if (msg.Status == LoginResultStatus.Ok)
|
|
|
|
|
{
|
|
|
|
|
App.log.Debug("登录成功");
|
2023-12-15 13:34:08 +08:00
|
|
|
|
App.user.InitMainUserData(App.user.userdata.Account);
|
2023-12-14 18:15:04 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
App.log.Debug("登录失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-25 13:46:54 +08:00
|
|
|
|
}
|
|
|
|
|
}
|