服务器相关
This commit is contained in:
16
Entity/Game/Player/Child/PlayerInfo.cs
Normal file
16
Entity/Game/Player/Child/PlayerInfo.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using Fantasy.Entitas;
|
||||||
|
|
||||||
|
namespace NB;
|
||||||
|
|
||||||
|
public class PlayerInfo : Entity
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 昵称
|
||||||
|
/// </summary>
|
||||||
|
public string NickName;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 头像
|
||||||
|
/// </summary>
|
||||||
|
public string Head;
|
||||||
|
}
|
||||||
@@ -15,6 +15,8 @@ public sealed class Player : Entity
|
|||||||
|
|
||||||
[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
|
[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
|
||||||
public Dictionary<int, int> Currency = new();
|
public Dictionary<int, int> Currency = new();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[BsonIgnore] public long SessionRunTimeId;
|
[BsonIgnore] public long SessionRunTimeId;
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ public class G2Game_EnterRequestHandler : RouteRPC<Scene, G2Game_EnterRequest, G
|
|||||||
// 如果没有,就要创建一个新的并且保存到数据库。
|
// 如果没有,就要创建一个新的并且保存到数据库。
|
||||||
// 如果不存在,表示这是一个新的账号,需要创建一下这个账号。
|
// 如果不存在,表示这是一个新的账号,需要创建一下这个账号。
|
||||||
account = await PlayerFactory.Create(scene, accountId);
|
account = await PlayerFactory.Create(scene, accountId);
|
||||||
|
|
||||||
|
// account.
|
||||||
|
|
||||||
account.Basic.Level = 99;
|
account.Basic.Level = 99;
|
||||||
account.Basic.NickName = "王麻子";
|
account.Basic.NickName = "王麻子";
|
||||||
account.Basic.Country = "cn";
|
account.Basic.Country = "cn";
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ public static class PlayerFactory
|
|||||||
var gameAccount = Entity.Create<Player>(scene, aId, false, false);
|
var gameAccount = Entity.Create<Player>(scene, aId, false, false);
|
||||||
gameAccount.LoginTime = gameAccount.CreateTime = TimeHelper.Now;
|
gameAccount.LoginTime = gameAccount.CreateTime = TimeHelper.Now;
|
||||||
|
|
||||||
|
var info = gameAccount.AddComponent<PlayerInfo>();
|
||||||
|
|
||||||
if (isSaveDataBase)
|
if (isSaveDataBase)
|
||||||
{
|
{
|
||||||
await gameAccount.SaveDataBase();
|
await gameAccount.SaveDataBase();
|
||||||
|
|||||||
Reference in New Issue
Block a user