Esempio n. 1
0
        public OptionsMenu()
        {
            _crosshair  = new MenuCursor();
            _background = new Background();

            _titles = new FontRender("Titles");
            _titles.LoadContent("titlescreen");
            _titles.Location = new Vector2(150, _fontY);
            _titles.Shadow   = true;


            _container = new UIContainer("OptionsMenu");

            int startYPosition = 600;

            _soundEffectsOnOff = new CheckBox("SoundEffectsOnOff", new SoundEffectsOnOffHandler())
            {
                Width            = 500,
                Height           = 70,
                Location         = new Vector2(700, startYPosition),
                Text             = "Sound Effects On/Off",
                DrawWindowChrome = true,
                ControlTexture   = "ButtonBackground"
            };

            ((CheckBox)_soundEffectsOnOff).Checked = SoundEffectPlayer.PlaySoundEffects;

            startYPosition += 80;

            _backToMainMenu = new Button("ExitToMainMenu", new ExitToMainMenuButtonHandler())
            {
                Width            = 500,
                Height           = 70,
                Location         = new Vector2(700, startYPosition),
                Text             = "<-- Exit to Main Menu",
                DrawWindowChrome = true,
                ControlTexture   = "ButtonBackground"
            };


            _container.AddControl(_soundEffectsOnOff);
            _container.AddControl(_backToMainMenu);

            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER1, _background);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER2, _titles);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER5, _crosshair);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER4, _container);
        }
Esempio n. 2
0
        public MainMenu()
        {
            _crosshair  = new MenuCursor();
            _background = new Background();

            MusicPlayer.LoadMusic("banjo");

            _fontY  = -200;
            _titles = new FontRender("Titles");
            _titles.LoadContent("titlescreen");
            _titles.Location = new Vector2(150, _fontY);
            _titles.Shadow   = true;


            _container = new UIContainer("MainMenu");

            int startYPosition = 450;

            _playGameButton = new Button("PlayGameButton", new NewGameButtonHandler())
            {
                Width            = 500,
                Height           = 70,
                Location         = new Vector2(700, startYPosition),
                Text             = "Play Duck Attack",
                DrawWindowChrome = true,
                ControlTexture   = "ButtonBackground"
            };

            startYPosition += 80;

            _optionsButton = new Button("OptionsGameButton", new OptionsButtonHandler())
            {
                Width            = 500,
                Height           = 70,
                Location         = new Vector2(700, startYPosition),
                Text             = "Options",
                DrawWindowChrome = true,
                ControlTexture   = "ButtonBackground"
            };

            startYPosition += 80;

            _exitButton = new Button("ExitGameButton", new ExitButtonHandler())
            {
                Width            = 500,
                Height           = 70,
                Location         = new Vector2(700, startYPosition),
                Text             = "Exit Game",
                DrawWindowChrome = true,
                ControlTexture   = "ButtonBackground"
            };

            _container.AddControl(_playGameButton);
            _container.AddControl(_optionsButton);
            _container.AddControl(_exitButton);

            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER1, _background);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER2, _titles);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER5, _crosshair);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER4, _container);

            MusicPlayer.Play("banjo");
            MusicPlayer.Looped = true;
        }