服务器相关

This commit is contained in:
2025-07-30 09:17:13 +08:00
parent 09bbae66d2
commit e612d8fe38
4 changed files with 23 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
using Fantasy.Entitas;
namespace NB;
public class PlayerInfo : Entity
{
/// <summary>
/// 昵称
/// </summary>
public string NickName;
/// <summary>
/// 头像
/// </summary>
public string Head;
}

View File

@@ -15,6 +15,8 @@ public sealed class Player : Entity
[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
public Dictionary<int, int> Currency = new();
[BsonIgnore] public long SessionRunTimeId;

View File

@@ -32,6 +32,9 @@ public class G2Game_EnterRequestHandler : RouteRPC<Scene, G2Game_EnterRequest, G
// 如果没有,就要创建一个新的并且保存到数据库。
// 如果不存在,表示这是一个新的账号,需要创建一下这个账号。
account = await PlayerFactory.Create(scene, accountId);
// account.
account.Basic.Level = 99;
account.Basic.NickName = "王麻子";
account.Basic.Country = "cn";

View File

@@ -20,6 +20,8 @@ public static class PlayerFactory
var gameAccount = Entity.Create<Player>(scene, aId, false, false);
gameAccount.LoginTime = gameAccount.CreateTime = TimeHelper.Now;
var info = gameAccount.AddComponent<PlayerInfo>();
if (isSaveDataBase)
{
await gameAccount.SaveDataBase();