/// <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); }
/// <summary> /// Draws the deployment screen showing the field and the ships /// that the player can deploy. /// </summary> public static void DrawDeployment() { UtilityFunctions.DrawField(GameController.HumanPlayer.PlayerGrid, GameController.HumanPlayer, true); //Draw the Left/Right and Up/Down buttons if (_currentDirection == Direction.LeftRight) { SwinGame.DrawBitmap(GameResources.GameImage("LeftRightButton"), LEFT_RIGHT_BUTTON_LEFT, TOP_BUTTONS_TOP); //SwinGame.DrawText("U/D", Color.Gray, GameFont("Menu"), UP_DOWN_BUTTON_LEFT, TOP_BUTTONS_TOP) //SwinGame.DrawText("L/R", Color.White, GameFont("Menu"), LEFT_RIGHT_BUTTON_LEFT, TOP_BUTTONS_TOP) } else { SwinGame.DrawBitmap(GameResources.GameImage("UpDownButton"), LEFT_RIGHT_BUTTON_LEFT, TOP_BUTTONS_TOP); //SwinGame.DrawText("U/D", Color.White, GameFont("Menu"), UP_DOWN_BUTTON_LEFT, TOP_BUTTONS_TOP) //SwinGame.DrawText("L/R", Color.Gray, GameFont("Menu"), LEFT_RIGHT_BUTTON_LEFT, TOP_BUTTONS_TOP) } //DrawShips int shipNum = -1; foreach (ShipName sn in Enum.GetValues(typeof(ShipName))) { shipNum++; int i = 0; i = ((int)sn) - 1; if (i >= 0) { if (sn == _selectedShip) { string shipResource = "SelectedShip" + shipNum.ToString(); SwinGame.DrawBitmap(GameResources.GameImage(shipResource), SHIPS_LEFT, SHIPS_TOP + i * SHIPS_HEIGHT); // 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) } } if (GameController.HumanPlayer.ReadyToDeploy) { SwinGame.DrawBitmap(GameResources.GameImage("PlayButton"), PLAY_BUTTON_LEFT, TOP_BUTTONS_TOP); //SwinGame.FillRectangle(Color.LightBlue, PLAY_BUTTON_LEFT, PLAY_BUTTON_TOP, PLAY_BUTTON_WIDTH, PLAY_BUTTON_HEIGHT) //SwinGame.DrawText("PLAY", Color.Black, GameFont("Courier"), PLAY_BUTTON_LEFT + TEXT_OFFSET, PLAY_BUTTON_TOP) } SwinGame.DrawBitmap(GameResources.GameImage("RandomButton"), RANDOM_BUTTON_LEFT, TOP_BUTTONS_TOP); UtilityFunctions.DrawMessage(); //DrawDeployDebug (); }
/// <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; 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); } 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); }
/// <summary> /// Draws the deployment screen showing the field and the ships /// that the player can deploy. /// </summary> public static void DrawDeployment() { UtilityFunctions.DrawField(GameController.HumanPlayer.PlayerGrid, GameController.HumanPlayer, true); // Draw the Left/Right and Up/Down buttons if (_currentDirection == Direction.LeftRight) { SwinGame.DrawBitmap(GameResources.GameImage("LeftRightButton"), LEFT_RIGHT_BUTTON_LEFT, TOP_BUTTONS_TOP); } else { SwinGame.DrawBitmap(GameResources.GameImage("UpDownButton"), LEFT_RIGHT_BUTTON_LEFT, TOP_BUTTONS_TOP); } // DrawShips foreach (ShipName sn in Enum.GetValues(typeof(ShipName))) { int i; i = (int)sn - 1; if (i >= 0) { if (sn == _selectedShip) { SwinGame.DrawBitmap(GameResources.GameImage("SelectedShip"), SHIPS_LEFT, SHIPS_TOP + i * SHIPS_HEIGHT); } } } if (GameController.HumanPlayer.ReadyToDeploy) { SwinGame.DrawBitmap(GameResources.GameImage("PlayButton"), PLAY_BUTTON_LEFT, TOP_BUTTONS_TOP); } SwinGame.DrawBitmap(GameResources.GameImage("RandomButton"), RANDOM_BUTTON_LEFT, TOP_BUTTONS_TOP); UtilityFunctions.DrawMessage(); }
/// <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) } } } }