Exemple #1
0
        public MiInGameMenu(Micycle game, MicycleGameSystem system)
            : base(game, WIDTH, HEIGHT)
        {
            this.system = system;

            //
            // Resume Button
            //
            resumeButton = new MiButton();
            resumeButton.Pressed += new MiScript(
                delegate
                {
                    Game.ToUpdate.Pop();
                    Game.ToDraw.RemoveLast();
                    system.Enabled = true;
                    return null;
                });

            //
            // Quit Button
            //
            quitGameButton = new MiButton();
            quitGameButton.Pressed += new MiScript(
                delegate
                {
                    Game.Exit();
                    return null;
                });

            //
            // Go To Main Menu Button
            //
            goToMainMenuButton = new MiButton();
            goToMainMenuButton.Pressed += new MiScript(
                delegate
                {
                    Game.ToUpdate.Pop();

                    if (Game.ToUpdate.Peek() is MiBuildingMenu)
                    {
                        Game.ToUpdate.Pop();
                        Game.ToDraw.RemoveLast();
                    }

                    Game.ToUpdate.Pop();
                    Game.ToDraw.RemoveLast();
                    Game.ToDraw.RemoveLast();
                    Game.ToUpdate.Push(game.StartScreen);
                    Game.ToDraw.AddLast(game.StartScreen);
                    Game.ScriptEngine.ExecuteScript(game.StartScreen.EntrySequence);
                    return null;
                });
        }
Exemple #2
0
        public StartScreen(MiGame game)
            : base(game)
        {
            if (Instance == null)
            {
                background = new MiAnimatingComponent(game,0, 0, 1280, 800);
                cursor = new MiAnimatingComponent(game, 683, 328, 33, 35);

                //
                // New Game Button
                //
                newGameButton = new MiButton();
                newGameButton.Pressed +=
                    delegate
                    {
                        WorldScreen.Instance.Activate();
                        return null;
                    };
                newGameButtonBase = new MiAnimatingComponent(game, 733, 278, 502, 107);

                //
                // Quit Game Button
                //
                quitGameButton = new MiButton();
                quitGameButton.Pressed +=
                    delegate
                    {
                        Game.Exit();
                        return null;
                    };
                quitGameButtonBase = new MiAnimatingComponent(game, 750, 418, 488, 127, 0, 0, 0, 0);

                //
                // Default Active Button
                //
                ActiveButton = newGameButton;

                //
                // Reponses to Input
                //
                inputResponses[Controller.UP] = Upped;
                inputResponses[Controller.DOWN] = Downed;
                inputResponses[Controller.A] = Pressed;
            }
            else
            {
                throw new Exception("Start Screen Already Initialized");
            }
        }
Exemple #3
0
        public StartScreen(MiGame game)
            : base(game)
        {
            if (Instance == null)
            {
                background = new MiAnimatingComponent(game, 0, 0, 1280, 800);
                cursor     = new MiAnimatingComponent(game, 683, 328, 33, 35);

                //
                // New Game Button
                //
                newGameButton          = new MiButton();
                newGameButton.Pressed +=
                    delegate
                {
                    WorldScreen.Instance.Activate();
                    return(null);
                };
                newGameButtonBase = new MiAnimatingComponent(game, 733, 278, 502, 107);

                //
                // Quit Game Button
                //
                quitGameButton          = new MiButton();
                quitGameButton.Pressed +=
                    delegate
                {
                    Game.Exit();
                    return(null);
                };
                quitGameButtonBase = new MiAnimatingComponent(game, 750, 418, 488, 127, 0, 0, 0, 0);

                //
                // Default Active Button
                //
                ActiveButton = newGameButton;

                //
                // Reponses to Input
                //
                inputResponses[Controller.UP]   = Upped;
                inputResponses[Controller.DOWN] = Downed;
                inputResponses[Controller.A]    = Pressed;
            }
            else
            {
                throw new Exception("Start Screen Already Initialized");
            }
        }
Exemple #4
0
        public MiBuildingMenu(Micycle game, float center_x, float center_y, MicycleGameSystem system, MiInGameMenu inGameMenu)
            : base(game)
        {
            centerX = center_x;
            centerY = center_y;
            this.system = system;
            this.inGameMenu = inGameMenu;

            backgroundRectangle = new Rectangle((int)center_x, (int)center_y, BACKGROUND_RECTANGLE_WIDTH, BACKGROUND_RECTANGLE_HEIGHT);

            stat1TextPosition = new Vector2(center_x - BACKGROUND_RECTANGLE_WIDTH / 2 + LEFT_PADDING, center_y - BACKGROUND_RECTANGLE_HEIGHT / 2 + TOP_PADDING);
            stat2TextPosition = stat1TextPosition + new Vector2(0, TEXT_HEIGHT + BAR_THICKNESS);
            stat3TextPosition = stat2TextPosition + new Vector2(0, TEXT_HEIGHT + BAR_THICKNESS);
            stat1Bar = new Rectangle((int)stat1TextPosition.X, (int)stat1TextPosition.Y + TEXT_HEIGHT, BACKGROUND_RECTANGLE_WIDTH - LEFT_PADDING - RIGHT_PADDING, BAR_THICKNESS);
            stat2Bar = new Rectangle((int)stat2TextPosition.X, (int)stat2TextPosition.Y + TEXT_HEIGHT, stat1Bar.Width, stat1Bar.Height);
            stat3Bar = new Rectangle((int)stat3TextPosition.X, (int)stat3TextPosition.Y + TEXT_HEIGHT, stat2Bar.Width, stat2Bar.Height);

            cursor = new MiAnimatingComponent(game, CANCEL_BUTTON_X, CANCEL_BUTTON_Y, 0.5f, 0, 0, 0);
            upButtonGraphic = new MiAnimatingComponent(game, UP_BUTTON_X, UP_BUTTON_Y, UP_BUTTON_SCALE, 0, 0, 0);
            downButtonGraphic = new MiAnimatingComponent(game, DOWN_BUTTON_X, DOWN_BUTTON_Y, DOWN_BUTTON_SCALE, 0, 0, 0);
            leftButtonGraphic = new MiAnimatingComponent(game, LEFT_BUTTON_X, LEFT_BUTTON_Y, LEFT_BUTTON_SCALE, 0, 0, 0);
            rightButtonGraphic = new MiAnimatingComponent(game, RIGHT_BUTTON_X, RIGHT_BUTTON_Y, RIGHT_BUTTON_SCALE, 0, 0, 0);

            upButton = new MiButton();
            downButton = new MiButton();
            leftButton = new MiButton();
            rightButton = new MiButton();
            cancelButton = new MiButton();
            cancelButton.Pressed += new MiScript(
                delegate
                {
                    Game.ToUpdate.Pop();
                    Game.ToDraw.RemoveLast();
                    return null;
                });

            cursor.Visible = false;
            ActiveButton = cancelButton;
        }