角色控制和房间进入推送
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user