Beispiel #1
0
        public override void InitScreen(ScreenType screnType)
        {
            base.InitScreen(screnType);

            _gameSong = GameContent.GameAssets.Music[ScreenMusic.Level1];
            StateManager.Options.MusicStateChanged += new EventHandler(Options_MusicStateChanged);
            StateManager.ScreenStateChanged        += new EventHandler(delegate(object src, EventArgs arg)
            {
                if (Visible)
                {
                    if (StateManager.Options.MusicEnabled)
                    {
                        if (MediaPlayer.State == MediaState.Paused)
                        {
                            MediaPlayer.Resume();
                        }
                        else
                        {
                            MediaPlayer.Play(_gameSong);
                        }
                    }
                    else
                    {
                        MediaPlayer.Stop();
                    }
                }
            });
            Texture2D  planetTexture    = GameContent.GameAssets.Images.NonPlayingObjects.Planet;
            Texture2D  altPlanetTexture = GameContent.GameAssets.Images.NonPlayingObjects.AltPlanet;
            Texture2D  buttonImage      = GameContent.GameAssets.Images.Controls.Button;
            SpriteFont SegoeUIMono      = GameContent.GameAssets.Fonts.NormalText;

            StateManager.Options.ScreenResolutionChanged += new EventHandler(Options_ScreenResolutionChanged);

            this.BackgroundSprite = HorizontalMenuBGSprite.CurrentBG;

            TitleSprite = new Sprite(GameContent.GameAssets.Images.Controls.Title, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .05f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .07f), Sprites.SpriteBatch);
            Sprites.Add(TitleSprite);

            planet          = new Sprite(altPlanetTexture, Vector2.Zero, Sprites.SpriteBatch);
            planet.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.6f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .1515f);
            planet.Scale    = new Vector2(.7f);
            Sprites.Add(planet);

            planettwo          = new Sprite(planetTexture, Vector2.Zero, Sprites.SpriteBatch);
            planettwo.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.8f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .75f);
            planettwo.Scale    = new Vector2(1f);
            Sprites.Add(planettwo);


            SinglePlayerButton = new Sprite(buttonImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .06f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .21f), Sprites.SpriteBatch);

            Sprites.Add(SinglePlayerButton);

            SinglePlayerLabel               = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Singleplayer");
            SinglePlayerLabel.IsHoverable   = true;
            SinglePlayerLabel.NonHoverColor = Color.White;
            SinglePlayerLabel.HoverColor    = Color.MediumAquamarine;

            SinglePlayerLabel.ParentSprite = SinglePlayerButton;

            AdditionalSprites.Add(SinglePlayerLabel);


            MultiPlayerButton = new Sprite(buttonImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .06f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .405f), Sprites.SpriteBatch);

            Sprites.Add(MultiPlayerButton);

            MultiPlayerLabel               = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Multiplayer");
            MultiPlayerLabel.IsHoverable   = true;
            MultiPlayerLabel.NonHoverColor = Color.White;
            MultiPlayerLabel.HoverColor    = Color.MediumAquamarine;
            MultiPlayerLabel.ParentSprite  = MultiPlayerButton;
            AdditionalSprites.Add(MultiPlayerLabel);


            BackButton = new Sprite(buttonImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .06f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .60f), Sprites.SpriteBatch);

            Sprites.Add(BackButton);

            BackLabel               = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Exit");
            BackLabel.IsHoverable   = true;
            BackLabel.ParentSprite  = BackButton;
            BackLabel.NonHoverColor = Color.White;
            BackLabel.HoverColor    = Color.MediumAquamarine;
            AdditionalSprites.Add(BackLabel);


            OptionsButton = new Sprite(buttonImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .362f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .21f), Sprites.SpriteBatch);

            Sprites.Add(OptionsButton);

            OptionsLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Options");
            OptionsLabel.ParentSprite  = OptionsButton;
            OptionsLabel.IsHoverable   = true;
            OptionsLabel.NonHoverColor = Color.White;
            OptionsLabel.HoverColor    = Color.MediumAquamarine;
            AdditionalSprites.Add(OptionsLabel);


            CreditsButton = new Sprite(buttonImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .362f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .405f), Sprites.SpriteBatch);

            Sprites.Add(CreditsButton);


            CreditsLabel               = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Credits");
            CreditsLabel.IsHoverable   = true;
            CreditsLabel.ParentSprite  = CreditsButton;
            CreditsLabel.NonHoverColor = Color.White;
            CreditsLabel.HoverColor    = Color.MediumAquamarine;
            AdditionalSprites.Add(CreditsLabel);
#if XBOX
            AllButtons = new GamePadButtonEnumerator(new TextSprite[, ] {
                { SinglePlayerLabel, OptionsLabel }, { MultiPlayerLabel, CreditsLabel }, { BackLabel, null }
            }, InputType.LeftJoystick);
            AllButtons.ButtonPress      += new EventHandler(AllButtons_ButtonPress);
            SinglePlayerLabel.IsSelected = true;
