Пример #1
0
        public IActionResult GetRoomsForHotel(int hotelId, [FromQuery] RoomParameters roomParameters)
        {
            // this method retrieves all rooms for a specific hotel in order to show the rooms of a single hotel
            var rooms = _roomRepository.GetRoomsForHotel(hotelId, roomParameters);

            return(Ok(rooms));
        }
Пример #2
0
        public int GetRoomsCount([FromQuery] RoomParameters roomParameters)
        {
            // this method retrieves the count of all rooms in order to support pagination
            var roomCount = _roomRepository.GetAllRoomsCount(roomParameters);

            return(roomCount);
        }
        public async Task <string> GetRoomParametersAsync(string _roomId, bool _isInitiator, string _turnBaseUrl =
                                                          "https://global.xirsys.net/_turn/DemoWebRTC")
        {
            if (_isInitiator)
            {
                var addClientResponse = AddClientToRoom(Context.ConnectionId, _roomId, true);
                if (addClientResponse.Item1)
                {
                    var _turnClient    = new TURNClient(_turnBaseUrl, "Onotseike:37aac6f4-cf3d-11ea-9990-0242ac150003");
                    var roomParameters = new RoomParameters
                    {
                        RoomId           = addClientResponse.Item2,
                        ClientId         = Context.ConnectionId,
                        RoomUrl          = "",
                        IsInitiator      = true,
                        MediaConstraints = new MediaConstraints {
                            Audio = true, Video = true
                        },
                        IceServerUrl = _turnBaseUrl,
                        IsLoopBack   = false
                    };

                    var _iceServers = await _turnClient.RequestServersAsync();

                    roomParameters.IceServers = _iceServers;
                    //roomParameters.OfferSdp = new SessionDescription(SessionDescription.GetSdpTypeFromString("offer"), "offer");
                    var response = JObject.FromObject(roomParameters).ToString();
                    return(response);
                }
            }
            else
            {
                //TODO: Receive or Join A call
                var addClientResponse = AddClientToRoom(Context.ConnectionId, _roomId, false);
                if (addClientResponse.Item1)
                {
                    var _turnClient    = new TURNClient(_turnBaseUrl, "Onotseike:37aac6f4-cf3d-11ea-9990-0242ac150003");
                    var roomParameters = new RoomParameters
                    {
                        RoomId           = addClientResponse.Item2,
                        ClientId         = Context.ConnectionId,
                        RoomUrl          = "",
                        IsInitiator      = false,
                        MediaConstraints = new MediaConstraints {
                            Audio = true, Video = true
                        },
                        IceServerUrl = _turnBaseUrl,
                        IsLoopBack   = false
                    };

                    var _iceServers = await _turnClient.RequestServersAsync();

                    roomParameters.IceServers = _iceServers;
                    roomParameters.OfferSdp   = addClientResponse.Item4.SessionDescriptionOffer;
                    return(JObject.FromObject(roomParameters).ToString());
                }
            }

            return(null);
        }
Пример #4
0
    public override RoomParameters GetNextParameters(RoomHistory history, System.Random random)
    {
        if (!_currentRoom.MoveNext())
        {
            _currentRoom = DemoRoomProgression.GetEnumerator();
            _currentRoom.MoveNext();
        }

        var output = new RoomParameters();

        output.GroundEnemies = GroundEnemies;
        output.AirEnemies    = AirEnemies;
        output.Class         = RoomClass.Platforming;
        output.Layout        = _currentRoom.Current;
        output.Theme         = typeof(RoomTheme).GetEnumValues() //Absolutely disgusting, but it's for testing so it's ok
                               .Cast <RoomTheme>()
                               .Where(i => i != RoomTheme.Edit)
                               .OrderBy(i => random.Next())
                               .First();

        //output.Effect = RoomEffects.Timer;
        output.FlipHorizontal   = random.Next(2) == 0;
        output.WeaponEnumerator = WeaponTemplates.OrderBy(i => random.Next()).GetEnumerator();
        output.Entrance         = output.Layout.GetRandomEntrance(random);

        do
        {
            output.Exit = output.Layout.GetRandomExit(random, EntranceExitSides.None);
        } while (output.Entrance == output.Exit && output.Layout.EntranceSides != output.Layout.ExitSides);

        return(output);
    }
