Beispiel #1
0
        public GoalsMenu(Game game)
        {
            mOwnerGame = game;

            Sprite backgroundSprite = new Sprite("yellow");
            int height = (int)(GraphicsManager.Device.PresentationParameters.BackBufferHeight);
            int width = (int)(GraphicsManager.Device.PresentationParameters.BackBufferWidth);
            int y = 0;
            GraphicItem background = new GraphicItem(
                new Microsoft.Xna.Framework.Rectangle(
                    GraphicsManager.Device.PresentationParameters.BackBufferWidth / 2 - width / 2,
                    y,
                    width,
                    height
                ),
                backgroundSprite
            );

            Sprite buttonSprite = new Sprite("empty");
            height = (int)(GraphicsManager.Device.PresentationParameters.BackBufferHeight);
            width = (int)(GraphicsManager.Device.PresentationParameters.BackBufferWidth);
            y = 0;
            Button button = new Button(
                new Microsoft.Xna.Framework.Rectangle(
                    GraphicsManager.Device.PresentationParameters.BackBufferWidth / 2 - width / 2,
                    y,
                    width,
                    height
                ),
                buttonSprite,
                new Button.ButtonAction(Continue)
            );

            Sprite storySprite = new Sprite("goals");
            height = (int)(GraphicsManager.Device.PresentationParameters.BackBufferHeight);
            width = (int)((float)storySprite.Width / (float)storySprite.Height * (float)height);
            y = 0;
            GraphicItem goals = new GraphicItem(
                new Microsoft.Xna.Framework.Rectangle(
                    GraphicsManager.Device.PresentationParameters.BackBufferWidth / 2 - width / 2,
                    y,
                    width,
                    height
                ),
                storySprite
            );

            Add(background);
            Add(button);
            Add(goals);
        }
Beispiel #2
0
        public PlayerPartsMenu(Game game, PlayerCreature creature, int slot, GraphicItem menuSlot)
        {
            mOwnerGame = game;
            mPlayer = creature;
            mSlot = slot;
            mMenuSlot = menuSlot;

            Sprite backgroundSprite = new Sprite("red");
            int width = (int)(GraphicsManager.Device.PresentationParameters.BackBufferWidth);
            int height = (int)(GraphicsManager.Device.PresentationParameters.BackBufferHeight);
            int x = 0;
            int y = 0;
            GraphicItem background = new GraphicItem(
                new Microsoft.Xna.Framework.Rectangle(
                    GraphicsManager.Device.PresentationParameters.BackBufferWidth / 2 - width / 2,
                    y,
                    width,
                    height
                ),
                backgroundSprite
            );

            Add(background);

            y = (int)(GraphicsManager.Device.PresentationParameters.BackBufferHeight / 2);
            foreach (Type partType in creature.Info.Parts)
            {
                Type part = partType;
                string[] fullName = partType.ToString().Split('.');
                string name = fullName[fullName.Length - 1];
                Sprite sprite = new Sprite(name + "Icon");
                width = (int)(GraphicsManager.Device.PresentationParameters.BackBufferWidth) / 8;
                height = (int)(GraphicsManager.Device.PresentationParameters.BackBufferWidth / 8);
                x += (int)(GraphicsManager.Device.PresentationParameters.BackBufferWidth) / 8;
                Button button = new Button(
                new Microsoft.Xna.Framework.Rectangle(
                        x,
                        y,
                        width,
                        height
                    ),
                    sprite,
                    new Button.ButtonAction((Button b) => CreatePart(part, b))
                );
                Add(button);

                //Console.WriteLine(name);
            }
        }
Beispiel #3
0
        public PauseState(Game ownerGame)
        {
            mOwnerGame = ownerGame;
            InputAction.IsMouseLocked = false;
            /*
            int width = Game1.Graphics.PreferredBackBufferWidth;
            int height = Game1.Graphics.PreferredBackBufferHeight;
            int buttonHeight = (int)(0.1f * height);
            int buttonWidth = (int)(2 * buttonHeight);
            */

            Sprite pausedSprite = new Sprite("paused");
            int height = (int)(GraphicsManager.Device.PresentationParameters.BackBufferHeight * .25);
            int width = (int)((float)pausedSprite.Width / (float)pausedSprite.Height * (float)height);
            int y = (int)(GraphicsManager.Device.PresentationParameters.BackBufferHeight * .1);
            GraphicItem paused = new GraphicItem(
                new Microsoft.Xna.Framework.Rectangle(
                    GraphicsManager.Device.PresentationParameters.BackBufferWidth / 2 - width / 2,
                    y,
                    width,
                    height
                ),
                pausedSprite
            );

            Sprite resumeSprite = new Sprite("resume");
            height = (int)(GraphicsManager.Device.PresentationParameters.BackBufferHeight * .12);
            width = (int)((float)resumeSprite.Width / (float)resumeSprite.Height * (float)height);
            y = (int)(GraphicsManager.Device.PresentationParameters.BackBufferHeight * .32);
            Button resume = new Button(
                new Microsoft.Xna.Framework.Rectangle(
                    GraphicsManager.Device.PresentationParameters.BackBufferWidth / 2 - width / 2,
                    y + height,
                    width,
                    height
                ),
                resumeSprite,
                new Button.ButtonAction(Resume)
            );

            Sprite checkpointSprite = new Sprite("checkpoint");
            height = (int)(GraphicsManager.Device.PresentationParameters.BackBufferHeight * .15);
            width = (int)((float)checkpointSprite.Width / (float)checkpointSprite.Height * (float)height);
            y = (int)(GraphicsManager.Device.PresentationParameters.BackBufferHeight * .47);
            Button checkpoint = new Button(
                new Microsoft.Xna.Framework.Rectangle(
                    GraphicsManager.Device.PresentationParameters.BackBufferWidth / 2 - width / 2,
                    y + height,
                    width,
                    height
                ),
                checkpointSprite,
                new Button.ButtonAction(Checkpoint)
            );

            Sprite quitSprite = new Sprite("quit");
            height = (int)(GraphicsManager.Device.PresentationParameters.BackBufferHeight * .14);
            width = (int)((float)quitSprite.Width / (float)quitSprite.Height * (float)height);
            y = (int)(GraphicsManager.Device.PresentationParameters.BackBufferHeight * .64);
            Button quit = new Button(
                new Microsoft.Xna.Framework.Rectangle(
                    GraphicsManager.Device.PresentationParameters.BackBufferWidth / 2 - width / 2,
                    y + height,
                    width,
                    height
                ),
                quitSprite,
                new Button.ButtonAction(Menu)
            );

            Add(paused);
            Add(resume);
            Add(checkpoint);
            Add(quit);

            /*
            Add(
                new Button(
                    new Rectangle(width / 2 - buttonWidth / 2, height / 2 - buttonHeight, buttonWidth, buttonHeight),
                    new Sprite("blueButton"),
                    new Button.ButtonAction(Resume)
                )
            );
            Add(
                new Button(
                    new Rectangle(width / 2 - buttonWidth / 2, height / 2, buttonWidth, buttonHeight),
                    new Sprite("yellowButton"),
                    new Button.ButtonAction(Menu)
                )
            );
            Add(
                new Button(
                    new Rectangle(width / 2 - buttonWidth / 2, height / 2 + buttonHeight, buttonWidth, buttonHeight),
                    new Sprite("redButton"),
                    new Button.ButtonAction(Quit)
                )
            );
             */
        }
