void Action(Figure v, short s) { GetLocation[v.Index + s].Add(v); GetLocation[v.Index].Remov(); v.Index = (byte)(v.Index + s); if (GetFigure[0].Index > 3 && GetFigure[1].Index > 3 && GetFigure[2].Index > 3 && GetFigure[5].Index < 3 && GetFigure[4].Index < 3 && GetFigure[3].Index < 3) { WinPuzzle(); } }
public PuzzleThree() { GetFigure = new Figure[] { new Figure("Image/Eris.png", 0, Team.Green){ Margin = new Thickness(410, 275,0,0)}, new Figure("Image/Eris.png", 1, 0){ Margin = new Thickness(465,275,0,0)}, new Figure("Image/Eris.png", 2, 0){ Margin = new Thickness(515,275,0,0)}, new Figure("Image/Mercury.png", 4, Team.Blue){ Margin = new Thickness(625,275,0,0)}, new Figure("Image/Mercury.png", 5, Team.Blue){ Margin = new Thickness(680,275,0,0)}, new Figure("Image/Mercury.png", 6, Team.Blue){ Margin = new Thickness(735,275,0,0)} }; GetLocation = new Location[] { new Location(GetFigure[0]), new Location(GetFigure[1]), new Location(GetFigure[2]), new Location(){ Margin = new Thickness(570,275,0,0)}, new Location(GetFigure[3]),new Location(GetFigure[4]),new Location(GetFigure[5])}; foreach (var v in GetFigure) { v.MouseLeftButtonDown += v_MouseLeftButtonUp; } }
public void Add(Figure s) { s.Margin = this.Margin; IsFigure = true; }
public Location(Figure s) { Height = 50; Width = 50; Source = new BitmapImage(new Uri("Image/black.png", UriKind.RelativeOrAbsolute)); this.VerticalAlignment = System.Windows.VerticalAlignment.Top; this.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; IsFigure = true; Margin = s.Margin; }