Exemplo n.º 1
0
        public GameGrid()
        {
            this.InitializeComponent();

            this.SizeChanged += GameGrid_SizeChanged;

            _gameModel = new GameModel(_ROWS, _COLS);

            _underlyingTiles = new GameTile[_COLS][];

            for (int i = 0; i < _COLS; ++i)
            {
                _underlyingTiles[i] = new GameTile[_ROWS];
            }

            for (int y = 0; y < _ROWS; ++y)
            {
                for (int x = 0; x < _COLS; ++x)
                {
                    _underlyingTiles[x][y] = new GameTile(x, y);
                    _underlyingTiles[x][y].SetValue(Canvas.ZIndexProperty, 0);
                    GameCanvas.Children.Add(_underlyingTiles[x][y]);
                }
            }
            
            _scoreCard = new ScoreCard();
            _scoreCard.SetValue(Grid.RowProperty, 0);
            _scoreCard.SetValue(Grid.ColumnProperty, 0);
            ContentGrid.Children.Add(_scoreCard);

            _scoreCard.Score = 0;
            _scoreCard.Title = "SCORE";
            
            StartGame();
        }
Exemplo n.º 2
0
        public GameGrid()
        {
            this.InitializeComponent();

            this.SizeChanged += GameGrid_SizeChanged;

            _gameModel = new GameModel(_ROWS, _COLS);

            _underlyingTiles = new GameTile[_COLS][];

            for (int i = 0; i < _COLS; ++i)
            {
                _underlyingTiles[i] = new GameTile[_ROWS];
            }

            for (int y = 0; y < _ROWS; ++y)
            {
                for (int x = 0; x < _COLS; ++x)
                {
                    _underlyingTiles[x][y] = new GameTile(x, y);
                    _underlyingTiles[x][y].SetValue(Canvas.ZIndexProperty, 0);
                    GameCanvas.Children.Add(_underlyingTiles[x][y]);
                }
            }

            _scoreCard = new ScoreCard();
            _scoreCard.SetValue(Grid.RowProperty, 0);
            _scoreCard.SetValue(Grid.ColumnProperty, 0);
            ContentGrid.Children.Add(_scoreCard);

            _scoreCard.Score = 0;
            _scoreCard.Title = "SCORE";

            StartGame();
        }