コード例 #1
0
        /// <summary>
        /// Draws the game during the attack phase.
        /// </summary>s
        public static void DrawDiscovery()
        {
            const int SCORES_LEFT = 172;
            const int SHOTS_TOP   = 157;
            const int HITS_TOP    = 206;
            const int SPLASH_TOP  = 256;
            const int POINTS_LEFT = 350;
            const int POINTS_TOP  = 85;

            if ((SwinGame.KeyDown(KeyCode.LeftShiftKey) | SwinGame.KeyDown(KeyCode.RightShiftKey)) & SwinGame.KeyDown(KeyCode.CKey))
            {
                UtilityFunctions.DrawField(GameController.HumanPlayer.EnemyGrid, GameController.ComputerPlayer, true);
            }
            else
            {
                UtilityFunctions.DrawField(GameController.HumanPlayer.EnemyGrid, GameController.ComputerPlayer, false);
            }

            UtilityFunctions.DrawSmallField(GameController.HumanPlayer.PlayerGrid, GameController.HumanPlayer);
            UtilityFunctions.DrawMessage();

            SwinGame.DrawText(GameController.HumanPlayer.Shots.ToString(), Color.White, GameResources.GameFont("Menu"), SCORES_LEFT, SHOTS_TOP);
            SwinGame.DrawText(GameController.HumanPlayer.Hits.ToString(), Color.White, GameResources.GameFont("Menu"), SCORES_LEFT, HITS_TOP);
            SwinGame.DrawText(GameController.HumanPlayer.Missed.ToString(), Color.White, GameResources.GameFont("Menu"), SCORES_LEFT, SPLASH_TOP);
            SwinGame.DrawText($"Score: {GameController.HumanPlayer.Score}", Color.Aqua, GameResources.GameFont("Courier"), POINTS_LEFT, POINTS_TOP);
        }
コード例 #2
0
        /// <summary>
        /// Draws the game during the attack phase.
        /// </summary>s
        public static void DrawDiscovery()
        {
            const int SCORES_LEFT      = 172;
            const int SHOTS_TOP        = 157;
            const int HITS_TOP         = 206;
            const int SPLASH_TOP       = 256;
            const int MENU_BUTTON_TOP  = 72;
            const int MENU_BUTTON_LEFT = 693;

            if ((SwinGame.KeyDown(KeyCode.vk_LSHIFT) | SwinGame.KeyDown(KeyCode.vk_RSHIFT)) & SwinGame.KeyDown(KeyCode.vk_c))
            {
                UtilityFunctions.DrawField(GameController.HumanPlayer.EnemyGrid, GameController.ComputerPlayer, true);
            }
            else
            {
                UtilityFunctions.DrawField(GameController.HumanPlayer.EnemyGrid, GameController.ComputerPlayer, false);
            }

            SwinGame.DrawBitmap(GameResources.GameImage("MenuButton"), MENU_BUTTON_LEFT, MENU_BUTTON_TOP);


            UtilityFunctions.DrawSmallField(GameController.HumanPlayer.PlayerGrid, GameController.HumanPlayer);
            UtilityFunctions.DrawMessage();

            SwinGame.DrawText(GameController.HumanPlayer.Shots.ToString(), Color.White, GameResources.GameFont("Menu"), SCORES_LEFT, SHOTS_TOP);
            SwinGame.DrawText(GameController.HumanPlayer.Hits.ToString(), Color.White, GameResources.GameFont("Menu"), SCORES_LEFT, HITS_TOP);
            SwinGame.DrawText(GameController.HumanPlayer.Missed.ToString(), Color.White, GameResources.GameFont("Menu"), SCORES_LEFT, SPLASH_TOP);
        }
コード例 #3
0
        /// <summary>
        /// Draw the end of the game screen, shows the win/lose state
        /// </summary>
        public static void DrawEndOfGame()
        {
            UtilityFunctions.DrawField(GameController.ComputerPlayer.PlayerGrid, GameController.ComputerPlayer, true);
            UtilityFunctions.DrawSmallField(GameController.HumanPlayer.PlayerGrid, GameController.HumanPlayer);

            if (GameController.HumanPlayer.IsDestroyed)
            {
                SwinGame.DrawTextLines("YOU LOSE!", Color.White, Color.Transparent, GameResources.GameFont("ArialLarge"), FontAlignment.AlignCenter, 0, 250, SwinGame.ScreenWidth(), SwinGame.ScreenHeight());
            }
            else
            {
                SwinGame.DrawTextLines("-- WINNER --", Color.White, Color.Transparent, GameResources.GameFont("ArialLarge"), FontAlignment.AlignCenter, 0, 250, SwinGame.ScreenWidth(), SwinGame.ScreenHeight());
            }
        }
