修改协议工具
This commit is contained in:
29
Hotfix/Gate/System/Player/PlayerFactory.cs
Normal file
29
Hotfix/Gate/System/Player/PlayerFactory.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Entitas;
|
||||
using Fantasy.Helper;
|
||||
|
||||
namespace NB.Gate;
|
||||
|
||||
public static class PlayerFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建一个新的Player
|
||||
/// </summary>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="aId">ToKen令牌传递过来的aId</param>
|
||||
/// <param name="isSaveDataBase">是否在创建的过程中保存到数据库</param>
|
||||
/// <returns></returns>
|
||||
public static async FTask<Player> Create(Scene scene, long aId, bool isSaveDataBase = true)
|
||||
{
|
||||
var gameAccount = Entity.Create<Player>(scene, aId, false, false);
|
||||
gameAccount.LoginTime = gameAccount.CreateTime = TimeHelper.Now;
|
||||
|
||||
if (isSaveDataBase)
|
||||
{
|
||||
await gameAccount.SaveDataBase();
|
||||
}
|
||||
|
||||
return gameAccount;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user