Exemple #1
0
        public PauseMenu(IManageSprites spriteService, IManageStates stateService)
            : base(spriteService, stateService)
        {
            ChangeMenuState("Main");

            continueButton = new ContinueButton(new Vector2(
                ((int)spriteService.GameWindowSize.X / 2 - 90),
                ((int)spriteService.GameWindowSize.Y / 2 - 37)), this);
            spriteService.LoadDrawable(continueButton);
        }
Exemple #2
0
        public MainMenu(IManageSprites spriteService, IManageStates stateService)
            : base(spriteService, stateService)
        {
            //man starter hovedmenyen i denne tilstanden
            ChangeMenuState("Main");

            //opprett Spill-knappen
            playButton = new PlayButton(new Vector2(
                ((int)spriteService.GameWindowSize.X / 2 - 90),
                ((int)spriteService.GameWindowSize.Y / 2 - 37)), this);
            spriteService.LoadDrawable(playButton);
        }
Exemple #3
0
 public static void Configure(bool isDev)
 {
     if (isDev)
     {
         Products = new MockProductsRepo();
         States   = new MockStatesRepo();
         Orders   = new MockOrderRepo();
     }
     else
     {
         Products = new ProductsRepo();
         States   = new StatesRepo();
         Orders   = new OrdersRepo();
     }
 }
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            //initialiserer komponenter
            _stateService = (IManageStates)Game.Services.GetService(typeof(IManageStates));
            _inputService = (IManageInput)Game.Services.GetService(typeof(IManageInput));

            //oppretter hovedmenyen
            _mainMenu = new MainMenu((IManageSprites)Game.Services.GetService(typeof(IManageSprites)), _stateService);
            _mainMenu.MainState();
            ToDrawMainMenu = _mainMenu.toDrawMenuClass;

            //oppretter pausemenyen
            _pauseMenu = new PauseMenu((IManageSprites)Game.Services.GetService(typeof(IManageSprites)), _stateService);
            _pauseMenu.MainState();
            ToDrawPauseMenu = _pauseMenu.toDrawMenuClass;

            base.Initialize();
        }
Exemple #5
0
 public Menu(IManageSprites spriteService, IManageStates stateService)
 {
     this._spriteService = spriteService;
     this.stateService = stateService;
 }
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            //laster inn komponenter
            _spriteService = (IManageSprites)Game.Services.GetService(typeof(IManageSprites));
            _stateService = (IManageStates)Game.Services.GetService(typeof(IManageStates));
            _collisionService = (IManageCollision)Game.Services.GetService(typeof(IManageCollision));
            _inputService = (IManageInput)Game.Services.GetService(typeof(IManageInput));
            _audioService = (IManageAudio)Game.Services.GetService(typeof(IManageAudio));

            //oppretter musikkkontrollerne
            _spriteService.LoadDrawable(new StaticSprite("musicOptions"));
            _spriteService.LoadDrawable(new StaticSprite("soundOptions"));
            musicToggle = new musicToggleButton("musicOptions", new Rectangle((int)_spriteService.GameWindowSize.X - 40, 0, 40, 40), new Rectangle(0, 0, 40, 40), Game);
            soundToggle = new SoundToggleButton("soundOptions", new Rectangle((int)_spriteService.GameWindowSize.X - 80, 0, 40, 40), new Rectangle(0, 0, 40, 40), Game);
            _persistentInGameUI.Add(musicToggle);
            _persistentInGameUI.Add(soundToggle);

            //oppretter Random
            rand = new Random();

            //oppretter spilleren
            _player1 = new Player(new Rectangle(100, 100, 150, 330), 0.5f, Game);
            _spriteService.LoadDrawable(_player1);

            //oppretter spillbanene
            _chooseDirectionlevel = new ChooseDirectionLevel(_player1, Game);
            _fightingLevel = new FightingLevel(_player1, Game);
            _miningLevel = new MiningLevel(_player1, Game);
            _townLevel = new TownLevel(_player1, Game);

            //Selve spillet starter på denne banen
            ChangeInGameState("ChooseDirectionLevel", 100, 450);

            base.Initialize();
        }