Beispiel #1
0
 private bool IsValidTile(Tile t)
 {
     return null == t.Gum;
 }
Beispiel #2
0
        private void AddGumToTile(Tile t)
        {
            Gum g = this._gQueue.ElementAt(0);
            this._gQueue.RemoveAt(0);

            t.AddGum(g);

            // TODO: Check for points
            matching();

            // Is Level Complete?
            if (this._gQueue.Count == 0)
            {
                //Show score for level
                int temp = this._curLevelScore + this._totalScore;
                MessageBox.Show("Level Complete. " + this._curLevelScore + " Points this level. " + temp + " Points total.");
                this.InitializeNextLevel();
            }

            // Is there still open tiles, or is it game over?
            bool gameOver = true;

            for (int i = 0; i < VisualTreeHelper.GetChildrenCount(this.Board.LayoutRoot); i++)
            {
                if (null == (VisualTreeHelper.GetChild(this.Board.LayoutRoot, i) as Tile).Gum)
                {
                    gameOver = false;
                    break;
                }
            }

            if (gameOver)
            {
                int temp = this._curLevelScore + this._totalScore;
                MessageBox.Show("Game Over. " + temp + " Points Total.");
                //TODO: Show score, return to main menu
            }
        }