예제 #1
0
        /// <summary>
        /// Draws the menu.
        /// </summary>
        public override void DrawContent(GameTime gameTime, SpriteBatch spriteBatch)
        {
            GraphicsDevice graphics = ScreenManager.GraphicsDevice;
            SpriteFont     font     = ScreenManager.Font;
            Viewport       viewport = ScreenManager.GraphicsDevice.Viewport;
            string         gameOver = message;

            Vector2 gameOverPos = new Vector2(viewport.Width / 2 - GetWidth(gameOver) / 2, viewport.Height / 3);

            spriteBatch.DrawString(font, gameOver, gameOverPos, Color.Red * TransitionAlpha, 0, vector00, 1f, SpriteEffects.None, 0);

            string  pointsLine = "Final score: " + points;
            Vector2 pointsPos  = new Vector2(viewport.Width / 2 - GetWidth(pointsLine) / 2, gameOverPos.Y + GetHeight());

            spriteBatch.DrawString(font, pointsLine, pointsPos, Color.Gold, 0, vector00, 1f, SpriteEffects.None, 0);



            UpdateMenuEntryLocations((int)pointsPos.Y + 2 * GetHeight());

            // Draw each menu entry in turn.
            for (int i = 0; i < MenuEntries.Count; i++)
            {
                MenuEntry menuEntry = MenuEntries[i];

                bool isSelected = IsActive && (i == selectedEntry);

                menuEntry.Draw(this, isSelected, gameTime);
            }
        }
        public override void DrawContent(GameTime gameTime, SpriteBatch spriteBatch)
        {
            UpdateMenuEntryLocations();

            // Draw each menu entry in turn.
            for (int i = 0; i < menuEntries.Count; i++)
            {
                MenuEntry menuEntry = menuEntries[i];

                bool isSelected = IsActive && (i == selectedEntry);

                menuEntry.Draw(this, isSelected, gameTime);
            }
        }
        /// <summary>
        /// Draws the menu.
        /// </summary>
        public override void DrawContent(GameTime gameTime, SpriteBatch spriteBatch)
        {
            GraphicsDevice graphics = ScreenManager.GraphicsDevice;
            SpriteFont     font     = ScreenManager.Font;

            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;

            //lesson rectangle
            int x      = titleRectangle.X;
            int y      = titleRectangle.Y + titleRectangle.Height + screenOffset;
            int width  = titleRectangle.Width;
            int height = viewport.Height - y - 3 * GetHeight() - screenOffset;

            Rectangle lessonRectangle = new Rectangle(x, y, width, height);

            spriteBatch.Draw(Costam.redFolder, lessonRectangle, new Color(TransitionAlpha, TransitionAlpha, TransitionAlpha));

            Vector2 titlePos = new Vector2(viewport.Width / 2 - GetWidth(title) / 2, lessonRectangle.Y);

            spriteBatch.DrawString(font, title, titlePos, Color.Gold * TransitionAlpha, 0, vector00, 1f, SpriteEffects.None, 0);

            x = lessonRectangle.X + screenOffset;
            y = (int)titlePos.Y + GetHeight() + screenOffset;

            switch (lesson)
            {
            case 1:
                DrawCentered(spriteBatch, "Welcome to the first lesson!", y);
                y += GetHeight();
                DrawCentered(spriteBatch, "You will learn how to move in vein.", y);
                y += GetHeight();
                DrawCentered(spriteBatch, "Try to move around and earn 150 points.", y);
                y += GetHeight();
                DrawCentered(spriteBatch, "You can find instructions in the main menu.", y);


                break;

            case 2:
                DrawCentered(spriteBatch, "This is second lesson so far!", y);
                y += GetHeight();
                DrawCentered(spriteBatch, "Now you will meet Red Blood Cell.", y);
                y += GetHeight();
                DrawCentered(spriteBatch, "Try to collide with that cell.", y);
                y += GetHeight();
                DrawCentered(spriteBatch, "You will lose one life.", y);
                y += GetHeight();
                DrawCentered(spriteBatch, "Why ? Because that cells are our friends !", y);
                y += GetHeight();
                DrawCentered(spriteBatch, "Then collect 150 coins.", y);
                break;

            case 3:
                DrawCentered(spriteBatch, "Third lesson. Be careful!", y);
                y += GetHeight();
                DrawCentered(spriteBatch, "Time for your first enemy.", y);
                y += GetHeight();
                DrawCentered(spriteBatch, "The virus take your life same as blood cell.", y);
                y += GetHeight();
                DrawCentered(spriteBatch, "But you can destroy them with ALT attack.", y);
                y += GetHeight();
                DrawCentered(spriteBatch, "Kill 10 viruses to win.", y);


                break;
            }

            // Draw each menu entry in turn.

            UpdateMenuEntryLocations(lessonRectangle.Y + lessonRectangle.Height + GetHeight());

            for (int i = 0; i < MenuEntries.Count; i++)
            {
                MenuEntry menuEntry = MenuEntries[i];

                bool isSelected = IsActive && (i == selectedEntry);

                menuEntry.Draw(this, isSelected, gameTime);
            }
        }
        /// <summary>
        /// Draws the menu.
        /// </summary>
        public override void DrawContent(GameTime gameTime, SpriteBatch spriteBatch)
        {
            GraphicsDevice graphics = ScreenManager.GraphicsDevice;
            SpriteFont     font     = ScreenManager.Font;

            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;

            Color lineColor            = Color.Gold * TransitionAlpha;
            Color titleLineColor       = Color.Red * TransitionAlpha;
            Color transitionAlphaColor = new Color(TransitionAlpha, TransitionAlpha, TransitionAlpha);

            string rex = "Piotr Leniartek         Mateusz Nowak";
            //string mats = "Mateusz Nowak";
            string pucio = "Paulina Lecka         Paulina Misztal";
            //string paula = "Paulina Misztal";
            string artur = "Artur Staszczyk";

            string team    = "Team";
            string mentor  = "Mentor";
            string credits = "Thanks to";

            int x = viewport.Width / 2 - GetWidth(team) / 2;
            int y = titleRectangle.Y + titleRectangle.Height;

            Vector2 position = new Vector2(x, y);

            spriteBatch.DrawString(font, team, position, titleLineColor, 0, vector00, 1f, SpriteEffects.None, 0);

            x = viewport.Width / 2 - GetWidth(rex) / 2;
            y = (int)position.Y + GetHeight();

            position = new Vector2(x, y);
            spriteBatch.DrawString(font, rex, position, lineColor, 0, vector00, 1f, SpriteEffects.None, 0);

            //x = viewport.Width / 2;
            //y = (int)position.Y + GetHeight();

            //position = new Vector2(x, y);
            //spriteBatch.DrawString(font, mats, position, lineColor, 0, vector00, 1f, SpriteEffects.None, 0);

            x = viewport.Width / 2 - GetWidth(pucio) / 2;
            y = (int)position.Y + GetHeight();

            position = new Vector2(x, y);
            spriteBatch.DrawString(font, pucio, position, lineColor, 0, vector00, 1f, SpriteEffects.None, 0);

            //x = viewport.Width / 2;
            //y = (int)position.Y + GetHeight();

            //position = new Vector2(x, y);
            //spriteBatch.DrawString(font, paula, position, lineColor, 0, vector00, 1f, SpriteEffects.None, 0);

            x = viewport.Width / 2 - GetWidth(mentor) / 2;
            y = (int)position.Y + GetHeight();

            position = new Vector2(x, y);
            spriteBatch.DrawString(font, mentor, position, titleLineColor, 0, vector00, 1f, SpriteEffects.None, 0);

            x = viewport.Width / 2 - GetWidth(artur) / 2;
            y = (int)position.Y + GetHeight();

            position = new Vector2(x, y);
            spriteBatch.DrawString(font, artur, position, lineColor, 0, vector00, 1f, SpriteEffects.None, 0);

            x = viewport.Width / 2 - GetWidth(credits) / 2;
            y = (int)position.Y + GetHeight();

            position = new Vector2(x, y);
            spriteBatch.DrawString(font, credits, position, titleLineColor, 0, vector00, 1f, SpriteEffects.None, 0);

            string xnabuttons = "Jeff Jenkins for XNA Button Pack at sinnix.net";

            x = viewport.Width / 2 - GetWidth(xnabuttons) / 2;
            y = (int)position.Y + GetHeight();

            position = new Vector2(x, y);
            spriteBatch.DrawString(font, xnabuttons, position, lineColor, 0, vector00, 1f, SpriteEffects.None, 0);

            string freesound = "freesound.org for nice sound effect's";

            x = viewport.Width / 2 - GetWidth(freesound) / 2;
            y = (int)position.Y + GetHeight();

            position = new Vector2(x, y);
            spriteBatch.DrawString(font, freesound, position, lineColor, 0, vector00, 1f, SpriteEffects.None, 0);

            string music = "DST from nosoapradio.us for great music";

            x = viewport.Width / 2 - GetWidth(music) / 2;
            y = (int)position.Y + GetHeight();

            position = new Vector2(x, y);
            spriteBatch.DrawString(font, music, position, lineColor, 0, vector00, 1f, SpriteEffects.None, 0);

            string turbosquid = "turbosquid.com for perfect models";

            x = viewport.Width / 2 - GetWidth(turbosquid) / 2;
            y = (int)position.Y + GetHeight();

            position = new Vector2(x, y);
            spriteBatch.DrawString(font, turbosquid, position, lineColor, 0, vector00, 1f, SpriteEffects.None, 0);



            // Draw each menu entry in turn.

            UpdateMenuEntryLocations((int)position.Y + 2 * GetHeight());

            for (int i = 0; i < MenuEntries.Count; i++)
            {
                MenuEntry menuEntry = MenuEntries[i];

                bool isSelected = IsActive && (i == selectedEntry);

                menuEntry.Draw(this, isSelected, gameTime);
            }
        }
        /// <summary>
        /// Draws the menu.
        /// </summary>
        public override void DrawContent(GameTime gameTime, SpriteBatch spriteBatch)
        {
            GraphicsDevice graphics = ScreenManager.GraphicsDevice;

            SpriteFont font = ScreenManager.Font;

            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;


            //objects rectangle
            int x      = titleRectangle.X;
            int y      = titleRectangle.Y + titleRectangle.Height + screenOffset;
            int width  = titleRectangle.Width;
            int height = (3 * ((4 * viewport.Height) / 5)) / 7 - screenOffset;

            Rectangle objectsRectangle = new Rectangle(x, y, width, height);

            spriteBatch.Draw(Costam.redFolder, objectsRectangle, new Color(TransitionAlpha, TransitionAlpha, TransitionAlpha));


            //controls rectangle's

            //keyboard rectangle
            x      = titleRectangle.X;
            y      = objectsRectangle.Y + objectsRectangle.Height + screenOffset;
            width  = titleRectangle.Width / 2 - screenOffset / 2;
            height = objectsRectangle.Height;

            Rectangle keyboardRectangle = new Rectangle(x, y, width, height);

            spriteBatch.Draw(Costam.redFolder, keyboardRectangle, new Color(TransitionAlpha, TransitionAlpha, TransitionAlpha));

            //controller rectangle
            x      = keyboardRectangle.X + keyboardRectangle.Width + screenOffset;
            y      = keyboardRectangle.Y;
            width  = keyboardRectangle.Width;
            height = keyboardRectangle.Height;

            Rectangle controlerRectangle = new Rectangle(x, y, width, height);

            spriteBatch.Draw(Costam.redFolder, controlerRectangle, new Color(TransitionAlpha, TransitionAlpha, TransitionAlpha));


            //OBJECTS
            int objectsOffset = 30;

            width  = (objectsRectangle.Width - 6 * objectsOffset) / 5;
            height = objectsRectangle.Height - (2 * objectsOffset) - (2 * GetHeight());


            //bloodcell

            x = objectsRectangle.X + objectsOffset;
            y = objectsRectangle.Y + objectsRectangle.Height - objectsOffset - height - GetHeight();

            Rectangle bloodCellRectangle = new Rectangle(x, y, width, height);

            spriteBatch.Draw(Costam.bloodCell2D, bloodCellRectangle, new Color(TransitionAlpha, TransitionAlpha, TransitionAlpha));

            drawUpDownRectangle(spriteBatch, "AVOID", "Blood Cell", bloodCellRectangle);

            //virus

            x = bloodCellRectangle.X + bloodCellRectangle.Width + objectsOffset;
            y = bloodCellRectangle.Y;

            Rectangle virusRectangle = new Rectangle(x, y, width, height);

            spriteBatch.Draw(Costam.virus2D, virusRectangle, new Color(TransitionAlpha, TransitionAlpha, TransitionAlpha));

            drawUpDownRectangle(spriteBatch, "DESTROY", "Virus", virusRectangle);

            //gold diamond

            x = virusRectangle.X + virusRectangle.Width + objectsOffset;
            y = virusRectangle.Y;

            Rectangle goldDiamondRectangle = new Rectangle(x, y, width, height);

            spriteBatch.Draw(Costam.goldDiamond2D, goldDiamondRectangle, new Color(TransitionAlpha, TransitionAlpha, TransitionAlpha));

            drawUpDownRectangle(spriteBatch, "", "Gold", goldDiamondRectangle);

            //blue diamond

            x = goldDiamondRectangle.X + goldDiamondRectangle.Width + objectsOffset;
            y = goldDiamondRectangle.Y;

            Rectangle blueDiamondRectangle = new Rectangle(x, y, width, height);

            spriteBatch.Draw(Costam.blueDiamond2D, blueDiamondRectangle, new Color(TransitionAlpha, TransitionAlpha, TransitionAlpha));

            drawUpDownRectangle(spriteBatch, "COLLECT DIAMONDS", "Red", blueDiamondRectangle);

            //green diamond

            x = blueDiamondRectangle.X + blueDiamondRectangle.Width + objectsOffset;
            y = blueDiamondRectangle.Y;

            Rectangle greenDiamondRectangle = new Rectangle(x, y, width, height);

            spriteBatch.Draw(Costam.greemDiamond2D, greenDiamondRectangle, new Color(TransitionAlpha, TransitionAlpha, TransitionAlpha));

            drawUpDownRectangle(spriteBatch, "", "Green", greenDiamondRectangle);


            //controls
            //keyboard

            string keyboard = "Keyboard";

            x = keyboardRectangle.X + keyboardRectangle.Width / 2 - GetWidth(keyboard) / 2;
            y = keyboardRectangle.Y;

            spriteBatch.DrawString(font, keyboard, new Vector2(x, y), Color.Gold * TransitionAlpha, 0, vector00, 1f, SpriteEffects.None, 0);

            x = keyboardRectangle.X + objectsOffset;
            y = keyboardRectangle.Y + keyboardRectangle.Height / 4;

            width  = keyboardRectangle.Width / 2 - 2 * objectsOffset;
            height = keyboardRectangle.Height / 2;

            Rectangle arrowsRectangle = new Rectangle(x, y, width, height);

            spriteBatch.Draw(Costam.ARROWS, arrowsRectangle, new Color(TransitionAlpha, TransitionAlpha, TransitionAlpha));

            drawUpDownRectangle(spriteBatch, "", "Move", arrowsRectangle);

            width  = arrowsRectangle.Width / 2;
            height = arrowsRectangle.Height / 2;

            x = keyboardRectangle.X + keyboardRectangle.Width - objectsOffset - width;
            y = arrowsRectangle.Y + arrowsRectangle.Height / 4;

            Rectangle attackRectangle = new Rectangle(x, y, width, height);

            spriteBatch.Draw(Costam.SPACE_ALT, attackRectangle, new Color(TransitionAlpha, TransitionAlpha, TransitionAlpha));

            string attack = "Attack";

            drawUpDownRectangle(spriteBatch, "", attack, attackRectangle);

            //controller
            string controller = "Controller";

            x = controlerRectangle.X + controlerRectangle.Width / 2 - GetWidth(controller) / 2;
            y = controlerRectangle.Y;

            spriteBatch.DrawString(font, controller, new Vector2(x, y), Color.Gold * TransitionAlpha, 0, vector00, 1f, SpriteEffects.None, 0);

            x = controlerRectangle.X + objectsOffset;
            y = controlerRectangle.Y + controlerRectangle.Height / 4;

            width  = controlerRectangle.Width / 2 - 2 * objectsOffset;
            height = controlerRectangle.Height / 2;

            Rectangle dpadRectangle = new Rectangle(x, y, width, height);

            spriteBatch.Draw(Costam.DPAD_LR, dpadRectangle, new Color(TransitionAlpha, TransitionAlpha, TransitionAlpha));

            drawUpDownRectangle(spriteBatch, "", "Move", dpadRectangle);

            width  = arrowsRectangle.Width / 2;
            height = arrowsRectangle.Height / 2;

            x = controlerRectangle.X + controlerRectangle.Width - objectsOffset - width;
            y = dpadRectangle.Y + dpadRectangle.Height / 4;

            Rectangle aAttackRectangle = new Rectangle(x, y, width, height);

            spriteBatch.Draw(Costam.A, aAttackRectangle, new Color(TransitionAlpha, TransitionAlpha, TransitionAlpha));

            drawUpDownRectangle(spriteBatch, "", attack, aAttackRectangle);



            //x = jumpRectangle.X;
            //y = jumpRectangle.Y + jumpRectangle.Height;

            //width = jumpRectangle.Width;
            //height = jumpRectangle.Height;

            //Rectangle attackRectangle = new Rectangle(x, y, width, height);

            //spriteBatch.Draw(Costam.B, attackRectangle, new Color(TransitionAlpha, TransitionAlpha, TransitionAlpha));

            //x = attackRectangle.X + attackRectangle.Width;
            //y = attackRectangle.Y + attackRectangle.Height / 2 - GetHeight() / 2;

            //spriteBatch.DrawString(font, attack, new Vector2(x, y), Color.Gold * TransitionAlpha, 0, vector00, 1f, SpriteEffects.None, 0);

            // Draw each menu entry in turn.

            UpdateMenuEntryLocations(controlerRectangle.Y + controlerRectangle.Height + screenOffset);

            for (int i = 0; i < MenuEntries.Count; i++)
            {
                MenuEntry menuEntry = MenuEntries[i];

                bool isSelected = IsActive && (i == selectedEntry);

                menuEntry.Draw(this, isSelected, gameTime);
            }
        }