32 lines
1007 B
C#
32 lines
1007 B
C#
using Fantasy;
|
|
using Fantasy.Async;
|
|
using Fantasy.Network;
|
|
using Fantasy.Network.Interface;
|
|
|
|
namespace NB.Gate;
|
|
|
|
public sealed class C2G_GetAccountInfoRequestHandler : MessageRPC<C2G_GetAccountInfoRequest, G2C_GetAccountInfoResponse>
|
|
{
|
|
protected override async FTask Run(Session session, C2G_GetAccountInfoRequest request, G2C_GetAccountInfoResponse response, Action reply)
|
|
{
|
|
var gameAccountFlagComponent = session.GetComponent<PlayerFlagComponent>();
|
|
|
|
if (gameAccountFlagComponent == null)
|
|
{
|
|
// 表示不应该访问这个接口,要先访问登录的接口。
|
|
// response.ErrorCode = 1;
|
|
session.Dispose();
|
|
return;
|
|
}
|
|
|
|
Player account = gameAccountFlagComponent.Player;
|
|
|
|
if (account == null)
|
|
{
|
|
// 表示这个Account已经被销毁过了。不是咱们想要的了
|
|
}
|
|
|
|
response.GameAccountInfo = account.GetGameAccountInfo();
|
|
await FTask.CompletedTask;
|
|
}
|
|
} |