房间创建和进入相关逻辑和协议

This commit is contained in:
2025-08-27 00:04:40 +08:00
parent 7325e268ce
commit f6d85a1e0a
45 changed files with 1246 additions and 729 deletions

View File

@@ -0,0 +1,8 @@
using Fantasy.Entitas;
namespace NB.Map;
public class MapManageComponent: Entity
{
public readonly Dictionary<long, Map> Maps = new();
}

View File

@@ -0,0 +1,8 @@
using Fantasy.Entitas;
namespace NB.Map;
public class MapUnitManageComponent : Entity
{
public readonly Dictionary<long, MapUnit> Units = new();
}

View File

@@ -0,0 +1,11 @@
using Fantasy.Entitas;
namespace NB.Map;
public class RoomManageComponent : Entity
{
public readonly Dictionary<long, MapRoom> Rooms = new();
public readonly PriorityQueue<int, int> FreeIds = new();
public readonly HashSet<int> InUseID = new();
}

7
Entity/Map/Entity/Map.cs Normal file
View File

@@ -0,0 +1,7 @@
using Fantasy.Entitas;
namespace NB.Map;
public class Map : Entity
{
}

View File

@@ -1,4 +1,5 @@
using Fantasy.Entitas;
using NB.Map;
namespace NB.Map;
@@ -7,10 +8,20 @@ namespace NB.Map;
/// </summary>
public class MapRoom : Entity
{
/// <summary>
/// 房间序号id
/// </summary>
public int RoomId;
/// <summary>
/// 房间代码
/// </summary>
public string Code = string.Empty;
/// <summary>
/// 房间密码
/// </summary>
public string Password;
public string Password = string.Empty;
/// <summary>
/// 房间玩家

View File

@@ -17,4 +17,16 @@ public class MapUnit : Entity
/// 旋转
/// </summary>
public float4 Rotation;
/// <summary>
/// 当前所在地图id
/// </summary>
public int MapId;
/// <summary>
/// 当前所在房间id
/// </summary>
public int RoomId;
public long GateRouteId;
}