Example #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Exit the simulation if there is no layout path.
            if (ServiceLocator.Get <ConfigLoader>().GetConfig().LayoutPath == null)
            {
                Environment.Exit(0);
            }

            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            // Create new information window
            _informationWindow = new InformationWindow();

            // Make a new hotel.
            _hotel = new Hotel();

            // Register components to the roomfactory
            _hotel.HotelBuilder.RoomFactory.RegisterComponent("Room", new GuestRoomFactoryComponent());
            _hotel.HotelBuilder.RoomFactory.RegisterComponent("Empty", new EmptyRoomFactoryComponent());
            _hotel.HotelBuilder.RoomFactory.RegisterComponent("Lobby", new LobbyFactoryComponent());
            _hotel.HotelBuilder.RoomFactory.RegisterComponent("Cinema", new CinemaFactoryComponent());
            _hotel.HotelBuilder.RoomFactory.RegisterComponent("Restaurant", new CafeFactoryComponent());
            _hotel.HotelBuilder.RoomFactory.RegisterComponent("ElevatorShaft", new ElevatorShaftFactoryComponent());
            _hotel.HotelBuilder.RoomFactory.RegisterComponent("Staircase", new StaircaseFactoryComponent());
            _hotel.HotelBuilder.RoomFactory.RegisterComponent("Fitness", new FitnessFactoryComponent());
            _hotel.HotelBuilder.RoomFactory.RegisterComponent("Pool", new PoolFactoryComponent());

            _hotel.BuildHotel();

            // Create other things.
            _camera             = new Camera(GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight);
            _camera.Controlable = true;
            _closeUpCamera      = new Camera(200, 200);

            // Create the handlers and managers and start throwing events.
            HotelEventManager.Start();
            HotelEventHandler hotelEventHandler = new HotelEventHandler(_hotel);

            _listener = new EventListener(hotelEventHandler);
            HotelEventManager.Register(_listener);

            // Create a background.
            _background = new Sprite();
            _background.LoadSprite("Background");
            _background.SetPosition(new Point(0, 0));
            _background.SetSize(new Point(GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight));
        }
Example #2
0
 /*
  * private static StreamWriter _writer = new StreamWriter("Events");
  */
 public EventListener(HotelEventHandler hotelEventManager)
 {
     _hotelEventManager = hotelEventManager;
 }