Пример #5
0
 /// <summary>
 /// Crear diccionario con las posiciones y parametros sin iniciar
 /// </summary>
 private void InitDictionaryRooms()
 {
     foreach (var startPosRoom in startingPositions)
     {
         RoomParameters currentRoomParam = new RoomParameters(EnumTypeRoom.none, false);
         ListRoomsCreated.Add(startPosRoom.position, currentRoomParam);
     }
 }
Пример #6
0
        public IActionResult GetAllRooms([FromQuery] RoomParameters roomParameters)
        {
            // this method retrieves all rooms in the database in order to present them in a list of rooms
            // and supports pagination, filtering and sorting
            var rooms = _roomRepository.GetAllRooms(roomParameters);

            return(Ok(rooms));
        }
        public async Task <IActionResult> GetRooms([FromQuery] RoomParameters roomParameters)
        {
            var rooms = await _repository.Room.GetAllRoomsAsync(roomParameters, trackChanges : false);

            var roomsDto = _mapper.Map <IEnumerable <RoomDto> >(rooms);

            return(Ok(roomsDto));
        }
Пример #8
0
    /// <summary>
    /// Runs when a new room is generated
    /// </summary>
    public void OnRoomStart(RoomParameters room)
    {
        RoomEffects fx = room.Effect;

        LowGravity(fx.HasFlag(RoomEffects.LowGravity));
        Darkness(fx.HasFlag(RoomEffects.Darkness));
        LargeEnemies(fx.HasFlag(RoomEffects.LargeEnemies));
        Timer(fx.HasFlag(RoomEffects.Timer), room);
    }
Пример #9
0
    private void Start()
    {
        //Hide segment unless it's the first one
        if (ChainStep != 0)
        {
            gameObject.SetActive(false);
        }

        _room = Commons.RoomGenerator.CurrentRoomConfig;
    }
Пример #10
0
        public IEnumerable <Room> GetRoomsForHotel(int hotelId, RoomParameters roomParameters)
        {
            var rooms = _hotelAppContext.Set <Room>().AsQueryable();

            rooms = FilterRooms(ref rooms, roomParameters);
            rooms = rooms.Where(r => r.HotelId == hotelId);
            rooms = _sort.ApplySort(rooms, roomParameters.OrderBy);
            return(PagedList <Room> .ToPagedList(rooms,
                                                 roomParameters.PageNumber,
                                                 roomParameters.PageSize));
        }
Пример #11
0
        public IEnumerable <Room> GetAllRooms(RoomParameters roomParameters)
        {
            var rooms = _hotelAppContext.Set <Room>().AsQueryable();

            rooms = FilterRooms(ref rooms, roomParameters);
            rooms = _sort.ApplySort(rooms, roomParameters.OrderBy);

            return(PagedList <Room> .ToPagedList(rooms,
                                                 roomParameters.PageNumber,
                                                 roomParameters.PageSize));
        }
Пример #12
0
 public Setup()
 {
     map              = new Map();
     generalGenes     = new GeneralGenes();
     builders         = new Builders();
     roomParameters   = new RoomParameters();
     crawlerGenes     = new CrawlerGenes();
     tunnelerGenes    = new TunnelerGenes();
     randCrawlerGenes = new RandCrawlerGenes();
     //  mobsAndTreasure = new MobsAndTreasure();
     miscellaneous = new Miscellaneous();
 }
Пример #13
0
        public Room CreateRoom(RoomParameters roomParams)
        {
            return(Operation(() =>
            {
                CheckIsUserAuthenticated();

                var room = serverManager.CreateRoom(LoggedUser, roomParams);

                NotifyUsersOfRoomChange(room, RoomUpdate.Created);

                return room;
            }));
        }
