using Fantasy;
using Fantasy.Async;
namespace NB.Authentication;
public static class AuthenticationHelper
{
///
/// 登录账号
///
///
/// 用户名
/// 用户密码
///
public static async FTask<(uint ErrorCode, long AccountId, int region)> Login(Scene scene, string userName,
string password)
{
return await scene.GetComponent().Login(userName, password);
}
///
/// 注册一个新的账号
///
///
/// 用户名
/// 注册地区
/// 注册的来源/原因
///
public static async FTask Register(Scene scene, string username, int region, string source)
{
return await scene.GetComponent().Register(username, region, source);
}
///
/// 移除一个账号
///
///
/// 账号ID
/// 移除的来源/原因
///
public static async FTask Remove(Scene scene, long accountId, string source)
{
return await scene.GetComponent().Remove(accountId, source);
}
///
/// 移除缓存中的Account
///
///
/// 账号名字
/// 是否销毁
public static void RemoveCache(Scene scene, string username, bool isDispose)
{
scene.GetComponent().RemoveCache(username, isDispose);
}
///
/// 移除LoginAccounts缓存中的数据,仅供内部调用,不明白原理的不要调用,否则后果自负。
///
///
///
///
internal static void RemoveLoginAccounts(Scene scene, string key, bool isDispose)
{
scene.GetComponent().RemoveLoginAccounts(key, isDispose);
}
}