Ejemplo n.º 1
0
        public override void Draw(GameTime gameTime)
        {
            UpdateMenuEntryLocations();
            GraphicsDevice graphics    = SManager.GraphicsDevice;
            SpriteBatch    spriteBatch = SManager.SpriteBatch;
            SpriteFont     font        = SManager.Font;

            spriteBatch.Begin();

            spriteBatch.Draw(rect, new Rectangle(124, 65, 400, 200), Color.White);

            for (int i = 0; i < menuEntries.Count; i++)
            {
                menuItem menuItem   = menuEntries[i];
                bool     isSelected = active && (i == selected);
                menuItem.Draw(this, isSelected, gameTime);
            }

            float offset = (float)Math.Pow(transPos, 2);

            Vector2 tPosition = new Vector2(graphics.Viewport.Width / 2, 100);
            Vector2 tCenter   = font.MeasureString(menuTitle) / 2;
            Color   tColor    = new Color();

            tColor = new Color(0, 0, 0) * transAlpha;
            float titleScale = 1.25f;

            tPosition.Y -= offset * 100;

            spriteBatch.DrawString(font, menuTitle, tPosition, tColor, 0, tCenter, titleScale, SpriteEffects.None, 0);

            spriteBatch.End();
        }
Ejemplo n.º 2
0
        public PauseMenu() : base("Paused")
        {
            menuItem resume = new menuItem("Resume Game");
            menuItem quit   = new menuItem("Quit Game");

            resume.chosen += OnCancel;
            quit.chosen   += quitSelected;

            MenuEntries.Add(resume);
            MenuEntries.Add(quit);
        }
Ejemplo n.º 3
0
        public Loss2() : base("You died!")
        {
            menuItem i1 = new menuItem("Retry (from Level 2)");
            menuItem i2 = new menuItem("Tunnel out! (to the Main Menu)");

            i1.chosen += toLevel2;
            i2.chosen += exit;

            MenuEntries.Add(i1);
            MenuEntries.Add(i2);
        }
Ejemplo n.º 4
0
        public Victory1() : base("You win! But then...")
        {
            menuItem i1 = new menuItem("Proceed to Level 2");
            menuItem i2 = new menuItem("Flee! (to the Main Menu)");

            i1.chosen += toLevel2;
            i2.chosen += exit;

            MenuEntries.Add(i1);
            MenuEntries.Add(i2);
        }
Ejemplo n.º 5
0
        public Victory2(int s) : base("You actually won! Wow!")
        {
            int thisScore = s;

            menuItem i1 = new menuItem("Your score: " + thisScore);
            menuItem i2 = new menuItem("Leave! (to the Main Menu)");

            i2.chosen += exit;

            MenuEntries.Add(i1);
            MenuEntries.Add(i2);
        }
Ejemplo n.º 6
0
        public MainMenu() : base("Main Menu")
        {
            menuItem playL1        = new menuItem("Play Level 1");
            menuItem playL2        = new menuItem("Play Level 2");
            menuItem exitMenuEntry = new menuItem("Exit");

            playL1.chosen        += PlayL1Selected;
            playL2.chosen        += PlayL2Selected;
            exitMenuEntry.chosen += Exit;

            MenuEntries.Add(playL1);
            MenuEntries.Add(playL2);
            MenuEntries.Add(exitMenuEntry);
        }
Ejemplo n.º 7
0
        protected virtual void UpdateMenuEntryLocations()
        {
            float   offset   = (float)Math.Pow(transPos, 2);
            Vector2 position = new Vector2(0f, 175f);

            for (int i = 0; i < menuEntries.Count; i++)
            {
                menuItem menuEntry = menuEntries[i];
                position.X = SManager.GraphicsDevice.Viewport.Width / 2 - menuEntry.getWidth(this) / 2;

                if (state == screenState.On)
                {
                    position.X -= offset * 256;
                }
                else
                {
                    position.X += offset * 512;
                }

                menuEntry.Position = position;

                position.Y += menuEntry.getHeight(this);
            }
        }