private void Btn_Back_Click(object sender, EventArgs e) { //Make sure that there is at minimum one ship if (num_Carriers.Value + num_Battleships.Value + num_Cruisers.Value + num_Destroyers.Value + num_Submarines.Value == 0) { MessageBox.Show("You need to have at minimum 1 ship", "No Ships", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (!ShipsFit()) { MessageBox.Show("The entered number of ships won't fit on the game board!", "To many ships", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //Save all settings Settings.Default.Carriers = (int)num_Carriers.Value; Settings.Default.Battleships = (int)num_Battleships.Value; Settings.Default.Cruisers = (int)num_Cruisers.Value; Settings.Default.Destroyers = (int)num_Destroyers.Value; Settings.Default.Submarines = (int)num_Submarines.Value; Settings.Default.ShotsFirstTurn = (int)num_ShotsFirstTurn.Value; Settings.Default.ShotsPerTurn = (int)num_ShotsPerTurn.Value; Settings.Default.PostTurnDelay = (int)(num_PostTurnDelay.Value * 1000); Settings.SaveSettings(); // Switch back to the Host MDI MDI_Container.SwitchMDI(MDI_Form_Enum.MDI_Host); }
private void Btn_Back_To_MainMenu_Click(object sender, EventArgs e) { //Ask if user wants to return to Main Menu if (MessageBox.Show("Are you sure you want to return to the main menu?", "Return to Main Menu", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { MDI_Container.SwitchMDI(MDI_Form_Enum.MDI_MainMenu); } }
private void Btn_Back_To_MainMenu_Click(object sender, EventArgs e) { //Ask if user wants to return to Main Menu if (MessageBox.Show("Are you sure you want to return to the main menu?", "Return to Main Menu", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (Networking.NetworkServer.ServerListening) { Networking.NetworkServer.StopServerListener(); btn_Host.Text = "Start Server"; lbl_IP.Visible = false; tbx_IPs.Visible = false; lbl_GameStart.Visible = false; Btn_GameSettings.Enabled = true; } MDI_Container.SwitchMDI(MDI_Form_Enum.MDI_MainMenu); } }
private void Btn_Join_Click(object sender, EventArgs e) { //Switch to the Join MDI MDI_Container.SwitchMDI(MDI_Form_Enum.MDI_Join, true); }
private void Btn_Host_Click(object sender, EventArgs e) { //Switch to the Host MDI MDI_Container.SwitchMDI(MDI_Form_Enum.MDI_Host, true); }
private void Btn_GameSettings_Click(object sender, EventArgs e) { //Go to the settings MDI MDI_Container.SwitchMDI(MDI_Form_Enum.MDI_GameSettings); }