using Fantasy;
using Fantasy.Async;
using Fantasy.Entitas;
using Fantasy.Helper;
namespace NB.Gate;
public static class PlayerFactory
{
///
/// 创建一个新的Player
///
///
/// ToKen令牌传递过来的aId
/// 是否在创建的过程中保存到数据库
///
public static async FTask Create(Scene scene, long aId, bool isSaveDataBase = true)
{
var gameAccount = Entity.Create(scene, aId, false, false);
gameAccount.LoginTime = gameAccount.CreateTime = TimeHelper.Now;
if (isSaveDataBase)
{
await gameAccount.SaveDataBase();
}
return gameAccount;
}
}