public Room Create(RoomCreationOptions options, P2PGroup p2pGroup) { using (_sync.Lock()) { uint id = 1; while (true) { if (!_rooms.ContainsKey(id)) { break; } id++; } var room = new Room(this, id, options, p2pGroup, options.Creator); _rooms.TryAdd(id, room); RoomDto roomDto = new RoomDto(); roomDto.RoomId = (byte)room.Id; roomDto.PlayerCount = (byte)room.Players.Count; roomDto.PlayerLimit = room.Options.PlayerLimit; roomDto.State = (byte)room.GameRuleManager.GameRule.StateMachine.State; roomDto.State2 = (byte)room.GameRuleManager.GameRule.StateMachine.State; roomDto.GameRule = (int)room.Options.GameRule; roomDto.Map = (byte)room.Options.MapID; roomDto.WeaponLimit = room.Options.ItemLimit; roomDto.Name = room.Options.Name; roomDto.Password = room.Options.Password; roomDto.FMBURNMode = room.GetFMBurnModeInfo(); Channel.Broadcast(new RoomDeployAck2Message(roomDto)); return(room); } }
public Room(RoomManager roomManager, uint id, P2PGroup group) { _roomManager = roomManager; Id = id; Group = group; _players = new ConcurrentDictionary <ulong, Player>(); }
public Room Create(RoomCreationOptions options, P2PGroup p2pGroup) { using (_sync.Lock()) { uint id = 1; while (true) { if (!_rooms.ContainsKey(id)) { break; } id++; } var room = new Room(this, id, options, p2pGroup, options.Creator); _rooms.TryAdd(id, room); var roomDto = room.GetRoomInfo(); roomDto.Password = !string.IsNullOrWhiteSpace(room.Options.Password) || !string.IsNullOrEmpty(room.Options.Password) ? "nice try :)" : ""; Channel.Broadcast(new RoomDeployAckMessage(roomDto)); return(room); } }
public Room Create_2(RoomCreationOptions options, P2PGroup p2pGroup) { try { uint id = 1; while (true) { if (!_rooms.ContainsKey(id)) { break; } id++; } var room = new Room(this, id, options, p2pGroup, options.Creator); var roomDto = room.GetRoomInfo(); roomDto.Password = !string.IsNullOrWhiteSpace(room.Options.Password) || !string.IsNullOrEmpty(room.Options.Password) ? "nice try :)" : ""; Channel.Broadcast(new RoomDeployAck2Message(roomDto)); return(room); } catch (Exception ex) { throw new Exception(ex.ToString()); } }
public Room(RoomManager roomManager, uint id, RoomCreationOptions options, P2PGroup 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); }
public Room(RoomManager roomManager, uint id, RoomCreationOptions options, P2PGroup group, Player creator) { RoomManager = roomManager; Id = id; Options = options; TimeCreated = DateTime.Now; TeamManager = new TeamManager(this); GameRuleManager = new GameRuleManager(this); VoteKickMgr = new VoteKickManager(this); Group = group; Creator = creator; Master = creator; TeamManager.TeamChanged += TeamManager_TeamChanged; GameRuleManager.GameRuleChanged += GameRuleManager_OnGameRuleChanged; GameRuleManager.MapInfo = GameServer.Instance.ResourceCache.GetMaps()[options.MapId]; GameRuleManager.GameRule = RoomManager.GameRuleFactory.Get(Options.GameRule, this); }
public Room Create(RoomCreationOptions options, P2PGroup 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); } }