Exemple #1
0
        private void StepGame(int index)
        {
            BlockDocuField field = Fields[index];
            int            i     = field.X;
            int            j     = field.Y;

            if ((i == 4 && j == 5) || (i == 4 && j == 4) || (i == 5 && j == 5) || (i == 5 && j == 4))
            {
                return;
            }
            if (((i == 0 || i == 1 || i == 2 || i == 3) && (j == 4 || j == 5)) || ((i == 4 || i == 5) && (j == 0 || j == 1 || j == 2 || j == 3)))
            {
                return;
            }
            Debug.Write(i + " " + j + "\n");

            _model.Step(field.X, field.Y);
            _model.Check();

            RefreshTable();
            //
            //field.Text = _model.Table[field.X, field.Y] > 0 ? _model.Table[field.X, field.Y].ToString() : String.Empty; // visszaírjuk a szöveget
            //
            //field.Text = !_model.Table.IsEmpty(field.X, field.Y) ? _model.Table[field.X, field.Y].ToString() : String.Empty;
        }
        private void ButtonGrid_MouseClick(object sender, MouseEventArgs e)
        {
            Int32 x = ((sender as Button).TabIndex - 100) / _model.Table.Size;
            Int32 y = ((sender as Button).TabIndex - 100) % _model.Table.Size;
            int   i = x;
            int   j = y;

            if ((i == 4 && j == 5) || (i == 4 && j == 4) || (i == 5 && j == 5) || (i == 5 && j == 4))
            {
                return;
            }
            if (((i == 0 || i == 1 || i == 2 || i == 3) && (j == 4 || j == 5)) || ((i == 4 || i == 5) && (j == 0 || j == 1 || j == 2 || j == 3)))
            {
                return;
            }
            Debug.Write(i + " " + j + "\n");

            _model.Step(i, j);
            _model.Check();

            SetupTable();
        }