示例#1
0
    void OnEnable()
    {
        if (!layersandtags)
        {
            layersandtags = ScriptableObject.CreateInstance <LayersAndTags>();
        }
        layerNames = layersandtags.editLayers(layerNames, ln2, indexLayers);
        tagNames   = layersandtags.getTags();

        if (!setGrid)
        {
            setGrid = ScriptableObject.CreateInstance <SetGrid>();
        }
        setGrid.LoadGrid();

        if (!grid && !GameObject.Find("Grid(Clone)"))
        {
            grid = Instantiate(setGrid.grid);
            g    = grid.GetComponent <Grid>();
        }
        else if (!grid)
        {
            grid = GameObject.Find("Grid(Clone)");
            g    = grid.GetComponent <Grid>();
        }
    }
示例#2
0
 public static void LoadSettings()
 {
     if (!Directory.Exists(BaseDir) && !File.Exists(BaseDir + "\\settings.json")) return;
     SettingsGrid = JsonConvert.DeserializeObject<SetGrid>(File.ReadAllText(BaseDir + "\\settings.json"));
     if (string.IsNullOrEmpty(SettingsGrid.Config))
         SettingsGrid.Config = Properties.Settings.Default.Config;
 }
示例#3
0
        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);
            }
        }
示例#4
0
 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);
 }
示例#5
0
 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);
     }
 }
示例#6
0
 public static void LoadSettings()
 {
     if (!Directory.Exists(BaseDir) && !File.Exists(BaseDir + "\\settings.json"))
     {
         return;
     }
     SettingsGrid = JsonConvert.DeserializeObject <SetGrid>(File.ReadAllText(BaseDir + "\\settings.json"));
     if (string.IsNullOrEmpty(SettingsGrid.Config))
     {
         SettingsGrid.Config = Properties.Settings.Default.Config;
     }
 }
示例#7
0
        public Arjunane SetGridCount(int how_many)
        {
            sg = new SetGrid
            {
                column = 0,
                row    = -1
            };

            // berapa jumlah perkalian (contoh dibawah ialah 3)
            how_many_grid = how_many;

            // number_grid perkalian (misal how_many = 3)
            // berarti grid 3, 6, 9
            number_grid = how_many;

            return(this);
        }
示例#8
0
        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);
        }
示例#9
0
        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);
        }
示例#10
0
 public void Fill(Grid gridPlay)
 {
     SetGrid.SetDefault(gridPlay);
     SetGrid.SetRowDef(gridPlay, rows);
     SetGrid.SetColumnDef(gridPlay, cols);
     for (int i = 0; i < rows; ++i)
     {
         for (int j = 0; j < cols; ++j)
         {
             int u = i, v = j;
             if (i == rows - 1 && j == cols - 1)
             {
                 break;
             }
             int r = shuffle_array[i * cols + j] / cols;
             int c = shuffle_array[i * cols + j] % cols;
             matrix[i, j] = new Box(matrix_image.Matrix[i, j], r, c, i, j);
             Grid.SetRow(matrix[i, j].box, r);
             Grid.SetColumn(matrix[i, j].box, c);
             matrix[i, j].box.Click += new RoutedEventHandler((sender, e) => Box_Click(sender, e, matrix[u, v], gridPlay));
             gridPlay.Children.Add(matrix[i, j].box);
         }
     }
 }