Beispiel #1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Micycle game = new Micycle())
     {
         game.Run();
     }
 }
Beispiel #2
0
 public MiFactoryMenu(Micycle game, float center_x, float center_y, MicycleGameSystem system, MiInGameMenu inGameMenu)
     : base(game, center_x, center_y, system, inGameMenu)
 {
     miceWorkersOverCapactiyBar = Stat1Bar;
     robotWorkersOverCapacityBar = Stat1Bar;
     workerWageBar = Stat2Bar;
 }
Beispiel #3
0
 public MiSchoolMenu(Micycle game, float center_x, float center_y, MicycleGameSystem system, MiInGameMenu inGameMenu)
     : base(game, center_x, center_y, system, inGameMenu)
 {
     educationBudgetBar = Stat1Bar;
     teacherStudentRatioBar = Stat2Bar;
     studentsOverCapacityBar = Stat3Bar;
 }
Beispiel #4
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;
                });
        }
Beispiel #5
0
        public MiDialogScreen(Micycle game, int width, int height)
            : base(game)
        {
            //
            // Panel
            //

            /**
            panelUpperLeftCorner = new MiAnimatingComponent(game, MiResolution.Center.X - width / 2, MiResolution.Center.Y - height / 2, PANEL_SCALE, 0, PANEL_CORNER_ORIGIN, PANEL_CORNER_ORIGIN);
            panelUpperRightCorner = new MiAnimatingComponent(game, MiResolution.Center.X + width / 2, MiResolution.Center.Y - height / 2, PANEL_SCALE, (float)Math.PI*3/2, PANEL_CORNER_ORIGIN, PANEL_CORNER_ORIGIN);
            panelLowerLeftCorner = new MiAnimatingComponent(game, MiResolution.Center.X - width / 2, MiResolution.Center.Y + height / 2, PANEL_SCALE, (float)Math.PI/2, PANEL_CORNER_ORIGIN, PANEL_CORNER_ORIGIN);
            panelLowerRightCorner = new MiAnimatingComponent(game, MiResolution.Center.X + width / 2, MiResolution.Center.Y + height / 2, PANEL_SCALE, 0, PANEL_CORNER_ORIGIN, PANEL_CORNER_ORIGIN);

            panelLeftSide = new MiAnimatingComponent[(int)Math.Ceiling((height - PANEL_CORNER_SIZE * PANEL_SCALE)/(PANEL_SIDE_SIZE * PANEL_SCALE))];
            for (int i = 0; i < panelLeftSide.Length; i++)
                panelLeftSide[i] = new MiAnimatingComponent(game, MiResolution.Center.X - width / 2 + 1, MiResolution.Center.Y - height / 2 + PANEL_CORNER_ORIGIN * PANEL_SCALE + i * PANEL_SIDE_SIZE * PANEL_SCALE, PANEL_SCALE, 0, PANEL_CORNER_ORIGIN, PANEL_SIDE_HALFSIZE);

            panelRightSide = new MiAnimatingComponent[(int)Math.Ceiling((height - PANEL_CORNER_SIZE * PANEL_SCALE) / (PANEL_SIDE_SIZE * PANEL_SCALE))];
            for (int i = 0; i < panelLeftSide.Length; i++)
                panelRightSide[i] = new MiAnimatingComponent(game, MiResolution.Center.X + width / 2 - 1, MiResolution.Center.Y - height / 2 + PANEL_CORNER_ORIGIN * PANEL_SCALE + i * PANEL_SIDE_SIZE * PANEL_SCALE, PANEL_SCALE, (float)Math.PI, PANEL_CORNER_ORIGIN, PANEL_SIDE_HALFSIZE);
             */
            panelUpperLeftRect = new Rectangle((int)(MiResolution.Center.X - width / 2), (int)(MiResolution.Center.Y - height / 2), CORNER_SIZE, CORNER_SIZE);
            panelUpperRightRect = new Rectangle((int)(MiResolution.Center.X + width / 2), (int)(MiResolution.Center.Y - height / 2), CORNER_SIZE, CORNER_SIZE);
            panelLowerLeftRect = new Rectangle((int)(MiResolution.Center.X - width / 2), (int)(MiResolution.Center.Y + height / 2), CORNER_SIZE, CORNER_SIZE);
            panelLowerRightRect = new Rectangle((int)(MiResolution.Center.X + width / 2), (int)(MiResolution.Center.Y + height / 2), CORNER_SIZE, CORNER_SIZE);
            panelLeftSideRect = new List<Rectangle>();
            for (int i = 0; i <= Math.Ceiling((float)(height - CORNER_SIZE) / SIDE_SIZE); i++)
                panelLeftSideRect.Add(new Rectangle((int)(MiResolution.Center.X - width / 2), (int)(MiResolution.Center.Y - height / 2) + i * SIDE_SIZE + CORNER_SIZE / 2, CORNER_SIZE, SIDE_SIZE));
            panelRightSideRect = new List<Rectangle>();
            for (int i = 0; i <= Math.Ceiling((float)(height - CORNER_SIZE) / SIDE_SIZE); i++)
                panelRightSideRect.Add(new Rectangle((int)(MiResolution.Center.X + width / 2), (int)(MiResolution.Center.Y - height / 2) + i * SIDE_SIZE + CORNER_SIZE / 2, CORNER_SIZE, SIDE_SIZE));
            panelTopSideRect = new List<Rectangle>();
            for (int i = 0; i <= Math.Ceiling((float)(width - CORNER_SIZE) / SIDE_SIZE); i++)
                panelTopSideRect.Add(new Rectangle((int)(MiResolution.Center.X - width / 2) + i * SIDE_SIZE + CORNER_SIZE / 2, (int)(MiResolution.Center.Y - height / 2), CORNER_SIZE, SIDE_SIZE));
            panelBottomSideRect = new List<Rectangle>();
            for (int i = 0; i <= Math.Ceiling((float)(width - CORNER_SIZE) / SIDE_SIZE); i++)
                panelBottomSideRect.Add(new Rectangle((int)(MiResolution.Center.X - width / 2) + i * SIDE_SIZE + CORNER_SIZE / 2, (int)(MiResolution.Center.Y + height / 2), CORNER_SIZE, SIDE_SIZE));
            panelFillRect = new Rectangle((int)(MiResolution.Center.X), (int)(MiResolution.Center.Y), width, height);

            //
            // Cursor
            //
            cursor = new MiAnimatingComponent(game, 0, 0, 1, CURSOR_ROTATE, CURSOR_ORIGIN_X, CURSOR_ORIGIN_Y);
        }
Beispiel #6
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;
        }
Beispiel #7
0
 public MicycleGameSystem(Micycle game)
     : base(game)
 {
     Init();
 }