Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
        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);
            }
        }
Beispiel #3
0
        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 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);
            }
        }