Beispiel #4
0
        public PlayerSlotMenu(Game game, PlayerCreature creature)
        {
            InputAction.IsMouseLocked = false;

            mOwnerGame = game;
            mPlayer = creature;

            Sprite backgroundSprite = new Sprite("blue");
            int width = (int)(GraphicsManager.Device.PresentationParameters.BackBufferWidth);
            int height = (int)(GraphicsManager.Device.PresentationParameters.BackBufferHeight);
            int x = 0;
            int y = 0;
            GraphicItem background = new GraphicItem(
                new Microsoft.Xna.Framework.Rectangle(
                    GraphicsManager.Device.PresentationParameters.BackBufferWidth / 2 - width / 2,
                    y,
                    width,
                    height
                ),
                backgroundSprite
            );
            Add(background);

            x = 0;
            y = (int)(GraphicsManager.Device.PresentationParameters.BackBufferHeight / 2);

            width = (int)(GraphicsManager.Device.PresentationParameters.BackBufferWidth) / 8;
            height = (int)(GraphicsManager.Device.PresentationParameters.BackBufferWidth) / 8;

            x += (int)(GraphicsManager.Device.PresentationParameters.BackBufferWidth) / 6;
            Sprite redSprite = new Sprite("redButton");
            Button redButton = new Button(
            new Microsoft.Xna.Framework.Rectangle(
                    x,
                    y,
                    width,
                    height
                ),
                redSprite,
                new Button.ButtonAction((Button b) => CreatePart(0, b))
            );
            Add(redButton);

            if (mPlayer.PartAttachments[0] != null)
            {
                Sprite slot0Sprite = mPlayer.PartAttachments[0].Part.Icon;
                mSlots[0] = new GraphicItem(
                    new Microsoft.Xna.Framework.Rectangle(
                        x,
                        y,
                        width,
                        height
                    ),
                    slot0Sprite
                );
                Add(mSlots[0]);
            }

            x += (int)(GraphicsManager.Device.PresentationParameters.BackBufferWidth) / 6;
            Sprite blueSprite = new Sprite("blueButton");
            Button blueButton = new Button(
            new Microsoft.Xna.Framework.Rectangle(
                    x,
                    y,
                    width,
                    height
                ),
                blueSprite,
                new Button.ButtonAction((Button b) => CreatePart(1, b))
            );
            Add(blueButton);

            if (mPlayer.PartAttachments[1] != null)
            {
                Sprite slot1Sprite = mPlayer.PartAttachments[1].Part.Icon;
                mSlots[1] = new GraphicItem(
                    new Microsoft.Xna.Framework.Rectangle(
                        x,
                        y,
                        width,
                        height
                    ),
                    slot1Sprite
                );
                Add(mSlots[1]);
            }

            x += (int)(GraphicsManager.Device.PresentationParameters.BackBufferWidth) / 6;
            Sprite yellowSprite = new Sprite("yellowButton");
            Button yellowButton = new Button(
            new Microsoft.Xna.Framework.Rectangle(
                    x,
                    y,
                    width,
                    height
                ),
                yellowSprite,
                new Button.ButtonAction((Button b) => CreatePart(2, b))
            );
            Add(yellowButton);

            if (mPlayer.PartAttachments[2] != null)
            {
                Sprite slot2Sprite = mPlayer.PartAttachments[2].Part.Icon;
                mSlots[2] = new GraphicItem(
                    new Microsoft.Xna.Framework.Rectangle(
                        x,
                        y,
                        width,
                        height
                    ),
                    slot2Sprite
                );
                Add(mSlots[2]);
            }

            Sprite doneSprite = new Sprite("check");
            x += (int)(GraphicsManager.Device.PresentationParameters.BackBufferWidth) / 6;
            Button exitButton = new Button(
            new Microsoft.Xna.Framework.Rectangle(
                    x,
                    y,
                    width,
                    height
                ),
                doneSprite,
                new Button.ButtonAction(Done)
            );
            Add(exitButton);
        }