Ejemplo n.º 1
0
        /// <summary>
        /// Новая игра
        /// </summary>
        public void NewGame()
        {
            IsAnimationGoing = false;
            GameField.StartNewGame();
            DefineAllImages();

            ButtonController = new ButtonsController();

            UpdatePointsLabel();
            Leaderboard.board.Deserialize();
            Leaderboard.UpdateInfo(GameField.Points);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Конструктор
        /// </summary>
        /// <param name="FieldGrid">Игровое поле</param>
        /// <param name="size">Размер игрового поля</param>
        public Visualizer(Grid FieldGrid, int size, Label pointsLabel, Label pointsCounterLabel)
        {
            GameFieldControl = FieldGrid;
            GameField        = new GameField(size);
            Points           = pointsLabel;
            PointsCounter    = pointsCounterLabel;
            ChosenSpell      = Spells.None;

            Images  = new MTImage[size, size];
            Buttons = new Button[size, size];

            ButtonController = new ButtonsController();
            Leaderboard      = new VisualLeaderboard();

            for (int x = 0; x < size; x++)
            {
                for (int y = 0; y < size; y++)
                {
                    Images[x, y] = new MTImage()
                    {
                        X      = x,
                        Y      = y,
                        figure = GameField.cells[x, y].figure
                    };
                    Buttons[x, y] = new Button()
                    {
                        Background = Brushes.Transparent
                    };
                    Buttons[x, y].Content = Images[x, y];
                    Buttons[x, y].Click  += CellClick;
                }
            }

            DefineAllImages();
            PrepareGrid();
        }