角色控制和房间进入推送

This commit is contained in:
2025-09-07 23:51:17 +08:00
parent 61d20b5729
commit 7dad49bf5f
28 changed files with 432 additions and 221 deletions

View File

@@ -1,4 +1,5 @@
using Fantasy.Entitas;
using Fantasy;
using Fantasy.Entitas;
using Fantasy.Entitas.Interface;
namespace NB.Map;
@@ -31,6 +32,24 @@ public static class RoomManageComponentSystem
{
#region
public static MapRoom? Create(this RoomManageComponent self, long ownerId)
{
var roomId = self.AllocateId();
if (roomId < 1)
{
return null;
}
// roomManageComponent.on
var room = Entity.Create<MapRoom>(self.Scene, true, true);
room.Owner = ownerId;
room.RoomId = roomId;
room.Code = RoomHelper.GenerateCode(self.Scene.SceneConfigId, roomId);
self.Add(room);
return room;
}
public static void Add(this RoomManageComponent self, MapRoom room)
{
self.Rooms[room.RoomId] = room;
@@ -46,10 +65,12 @@ public static class RoomManageComponentSystem
return true;
}
public static MapRoom? Get(this RoomManageComponent self, int roomId)
{
return self.Rooms.GetValueOrDefault(roomId);
}
#endregion
#region Id
@@ -81,6 +102,4 @@ public static class RoomManageComponentSystem
}
#endregion
}