public void KeyDown(KeyEventArgs e) { switch (e.Key) { case Key.Up: MoveEvent.Up(matrix_box); break; case Key.Down: MoveEvent.Down(matrix_box); break; case Key.Left: MoveEvent.Left(matrix_box); break; case Key.Right: MoveEvent.Right(matrix_box); break; default: break; } if (Checker.IsTrue(matrix_box, rows, cols)) { SetGrid.SetDefault(gridPlay); SetGrid.SetImage(gridPlay, image); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { controller = new MainViewModel(gridPlay, gridPicture); controller.ConfigAuto(); SetGrid.SetImage(gridPicture, controller.image); SetGrid.SetImage(gridPlay, controller.image); }
private void Box_Click(object sender, RoutedEventArgs e, Box box, Grid gridPlay) { MoveEvent.Click(box); if (Checker.IsTrue(this, rows, cols)) { SetGrid.SetDefault(gridPlay); SetGrid.SetImage(gridPlay, image); } }
public async void Play(MatrixBox matrix_box, Grid gridPlay) { long[,] matrix = new long[3, 3]; for (long i = 0; i < 3; ++i) { for (long j = 0; j < 3; ++j) { matrix[i, j] = -1; } } for (long i = 0; i < 3; ++i) { for (long j = 0; j < 3; ++j) { if (i == 2 && j == 2) { break; } matrix[matrix_box.matrix[i, j].curr_row, matrix_box.matrix[i, j].curr_col] = i * 3 + j; } } for (long i = 0; i < 3; ++i) { for (long j = 0; j < 3; ++j) { if (matrix[i, j] == -1) { matrix[i, j] = 8; } } } long _curr = tree[ToInt(matrix)]; while (_curr != 0) { long _x = (_curr - 1) % 4; MoveEvent.Move(matrix_box, (-1) * X[_x], (-1) * Y[_x]); await Task.Delay(500); _curr = (_curr - 1) / 4; } SetGrid.SetDefault(gridPlay); SetGrid.SetImage(gridPlay, matrix_box.image); }
public void Select() { SelectImage select = new SelectImage(); if (select.image == null) { return; } image = select.image; matrix_box.image = image; if (matrix_box == null || Checker.IsTrue(matrix_box, rows, cols)) { Level(rows, cols); } else { matrix_image = new MatrixImage(image, rows, cols); matrix_image.Split(); matrix_box.matrix_image = matrix_image; matrix_box.Keep(); } SetGrid.SetImage(gridPicture, image); }