#elif WINDOWS
            BackLabel.Clicked += new EventHandler(delegate(object src, EventArgs e) { if (elapsedButtonDelay > totalButtonDelay)
                                                                                      {
                                                                                          StateManager.Exit();
                                                                                      }
                                                  });
            CreditsLabel.Clicked += new EventHandler(delegate(object src, EventArgs e) { if (elapsedButtonDelay > totalButtonDelay)
                                                                                         {
                                                                                             StateManager.ScreenState = ScreenType.Credits;
                                                                                         }
                                                     });
            OptionsLabel.Clicked += new EventHandler(delegate(object src, EventArgs e) { if (elapsedButtonDelay > totalButtonDelay)
                                                                                         {
                                                                                             StateManager.ScreenState = ScreenType.Options;
                                                                                         }
                                                     });
            SinglePlayerLabel.Clicked += new EventHandler(delegate(object src, EventArgs e) { if (elapsedButtonDelay > totalButtonDelay)
                                                                                              {
                                                                                                  StateManager.ScreenState = ScreenType.ShipSelect;
                                                                                              }
                                                          });
#endif
        }
Beispiel #2
0
        public override void InitScreen(ScreenType screenType)
        {
            base.InitScreen(screenType);

            //Add background to this screen
            this.BackgroundSprite = HorizontalMenuBGSprite.CurrentBG;

            Texture2D  button = GameContent.GameAssets.Images.Controls.Button;
            SpriteFont font   = GameContent.GameAssets.Fonts.NormalText;

            StateManager.Options.ScreenResolutionChanged += new EventHandler(Options_ScreenResolutionChanged);

            //Move Controls (aka Controls)
            ControlButton = new Sprite(button, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .06f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .1f), Sprites.SpriteBatch);

#if WINDOWS
            ControlButton.MouseEnter += new EventHandler(ControlButton_MouseEnter);
            ControlButton.MouseLeave += new EventHandler(ControlButton_MouseLeave);
#endif
            ControlLabel                      = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, font, ("Controls"));
            ControlLabel.Position             = new Vector2(ControlButton.Position.X + (ControlButton.Width / 2 - ControlLabel.Width / 2), ControlButton.Position.Y + (ControlButton.Height / 2 - ControlLabel.Height / 2));
            ControlLabel.Color                = Color.White;
            ControlLabel.IsManuallySelectable = true;
            ControlLabel.IsHoverable          = true;
            ControlLabel.HoverColor           = Color.MediumAquamarine;
            ControlLabel.NonHoverColor        = Color.White;



            //GFX
            Sprite GraphicsButton = new Sprite(button, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .06f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .35f), Sprites.SpriteBatch);
#if WINDOWS
            GraphicsButton.MouseEnter += new EventHandler(GraphicsButton_MouseEnter);
            GraphicsButton.MouseLeave += new EventHandler(GraphicsButton_MouseLeave);
#endif

            GFXLabel                      = new TextSprite(Sprites.SpriteBatch, font, String.Format("GFX: {0}", StateManager.GraphicsManager.IsFullScreen ? "Full" : "Standard"));
            GFXLabel.Position             = new Vector2((GraphicsButton.X + GraphicsButton.Width / 2) - GFXLabel.Width / 2, (GraphicsButton.Y + GraphicsButton.Height / 2) - GFXLabel.Height / 2);
            GFXLabel.Color                = Color.White;
            GFXLabel.IsManuallySelectable = true;
            GFXLabel.IsHoverable          = true;
            GFXLabel.HoverColor           = Color.MediumAquamarine;
            GFXLabel.NonHoverColor        = Color.White;


            //SFX
            Sprite SFXButton = new Sprite(button, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .5f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .10f), Sprites.SpriteBatch);

#if WINDOWS
            SFXButton.MouseEnter += new EventHandler(SFXButton_MouseEnter);
            SFXButton.MouseLeave += new EventHandler(SFXButton_MouseLeave);
#endif
            SFXLabel                      = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, font, "SFX: " + (StateManager.Options.SFXEnabled ? "On" : "Off"));
            SFXLabel.Position             = new Vector2((SFXButton.X + SFXButton.Width / 2) - SFXLabel.Width / 2, (SFXButton.Y + SFXButton.Height / 2) - SFXLabel.Height / 2);
            SFXLabel.Color                = Color.White;
            SFXLabel.IsHoverable          = true;
            SFXLabel.IsManuallySelectable = true;
            SFXLabel.HoverColor           = Color.MediumAquamarine;
            SFXLabel.NonHoverColor        = Color.White;


            //Back button
            Sprite BackButton = new Sprite(button, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .06f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .60f), Sprites.SpriteBatch);
            BackLabel       = new TextSprite(Sprites.SpriteBatch, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .139f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .62f), GameContent.GameAssets.Fonts.NormalText, "Back");
            BackLabel.Color = Color.White;

#if WINDOWS
            BackButton.MouseEnter += new EventHandler(BackButton_MouseEnter);
            BackButton.MouseLeave += new EventHandler(BackButton_MouseLeave);
#endif

            //Music (volume; currently on/off)

            Sprite MusicButton = new Sprite(button, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .5f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .35f), Sprites.SpriteBatch);
            MusicButton.Color = Color.White;