コード例 #4
0
        /// <summary>
        /// Draw the end of the game screen, shows the win/lose state
        /// </summary>
        public static void DrawEndOfGame()
        {
            Rectangle toDraw = new Rectangle {
                X      = 0,
                Y      = 250,
                Width  = SwinGame.ScreenWidth(),
                Height = SwinGame.ScreenHeight()
            };

            UtilityFunctions.DrawField(GameController.ComputerPlayer.PlayerGrid, GameController.ComputerPlayer, true);
            UtilityFunctions.DrawSmallField(GameController.HumanPlayer.PlayerGrid, GameController.HumanPlayer);

            string message = (GameController.HumanPlayer.IsDestroyed) ? "You Lose!" : "-- You Win --";

            SwinGame.DrawText(message, Color.White, Color.Transparent, GameResources.GetFont("ArialLarge"), FontAlignment.AlignCenter, toDraw);
        }
コード例 #5
0
        /// <summary>
        /// Draw the end of the game screen, shows the win/lose state
        /// </summary>
        /// <remarks>
        /// Isuru: Updated to new swingame call
        /// </remarks>
        public static void DrawEndOfGame()
        {
            UtilityFunctions.DrawField(GameController.ComputerPlayer.PlayerGrid, GameController.ComputerPlayer, true);
            UtilityFunctions.DrawSmallField(GameController.HumanPlayer.PlayerGrid, GameController.HumanPlayer);

            Rectangle toDraw = new Rectangle();

            toDraw.X      = 0;
            toDraw.Y      = 250;
            toDraw.Width  = SwinGame.ScreenWidth();
            toDraw.Height = SwinGame.ScreenHeight();
            //String whatShouldIPrint = "I have long variable names";
            if (GameController.HumanPlayer.IsDestroyed)
            {
                SwinGame.DrawBitmap(GameResources.GameImage("YouLose"), 350, 120);
                //whatShouldIPrint = "YOU LOSE!";
            }
            else
            {
                //whatShouldIPrint = "-- WINNER --";
                SwinGame.DrawBitmap(GameResources.GameImage("YouWin"), 350, 120);
            }
            //SwinGame.DrawText(whatShouldIPrint, Color.White, Color.Transparent, GameResources.GameFont("ArialLarge"), FontAlignment.AlignCenter, toDraw);
        }
コード例 #6
0
        /// <summary>
        /// Draw the end of the game screen, shows the win/lose state
        /// </summary>
        public static void DrawEndOfGame()
        {
            Rectangle toDraw           = default(Rectangle);
            string    whatShouldIPrint = "";

            UtilityFunctions.DrawField(GameController.ComputerPlayer.PlayerGrid, GameController.ComputerPlayer, true);
            UtilityFunctions.DrawSmallField(GameController.HumanPlayer.PlayerGrid, GameController.HumanPlayer);

            toDraw.X      = 0;
            toDraw.Y      = 250;
            toDraw.Width  = SwinGame.ScreenWidth();
            toDraw.Height = SwinGame.ScreenHeight();

            if (GameController.HumanPlayer.IsDestroyed)
            {
                whatShouldIPrint = "YOU LOSE!";
            }
            else
            {
                whatShouldIPrint = "-- WINNER --";
            }

            SwinGame.DrawText(whatShouldIPrint, Color.White, Color.Transparent, GameResources.GameFont("Square80"), FontAlignment.AlignCenter, toDraw);
        }
