private void StartLevel(int i) { Graphics graphics = CreateGraphics(); pg = new Playground(); string filename = @"..\..\..\levels\level" + Convert.ToString(i) + ".txt"; pg.StartLevelFromFile(filename); PbPlayground.Refresh(); LblNrOfMoves.Text = "no moves yet"; }
private void PbPlayground_MouseUp(object sender, MouseEventArgs e) { Plate plate = pg.GetPlate(e.X, e.Y); if (plate != null) { plate.AddCookie(); foreach (Plate item in plate.Neighbors) { item.AddCookie(); } pg.IncrementNrOfMoves(); PbPlayground.Invalidate(); if (pg.CheckWin()) { MessageBox.Show("Yay you won!"); } } }