Пример #14
0
        private IQueryable <Room> FilterRooms(ref IQueryable <Room> rooms, RoomParameters roomParameters)
        {
            if (roomParameters.City.HasValue)
            {
                rooms = _hotelAppContext.Hotels.Where(h => h.CityId == GetCityById((int)roomParameters.City).Id)
                        .SelectMany(r => r.Rooms);
            }

            if (roomParameters.NumberOfBeds > 0)
            {
                rooms = rooms.Where(r => r.NumberOfBeds == roomParameters.NumberOfBeds);
            }

            return(rooms);
        }
        public override RoomRushData GetRushData()
        {
            if (!RandomEventMods.shouldAlwaysSucceed)
            {
                return(base.GetRushData());
            }

            RoomRushData   data = new RoomRushData();
            RoomParameters room = MonoSingleton <GameParameters> .Instance.Room;

            data.DisasterTier   = Mathf.CeilToInt(((float)base.GetRushTimerRemainingTime().Time) / room.RushTimerIncreasePerRush);
            data.DisasterChance = 0;
            data.ExpMod         = this.m_bonusExpBase + (data.DisasterTier * room.RushExpModPerTier);
            data.ResMod         = this.m_bonusResourcesBase + (data.DisasterTier * room.RushResourceModPerTier);
            return(data);
        }
Пример #16
0
        public Room CreateRoom(User creator, RoomParameters roomParams)
        {
            if (ActiveRooms.Any(pair => pair.Value.Data.Name == roomParams.RoomName))
            {
                throw new Exception("Room with the same name already exists");
            }

            var roomId   = ActiveRooms.IsEmpty ? 1 : ActiveRooms.Last().Key + 1;
            var roomData = new RoomData {
                Id       = roomId, Name = roomParams.RoomName, MaxPlayersCount = roomParams.MaxPlayersCount,
                Password = roomParams.Password
            };

            var room = new Room(creator, roomData, roomParams.Password);

            ActiveRooms.TryAdd(roomId, room);

            return(room);
        }
Пример #17
0
        public int GetAllRoomsCount(RoomParameters roomParameters)
        {
            var rooms = _hotelAppContext.Set <Room>().AsQueryable();

            if (roomParameters.HotelId.HasValue)
            {
                roomParameters.PageSize = _hotelAppContext.Rooms.Where(x => x.HotelId == roomParameters.HotelId)
                                          .Count();
                rooms = _hotelAppContext.Rooms.Where(x => x.HotelId == roomParameters.HotelId);
            }
            else
            {
                roomParameters.PageSize = _hotelAppContext.Rooms.Count();
            }
            rooms = FilterRooms(ref rooms, roomParameters);
            rooms = _sort.ApplySort(rooms, roomParameters.OrderBy);

            return(rooms.Count());
        }
Пример #18
0
    /// <summary>
    /// Sets the timer effect
    /// </summary>
    private void Timer(bool enabled, RoomParameters room)
    {
        //The timer effect must NOT be combined with speedrun mode
        if (Commons.SpeedRunMode)
        {
            return;
        }

        //Set the timer based on the current room's counter
        if (enabled)
        {
            Commons.CountdownTimer.ResetCountdown(room.Layout.TimerEffectSeconds * 2f);
        }

        //Hide the timer if no timer effect is present
        else
        {
            Commons.CountdownTimer.StopCountdown();
            Commons.CountdownTimer.HideTimer();
        }
    }
 public async Task <IEnumerable <Room> > GetAllRoomsAsync(RoomParameters roomParameters, bool trackChanges) =>
 await FindAll(trackChanges)
 .OrderBy(r => r.Number)
 .Skip((roomParameters.PageNumber - 1) * roomParameters.PageSize)
 .Take(roomParameters.PageSize)
 .ToListAsync();
Пример #20
0
 public DungeonParameters()
 {
     RoomParameters = new RoomParameters();
 }
Пример #21
0
 // Start is called before the first frame update
 void Start()
 {
     SoundManager = GameObject.Find("SoundManager").GetComponent <AudioManager>();
     Player       = GameObject.Find("Player").GetComponent <PlayerMovement>();
     Room         = GetComponentInParent <RoomParameters>();
 }