コード例 #7
0
        /// <summary>
        /// Draws the game during the attack phase.
        /// </summary>s
        public static void DrawDiscovery()
        {
            const int SCORES_LEFT = 172;
            const int SHOTS_TOP   = 157;
            const int HITS_TOP    = 206;
            const int SPLASH_TOP  = 256;
            const int AI_LEFT     = 50;
            const int AI_TOP      = 350;

            if (UtilityFunctions.ShowShipsCheat)
            {
                UtilityFunctions.DrawField(GameController.HumanPlayer.EnemyGrid, GameController.ComputerPlayer, true);
            }
            else
            {
                UtilityFunctions.DrawField(GameController.HumanPlayer.EnemyGrid, GameController.ComputerPlayer, false);
            }

            UtilityFunctions.DrawSmallField(GameController.HumanPlayer.PlayerGrid, GameController.HumanPlayer);
            UtilityFunctions.DrawMessage();

            SwinGame.DrawText(GameController.HumanPlayer.Shots.ToString(), Color.White, GameResources.GameFont("Menu"), SCORES_LEFT, SHOTS_TOP);
            SwinGame.DrawText(GameController.HumanPlayer.Hits.ToString(), Color.White, GameResources.GameFont("Menu"), SCORES_LEFT, HITS_TOP);
            SwinGame.DrawText(GameController.HumanPlayer.Missed.ToString(), Color.White, GameResources.GameFont("Menu"), SCORES_LEFT, SPLASH_TOP);
            SwinGame.DrawText(GameController.AiGameSetting(), Color.White, GameResources.GameFont("Menu"), AI_LEFT, AI_TOP);

            //Draws Ships
            foreach (ShipName sn in Enum.GetValues(typeof(ShipName)))
            {
                if (object.ReferenceEquals(GameController.ComputerPlayer.Ship(sn), null))
                {
                }
                else
                {
                    if (GameController.ComputerPlayer.Ship(sn).IsDestroyed)
                    {
                        int i = 0;
                        i = (int)sn - 1;
                        int rowTop  = 122 + (2 + 40) * GameController.ComputerPlayer.Ship(sn).Row + 3;
                        int colLeft = 349 + (2 + 40) * GameController.ComputerPlayer.Ship(sn).Column + 3;
                        if (i >= 0)
                        {
                            string shipName   = null;
                            int    shipHeight = 0;
                            int    shipWidth  = 0;
                            int    cellHeight = 40;
                            int    SHIP_GAP   = 3;
                            int    cellWidth  = 40;
                            int    cellGap    = 2;
                            int    j          = (int)GameController.ComputerPlayer.Ship(sn).CurrentShipColour;
                            if (GameController.ComputerPlayer.Ship(sn).Direction == Direction.LeftRight)
                            {
                                shipName   = "ShipLR" + GameController.ComputerPlayer.Ship(sn).Size + "a" + j;
                                shipHeight = cellHeight - (SHIP_GAP * 2);
                                shipWidth  = (cellWidth + cellGap) * GameController.ComputerPlayer.Ship(sn).Size - (SHIP_GAP * 2) - cellGap;
                            }
                            else
                            {
                                //Up down
                                shipName   = "ShipUD" + GameController.ComputerPlayer.Ship(sn).Size + "a" + j;
                                shipHeight = (cellHeight + cellGap) * GameController.ComputerPlayer.Ship(sn).Size - (SHIP_GAP * 2) - cellGap;
                                shipWidth  = cellWidth - (SHIP_GAP * 2);
                            }
                            //FIX HERE!!!
                            SwinGame.DrawBitmap(GameResources.GameImage(shipName), colLeft, rowTop);

                            //    SwinGame.FillRectangle(Color.LightBlue, SHIPS_LEFT, SHIPS_TOP + i * SHIPS_HEIGHT, SHIPS_WIDTH, SHIPS_HEIGHT)
                            //Else
                            //    SwinGame.FillRectangle(Color.Gray, SHIPS_LEFT, SHIPS_TOP + i * SHIPS_HEIGHT, SHIPS_WIDTH, SHIPS_HEIGHT)
                        }

                        //SwinGame.DrawRectangle(Color.Black, SHIPS_LEFT, SHIPS_TOP + i * SHIPS_HEIGHT, SHIPS_WIDTH, SHIPS_HEIGHT)
                        //SwinGame.DrawText(sn.ToString(), Color.Black, GameFont("Courier"), SHIPS_LEFT + TEXT_OFFSET, SHIPS_TOP + i * SHIPS_HEIGHT)
                    }
                }
            }
        }