Eintoo/GameServer/Server/Hotfix/Outter/Gate/Helper/GateComponentHelper.cs

32 lines
1.1 KiB
C#

using System.Runtime.InteropServices;
using Fantasy;
using Fantasy.Async;
using Fantasy.Network;
namespace Hotfix;
public static class GateComponentHelper
{
public static FTask<(uint error, GameAccount gameAccount)> LoginAccountGame(Session session,long accountId)
{
var scene = session.Scene;
var gate = scene.GetComponent<GateComponent>();
var gameAccountManage = gate.GetComponent<GameAccountManageComponent>();
if (gameAccountManage == null)
{
gameAccountManage.AddComponent<GameAccountManageComponent>();
}
return gameAccountManage.LoginAccountGame(session,accountId);
}
public static GameAccountManageComponent GetGameAccountManageComponent(Scene scene)
{
return scene.GetComponent<GateComponent>().GetComponent<GameAccountManageComponent>();
}
public static async FTask Disconnect(Scene scene,long accountId,long timeout)
{
await scene.GetComponent<GateComponent>().GetComponent<GameAccountManageComponent>().DisConnect(accountId,timeout);
}
}