Ejemplo n.º 1
0
        /// <summary>
        /// Draws the scoreboard
        /// </summary>
        /// <param name="g">The graphics object to draw the scoreboard on</param>
        /// <param name="human">The human</param>
        /// <param name="robot">The robot</param>
        /// <param name="AvailableTrophyCards">The avaliable trohpy cards</param>
        public void Draw(Graphics g, HumanPlayer human, RobotPlayer robot, List<Trophy> AvailableTrophyCards)
        {
            // Everything is currently drawn statically using the rectangles below
            Rectangle playerCubesRekt = new Rectangle(X + 10, Y + 10, 220, 100);
            Rectangle robotCubesRekt = new Rectangle(X + 10 + playerCubesRekt.Width + 10, Y + 10, 220, 100);
            Rectangle avaliableTrophyCardsRekt = new Rectangle(X + 10, Y + 120, Width - 20, 100);
            Rectangle humanTrophiesRekt = new Rectangle(X + 10, 250, 220, 100);
            Rectangle robotTrophiesRekt = new Rectangle(X + 10 + playerCubesRekt.Width + 10, 250, 220, 100);

            // For centering text
            Font arial = new Font("Arial", 8);
            StringFormat stringFormat = new StringFormat();
            stringFormat.Alignment = StringAlignment.Center;

            // Draw Player cubes
            g.DrawRectangle(Pens.Black, playerCubesRekt);
            g.DrawString("Human's Cube Collection", arial, Brushes.Black, playerCubesRekt, stringFormat);
            DrawCubeCollection(g, playerCubesRekt, human);

            // Draw Robot cubes
            g.DrawRectangle(Pens.Black, robotCubesRekt);
            g.DrawString("Robot's Cube Collection", arial, Brushes.Black, robotCubesRekt, stringFormat);
            DrawCubeCollection(g, robotCubesRekt, robot);

            // Avaliable trophy cards
            g.DrawRectangle(Pens.Black, avaliableTrophyCardsRekt);
            g.DrawString("Avaliable Trophy Cards", arial, Brushes.Black, avaliableTrophyCardsRekt, stringFormat);
            DrawTrophyCollection(g, avaliableTrophyCardsRekt, AvailableTrophyCards);

            // Human trophies
            g.DrawRectangle(Pens.Black, humanTrophiesRekt);
            g.DrawString("Human's Trophy Collection", arial, Brushes.Black, humanTrophiesRekt, stringFormat);
            DrawTrophyCollection(g, humanTrophiesRekt, human.Trophies);

            // Robot trophies
            g.DrawRectangle(Pens.Black, robotTrophiesRekt);
            g.DrawString("Robot's Trophy Collection", arial, Brushes.Black, robotTrophiesRekt, stringFormat);
            DrawTrophyCollection(g, robotTrophiesRekt, robot.Trophies);

            // The actual scoreboard
            g.DrawRectangle(Pens.Black, _rekt);
        }
Ejemplo n.º 2
0
        public void LoadResources()
        {
            // Add players
            human = new HumanPlayer("Human", deck, 0, 450, 1050, 100);
            robot = new RobotPlayer("Robot", deck, 0, 530, 1050, 100);  // Better give the robot's hand an actual position too

            // Static positions to draw things at
            int tileHeight = 120;
            int tileWidth = 120;
            int tileX = 10;
            int tileY = 145;

            // Load the tiles
            for (int i = 0; i < 4; i++)
            {
                if (i < 2)
                    tiles.Add(new Tile(tileX, tileY, tileWidth, tileHeight, Tile.TerrainType.Flatland, i + 1));
                else
                    tiles.Add(new Tile(tileX, tileY, tileWidth, tileHeight, Tile.TerrainType.Mountain, i + 1));

                tileX += 10 + tileWidth;    // Space tiles by 10px
            }

            // Load the cubes for the first time
            foreach(Tile tile in tiles)
                FillTile(tile);

            // It's always the human's turn first. Let 'em know
            Output("Human's turn..");

            // Do we draw the computer's hand?
            DrawComputerHand = chkShowComputerHand.Checked;

            // Add our trophy cards
            AvailableTrophyCards.Add(new Trophy(ColouredObject.Colours.Grey));
            AvailableTrophyCards.Add(new Trophy(ColouredObject.Colours.Blue));
            AvailableTrophyCards.Add(new Trophy(ColouredObject.Colours.Green));
            AvailableTrophyCards.Add(new Trophy(ColouredObject.Colours.Yellow));
            AvailableTrophyCards.Add(new Trophy(ColouredObject.Colours.Red));
        }