Ejemplo n.º 1
0
        public BattleScreen(MiGame game, MiTileEngine tileEngine)
            : base(game)
        {
            if (Instance == null)
            {
                flash = new MiAnimatingComponent(Game, 0, 0, 1280, 800, 0, 0, 0, 0);
                this.tileEngine = tileEngine;
                inputResponses[Controller.START] = Escaped;
                inputResponses[Controller.LEFT] = Lefted;
                inputResponses[Controller.RIGHT] = Righted;
                inputResponses[Controller.UP] = Upped;
                inputResponses[Controller.DOWN] = Downed;
                inputResponses[Controller.A] = Pressed;

                positions = new Dictionary<Character, Point>();

                cursor = new MiAnimatingComponent(game, 0, 0, 0, 0);
                cursor.Color = Color.Yellow;

                selectedValidMoves = new Dictionary<Point, int>();
                selectedAOE = new Dictionary<Point, int>();

                random = new Random();
            }
            else
            {
                throw new Exception("Battle Screen Already Initialized");
            }
        }
Ejemplo n.º 2
0
 public MessageScreen(MiGame game)
     : base(game)
 {
     if (Instance == null)
     {
         background = new MiAnimatingComponent(game, 0, HEIGHT, MiResolution.VirtualWidth, MiResolution.VirtualHeight - HEIGHT, 0, 0, 0, 0);
         inputResponses[Controller.A] = ExitSequence;
         entryExitMutex = false;
     }
     else
     {
         throw new Exception("Dialog Screen Already Initialized");
     }
 }
Ejemplo n.º 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");
            }
        }
Ejemplo n.º 4
0
 public void LoadMap(char[,] charmap, int init_dx, int init_dy)
 {
     mapGraphics    = new MiAnimatingComponent[charmap.GetLength(0), charmap.GetLength(1)];
     mapPassability = new bool[charmap.GetLength(0), charmap.GetLength(1)];
     for (int row = 0; row < charmap.GetLength(0); row++)
     {
         for (int col = 0; col < charmap.GetLength(1); col++)
         {
             mapGraphics[row, col] = new MiAnimatingComponent(Game, col * tileWidth + init_dx, row * tileHeight + init_dy, tileWidth, tileHeight);
             mapGraphics[row, col].AddTexture(tiles[charmap[row, col]].Texture, 0);
             mapPassability[row, col] = tiles[charmap[row, col]].Passable;
         }
     }
     xOffset = init_dx;
     yOffset = init_dy;
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 6
0
        public WorldScreen(MiGame game)
            : base(game)
        {
            if (Instance == null)
            {
                background = new MiAnimatingComponent(game, 0, 0, 1280, 800);
                //
                // Create UI for Locations
                //
                LocationUI test_1 = new LocationUI(game, 150, 150, 64, 64, LocationData.TEST_1);
                LocationUI test_2 = new LocationUI(game, 150, 350, 64, 64, LocationData.courtyard);
                LocationUI test_3 = new LocationUI(game, 150, 550, 64, 64, LocationData.cafe);
                LocationUI test_4 = new LocationUI(game, 350, 150, 64, 64, LocationData.Erty);
                LocationUI test_5 = new LocationUI(game, 350, 350, 64, 64, LocationData.hall);
                LocationUI test_6 = new LocationUI(game, 350, 550, 64, 64, LocationData.HOME);
                LocationUI test_7 = new LocationUI(game, 550, 150, 64, 64, LocationData.mindclass);
                LocationUI test_8 = new LocationUI(game, 550, 350, 64, 64, LocationData.weaponclass);
                LocationUI test_9 = new LocationUI(game, 550, 550, 64, 64, LocationData.willclass);
                //LocationUI test_3 = new LocationUI(game, 650, 250, 128, 128, LocationData.TEST_3);
                LocationData.TEST_1.ControllingFaction = LocationData.State.ENEMY;

                //
                // Add Neighbors
                //
                test_1.Neighbors.Add(Controller.DOWN, test_2);
                test_1.Neighbors.Add(Controller.RIGHT, test_4);

                test_2.Neighbors.Add(Controller.UP, test_1);
                test_2.Neighbors.Add(Controller.DOWN, test_3);
                test_2.Neighbors.Add(Controller.RIGHT, test_5);

                test_3.Neighbors.Add(Controller.UP, test_2);
                test_3.Neighbors.Add(Controller.DOWN, test_4);
                test_3.Neighbors.Add(Controller.RIGHT, test_6);

                test_4.Neighbors.Add(Controller.UP, test_3);
                test_4.Neighbors.Add(Controller.DOWN, test_5);
                test_4.Neighbors.Add(Controller.RIGHT, test_7);

                test_5.Neighbors.Add(Controller.UP, test_4);
                test_5.Neighbors.Add(Controller.DOWN, test_6);
                test_5.Neighbors.Add(Controller.RIGHT, test_8);

                test_6.Neighbors.Add(Controller.UP, test_5);
                test_6.Neighbors.Add(Controller.DOWN, test_7);
                test_6.Neighbors.Add(Controller.RIGHT, test_9);

                test_7.Neighbors.Add(Controller.UP, test_6);
                test_7.Neighbors.Add(Controller.DOWN, test_8);
                test_7.Neighbors.Add(Controller.RIGHT, test_1);

                test_8.Neighbors.Add(Controller.UP, test_7);
                test_8.Neighbors.Add(Controller.DOWN, test_9);
                test_8.Neighbors.Add(Controller.RIGHT, test_2);

                test_9.Neighbors.Add(Controller.UP, test_8);
                test_9.Neighbors.Add(Controller.DOWN, test_1);
                test_9.Neighbors.Add(Controller.RIGHT, test_3);

                //
                // Add All Locations to Global List
                //
                allLocations = new List<LocationUI>();
                allLocations.Add(test_1);
                allLocations.Add(test_2);
                allLocations.Add(test_3);
                allLocations.Add(test_4);
                allLocations.Add(test_5);
                allLocations.Add(test_6);
                allLocations.Add(test_7);
                allLocations.Add(test_8);
                allLocations.Add(test_9);

                //
                // Default Active Location
                //
                activeLocation = test_1;

                //
                // Cursor
                //
                cursor = new MiAnimatingComponent(game, activeLocation.ButtonBase.Position.X -50, activeLocation.ButtonBase.Position.Y + 30, 33, 35);

                //
                // Responses to Input
                //
                inputResponses[Controller.UP] = Upped;
                inputResponses[Controller.DOWN] = Downed;
                inputResponses[Controller.LEFT] = Lefted;
                inputResponses[Controller.RIGHT] = Righted;
                inputResponses[Controller.A] = EnterLocation;
                inputResponses[Controller.START] = Escape;
            }
            else
            {
                throw new Exception("World Screen Already Initialized");
            }
        }
Ejemplo n.º 7
0
 public LocationUI(MiGame game, int x, int y, int width, int height, LocationData location)
 {
     this.game = game;
     Neighbors = new Dictionary<MiControl, LocationUI>();
     allyButtonBase = new MiAnimatingComponent(game, x, y, width, height);
     enemyButtonBase = new MiAnimatingComponent(game, x, y, width, height);
     neutralButtonBase = new MiAnimatingComponent(game, x, y, width, height);
     this.location = location;
 }
Ejemplo n.º 8
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;
        }