Exemple #1
0
        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());
            }
        }
Exemple #2
0
        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);
            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);
        }