private void CondiciondeVictoria(buscaminas.WinCondition N, int x, int y) { Derrota L = new Derrota(); VictoriaP W = new VictoriaP(); if (N == buscaminas.WinCondition.Win) { pbxGrid.Invalidate(); T.DesFlags(); T.MostrarMinas(); pbxGrid.Refresh(); W.ShowDialog(); GuardarRecord(); RestartGrid(); } else { T.DesFlags(); T.UltimaMina(x, y); T.MostrarMinas(); pbxGrid.Refresh(); L.ShowDialog(); RestartGrid(); } }
private void pbxGrid_MouseClick(object sender, MouseEventArgs e) { int x = e.X * T.Columnas / pbxGrid.Width; int y = e.Y * T.Filas / pbxGrid.Height; crono.Start(); switch (e.Button) { case MouseButtons.Left: buscaminas.WinCondition N = buscaminas.WinCondition.KeepPlaying; if (T.Flag[y, x] || T.Interrogacion[y, x]) { break; } N = T.Juego(y, x); if (N == buscaminas.WinCondition.KeepPlaying) { pbxGrid.Refresh(); } else { crono.Stop(); T.Marca = crono.ElapsedMilliseconds / 1000; CondiciondeVictoria(N, y, x); } break; case MouseButtons.Right: T.Flags(y, x); RefrescarContador(); pbxGrid.Refresh(); break; } }