Eintoo/GameServer/Server/Hotfix/Outter/Gate/Helper/GateComponentHelper.cs
2025-04-22 15:31:25 +08:00

42 lines
1.6 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);
}
public static async FTask<uint> UpdateAccountGameName(Scene scene, Session session, long accountId, string gameName)
{
return await scene.GetComponent<GateComponent>().GetComponent<GameAccountManageComponent>().UpdateAccountGameName(session,accountId,gameName);
}
public static async FTask<GameAccount> GetGameAccount(Scene scene,Session session,long accountId)
{
return await scene.GetComponent<GateComponent>().GetComponent<GameAccountManageComponent>().GetGameAccount(session,accountId);
}
}