private void startGameButton_Click(object sender, EventArgs e) { // set the game type and AI difficulty var gameType = new GameLogic.GameTypes(); var AIDifficulty = new GameLogic.AILevels(); if (gameSettingsTabs.SelectedTab == gameSettingsTabs.TabPages["AITabPage"]) { gameType = GameLogic.GameTypes.AI; if (easyAIRadio.Checked) { AIDifficulty = GameLogic.AILevels.Easy; } else if (regularAIRadio.Checked) { AIDifficulty = GameLogic.AILevels.Regular; } else { AIDifficulty = GameLogic.AILevels.Hard; } } else { gameType = GameLogic.GameTypes.Local; AIDifficulty = GameLogic.AILevels.None; MessageBox.Show("In progress"); return; } foreach (var boat in boatsOnBoard) { boat.resetSections(); Debug.Print($"main coord: {boat.mainCoord}, destroyed: {boat.destroyed}"); } // create new form var newForm = new PlayForm(gameType, AIDifficulty, boatsOnBoard); newForm.Location = this.Location; newForm.StartPosition = FormStartPosition.Manual; newForm.FormClosing += delegate { this.Show(); this.setupValues(); }; newForm.Show(); this.Hide(); }
public PlayForm(GameLogic.GameTypes Type, GameLogic.AILevels Difficuly, List <GameLogic.Boat> PlayerBoats, string Name_ = "Player", string OpponentName = "AI") { InitializeComponent(); gameType = Type; AIDifficuly = Difficuly; playerName = Name_; opponentName = OpponentName; playerBoats = PlayerBoats; // make listVIew look like a listBox logListView.Columns.Add("", -2); playerDisplay = new DisplayBoard(setPlayerBoard, setBoatsAfter: setupPlayerBoats); opponentDisplay = new DisplayBoard(setOpponentBoard, playTableLabel_MouseClick, playTableLabel_MouseEnter, playTableLabel_MouseLeave); }