/// <summary> /// Если победил /// </summary> private void IsWin(object sender, MouseEventArgs e) { if (isPlay) { DialogResult dr = MessageBox.Show("You win!\nSave the graph picture?", "Congratz", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { SaveButton_Click(sender, e); } if (MessageBox.Show("Continue?", "Congratz", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { level++; StartLevel(); isPlay = true; } else { results += String.Format("{0}\t Level: {1}\t Solved himself: {2}\t Auto solve: {3}\n", name, level - 5, level - 5 - autoSolves, autoSolves); level = 4; autoSolves = 0; Vertices.Clear(); Edges.Clear(); DrawAll(); Text = "Untangle"; StartButton.Show(); ExitStartMenuButton.Show(); RulesStartMenuButton.Show(); TitleLabel.Show(); TitleUnderLabel.Show(); isPlay = false; MainMenuButton.Enabled = false; } } }
private void MainMenuButton_Click(object sender, EventArgs e) { DialogResult dr = MessageBox.Show("Save your result?", "Attention", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { results += String.Format("{0}\t Level: {1}\t Solved himself: {2}\t Auto solve: {3}\n", name, level - 5, level - 5 - autoSolves, autoSolves); } else if (dr == DialogResult.Cancel) { return; } dr = MessageBox.Show("Are you want to exit to main menu?", "Attention", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { level = 6; autoSolves = 0; Vertices.Clear(); Edges.Clear(); DrawAll(); Text = "Untangle"; StartButton.Show(); ExitStartMenuButton.Show(); RulesStartMenuButton.Show(); TitleLabel.Show(); TitleUnderLabel.Show(); isPlay = false; isNewGame = true; MainMenuButton.Enabled = false; } }
/// <summary> /// Инициализация уровня /// </summary> private void StartLevel() { if (isNewGame) { while (name == "") { Opacity = 0; AuthForm form = new AuthForm(); DialogResult dr = form.ShowDialog(); if (dr == DialogResult.OK) { break; } else { Opacity = 0.95; return; } } } Opacity = 0.95; isNewGame = false; TitleLabel.Hide(); // hide - скрыть TitleUnderLabel.Hide(); StartButton.Hide(); RulesStartMenuButton.Hide(); ExitStartMenuButton.Hide(); MainMenuButton.Enabled = true; InitializeVertices(); InitializeEdges(); SolvedVertices = new List <Vertex>(); SolvedEdges = new List <Edge>(); for (int i = 0; i < Vertices.Count; i++) { SolvedVertices.Add(new Vertex(VertexDesign, Vertices[i].Location)); } for (int i = 0; i < Edges.Count; i++) { SolvedEdges.Add(new Edge(RightEdgeDesign, Edges[i].Location)); } RandomizeGraph(); isPlay = true; DrawAll(); Text = String.Format("Untangle. Level: {0}", level - 5); // подпись сверху }