12345678910111213141516171819202122232425262728 |
- using System.Linq;
- namespace ET.Server;
- [FriendOf(typeof(GameRoomComponent))]
- public static class GameRoomComponentSystem
- {
- public static void Add(this GameRoomComponent self, Room room)
- {
- self.idRooms.Add(room.RoomId, room);
- }
- public static Room Get(this GameRoomComponent self, int roomId)
- {
- self.idRooms.TryGetValue(roomId, out Room room);
- return room;
- }
- public static void Remove(this GameRoomComponent self, int roomId)
- {
- self.idRooms.Remove(roomId);
- }
- public static Room[] GetAll(this GameRoomComponent self)
- {
- return self.idRooms.Values.ToArray();
- }
- }
|