#if WINDOWS
            MusicButton.MouseEnter += new EventHandler(MusicButton_MouseEnter);
            MusicButton.MouseLeave += new EventHandler(MusicButton_MouseLeave);
#endif

            MusicVolumeLabel                      = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, font, "Music: " + (StateManager.Options.MusicEnabled ? "On" : "Off"));
            MusicVolumeLabel.Position             = new Vector2((MusicButton.X + MusicButton.Width / 2) - MusicVolumeLabel.Width / 2, (MusicButton.Y + MusicButton.Height / 2) - MusicVolumeLabel.Height / 2);
            MusicVolumeLabel.Color                = Color.White;
            MusicVolumeLabel.IsHoverable          = true;
            MusicVolumeLabel.IsManuallySelectable = true;
            MusicVolumeLabel.HoverColor           = Color.MediumAquamarine;
            MusicVolumeLabel.NonHoverColor        = Color.White;


            //Add all buttons
            Sprites.Add(ControlButton);
            Sprites.Add(GraphicsButton);
            Sprites.Add(SFXButton);
            Sprites.Add(BackButton);
            Sprites.Add(MusicButton);

            //Add all text sprites
            AdditionalSprites.Add(ControlLabel);
            AdditionalSprites.Add(GFXLabel);
            AdditionalSprites.Add(SFXLabel);
            AdditionalSprites.Add(BackLabel);
            AdditionalSprites.Add(MusicVolumeLabel);

#if XBOX
            AllButtons = new GamePadButtonEnumerator(new TextSprite[, ] {
                { ControlLabel, SFXLabel }, { GFXLabel, MusicVolumeLabel }, { BackLabel, null }
            }, InputType.LeftJoystick);
            AllButtons.ButtonPress += new EventHandler(AllButtons_ButtonPress);
            ControlLabel.IsSelected = true;
#endif

            StateManager.Options.ScreenResolutionChanged += new EventHandler(Options_ScreenResolutionChanged);
        }
Beispiel #3
0
        public override void InitScreen(ScreenType screenName)
        {
            base.InitScreen(screenName);

            Viewport viewPort = Sprites.SpriteBatch.GraphicsDevice.Viewport;

            this.BackgroundSprite = HorizontalMenuBGSprite.CurrentBG;

            Texture2D  planetTexture    = GameContent.GameAssets.Images.NonPlayingObjects.Planet;
            Texture2D  buttonTexture    = GameContent.GameAssets.Images.Controls.Button;
            SpriteFont SegoeUIMono      = GameContent.GameAssets.Fonts.NormalText;
            Texture2D  altPlanetTexture = GameContent.GameAssets.Images.NonPlayingObjects.AltPlanet;

            planet          = new Sprite(planetTexture, Vector2.Zero, Sprites.SpriteBatch);
            planet.Scale    = new Vector2(.7f);
            planet.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.1f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .16f);
            Sprites.Add(planet);

            planettwo          = new Sprite(altPlanetTexture, Vector2.Zero, Sprites.SpriteBatch);
            planettwo.Scale    = new Vector2(1f);
            planettwo.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.8f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .75f);
            Sprites.Add(planettwo);

            //title image
            TitleImage          = new Sprite(GameContent.GameAssets.Images.Controls.Title, Vector2.Zero, Sprites.SpriteBatch);
            TitleImage.Position = new Vector2(viewPort.Width / 2 - TitleImage.Texture.Width / 2, viewPort.Height * 0.2f);
            Sprites.Add(TitleImage);

            PlayButton = new Sprite(buttonTexture, new Vector2(viewPort.Width * 0.375f, viewPort.Height * 0.4f), Sprites.SpriteBatch);
            Sprites.Add(PlayButton);

            PlayLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Play");

            PlayLabel.IsHoverable = true;


            PlayLabel.NonHoverColor = Color.White;
            PlayLabel.HoverColor    = Color.MediumAquamarine;
            AdditionalSprites.Add(PlayLabel);


            ExitButton = new Sprite(buttonTexture, new Vector2(PlayButton.X, PlayButton.Y + (PlayButton.Height * 1.6f)), Sprites.SpriteBatch);

            Sprites.Add(ExitButton);

            ExitLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Exit");

            ExitLabel.IsHoverable = true;

            ExitLabel.NonHoverColor = Color.White;
            ExitLabel.HoverColor    = Color.MediumAquamarine;
            AdditionalSprites.Add(ExitLabel);
            ExitLabel.ParentSprite = ExitButton;
            PlayLabel.ParentSprite = PlayButton;

#if WINDOWS
            ExitLabel.Clicked += new EventHandler(ExitLabel_Clicked);
            PlayLabel.Clicked += new EventHandler(PlayLabel_Clicked);
#elif XBOX
            ButtonManagement = new GamePadButtonEnumerator(new TextSprite[, ] {
                { PlayLabel }, { ExitLabel }
            }, InputType.LeftJoystick);
            ButtonManagement.ButtonPress += new EventHandler(ButtonManagement_ButtonPress);
#endif
        }