/// <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); //SwinGame.DrawBitmap(GameResources.GameImage("MenuButton"), MENU_LEFT, MENU_TOP); if (Sound == true) { SwinGame.DrawText("AUDIO ON", Color.White, MUTE_BUTTON_LEFT, MUTE_BUTTON_TOP); } if (Sound == false) { SwinGame.DrawText("AUDIO OFF", Color.Grey, MUTE_BUTTON_LEFT, MUTE_BUTTON_TOP); } }
// '' <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 RATIO_TOP = 303; 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("Ingame_Menu"), SCORES_LEFT, SHOTS_TOP); SwinGame.DrawText(GameController.HumanPlayer.Hits.ToString(), Color.White, GameResources.GameFont("Ingame_Menu"), SCORES_LEFT, HITS_TOP); SwinGame.DrawText(GameController.HumanPlayer.Missed.ToString(), Color.White, GameResources.GameFont("Ingame_Menu"), SCORES_LEFT, SPLASH_TOP); if (GameController.HumanPlayer.Shots != 0) { SwinGame.DrawText((Math.Round(((double)GameController.HumanPlayer.Hits / (double)GameController.HumanPlayer.Shots) * 100, 2)).ToString() + " %", Color.White, GameResources.GameFont("Ingame_Menu"), SCORES_LEFT, RATIO_TOP); } else { SwinGame.DrawText("N/A", Color.White, GameResources.GameFont("Ingame_Menu"), SCORES_LEFT, RATIO_TOP); } }
/// <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)) if (SwinGame.KeyDown(KeyCode.vk_SPACE)) { UtilityFunctions.DrawField(GameController.HumanPlayer.EnemyGrid, GameController.ComputerPlayer, true); } else { UtilityFunctions.DrawField(GameController.HumanPlayer.EnemyGrid, GameController.ComputerPlayer, false); } //UtilityFunctions.DrawField(GameController.HumanPlayer.EnemyGrid, GameController.ComputerPlayer, true); 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); //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 foreach (ShipName sn in Enum.GetValues(typeof(ShipName))) { int i = 0; i = ((int)sn) - 1; if (i >= 0) { if (sn == _selectedShip) { SwinGame.DrawBitmap(GameResources.GameImage("SelectedShip"), 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); SwinGame.DrawBitmap(GameResources.GameImage("BackToMenu"), MENU_BUTTON_LEFT, MENU_BUTTON_TOP); //SwinGame.FillRectangle(Color.DodgerBlue, MENU_BUTTON_LEFT, MENU_BUTTON_TOP, MENU_BUTTON_WIDTH, MENU_BUTTON_WIDTH); //SwinGame.DrawText ("BACK", Color.Black, GameResources.GameFont ("Courier"), MENU_BUTTON_LEFT + TEXT_OFFSET, MENU_BUTTON_TOP + MENU_BUTTON_WIDTH/3); UtilityFunctions.DrawMessage(); }
/// <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 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); SwinGame.DrawBitmap(GameResources.GameImage("LeftButton"), LEFT_BUTTON_LEFT, TOP_BUTTONS_TOP); SwinGame.DrawBitmap(GameResources.GameImage("RightButton"), RIGHT_BUTTON_LEFT, TOP_BUTTONS_TOP); SwinGame.DrawBitmap(GameResources.GameImage("UpButton"), UP_BUTTON_LEFT, TOP_BUTTONS_TOP); SwinGame.DrawBitmap(GameResources.GameImage("DownButton"), DOWN_BUTTON_LEFT, TOP_BUTTONS_TOP); //Draw the Left/Right and Up/Down buttons if (_currentDirection == Direction.Left) { SwinGame.DrawRectangleOnScreen(Color.Yellow, LEFT_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT); //SwinGame.DrawBitmap(GameResources.GameImage("LeftButton"), LEFT_BUTTON_LEFT, TOP_BUTTONS_TOP); } else if (_currentDirection == Direction.Right) { SwinGame.DrawRectangleOnScreen(Color.Yellow, RIGHT_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT); //SwinGame.DrawBitmap(GameResources.GameImage("RightButton"), LEFT_BUTTON_LEFT, TOP_BUTTONS_TOP); } else if (_currentDirection == Direction.Up) { SwinGame.DrawRectangleOnScreen(Color.Yellow, UP_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT); // SwinGame.DrawBitmap(GameResources.GameImage("UpButton"), LEFT_BUTTON_LEFT, TOP_BUTTONS_TOP); } else if (_currentDirection == Direction.Down) { SwinGame.DrawRectangleOnScreen(Color.Yellow, DOWN_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT); // SwinGame.DrawBitmap(GameResources.GameImage("DownButton"), LEFT_BUTTON_LEFT, TOP_BUTTONS_TOP); } //DrawShips foreach (ShipName sn in Enum.GetValues(typeof(ShipName))) { int i = 0; i = System.Convert.ToInt32(System.Convert.ToInt32(sn) - 1); if (i >= 0) { if (sn == _selectedShip) { SwinGame.DrawBitmap(GameResources.GameImage("SelectedShip"), 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, GameResources.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, GameResources.GameFont("Courier"), PLAY_BUTTON_LEFT + TEXT_OFFSET, PLAY_BUTTON_TOP) } SwinGame.DrawBitmap(GameResources.GameImage("RandomButton"), RANDOM_BUTTON_LEFT, TOP_BUTTONS_TOP); //SwinGame.DrawBitmap(GameResources.GameImage("MenuButton"), MENU_LEFT, MENU_TOP); if (Sound == true) { //SwinGame.DrawBitmap(GameResources.GameImage("SoundButton"), MUTE_BUTTON_LEFT, MUTE_BUTTON_TOP); SwinGame.DrawText("AUDIO", Color.White, MUTE_BUTTON_LEFT, MUTE_BUTTON_TOP); } else { SwinGame.DrawText("AUDIO", Color.Grey, MUTE_BUTTON_LEFT, MUTE_BUTTON_TOP); } UtilityFunctions.DrawMessage(); }