public Room(RoomManager roomManager, uint id, RoomCreationOptions options, ServerP2PGroup group) { RoomManager = roomManager; Id = id; Options = options; TimeCreated = DateTime.Now; TeamManager = new TeamManager(this); GameRuleManager = new GameRuleManager(this); Group = group; TeamManager.TeamChanged += TeamManager_TeamChanged; GameRuleManager.GameRuleChanged += GameRuleManager_OnGameRuleChanged; GameRuleManager.MapInfo = GameServer.Instance.ResourceCache.GetMaps()[options.MatchKey.Map]; GameRuleManager.GameRule = RoomManager.GameRuleFactory.Get(Options.MatchKey.GameRule, this); Group.Join(2, false); }
public Room Create(RoomCreationOptions options, ServerP2PGroup p2pGroup) { using (_sync.Lock()) { uint id = 1; while (true) { if (!_rooms.ContainsKey(id)) { break; } id++; } var room = new Room(this, id, options, p2pGroup); _rooms.TryAdd(id, room); Channel.Broadcast(new SDeployGameRoomAckMessage(room.Map <Room, RoomDto>())); return(room); } }