Beispiel #1
0
 /// <summary>
 /// Places the specified tile in this cell.
 /// </summary>
 /// <param name="tile">The tile.</param>
 /// <remarks></remarks>
 public void Place(Tile tile)
 {
     contents = tile;
     IsEmpty = false;
 }
Beispiel #2
0
        /// <summary>
        /// Places a tile in the specified cell, given coordinates.
        /// If the cell already contains a tile it will not place the new one.
        /// This method is custom for the use with the Scrabble Referee system.
        /// </summary>
        /// <param name="player">The player.</param>
        /// <param name="letter">The letter.</param>
        /// <param name="x">The x.</param>
        /// <param name="y">The y.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="rect">The rect.</param>
        /// <remarks></remarks>
        public void PlaceTile(Player player, string letter, float x, float y, float width, float height, Rectangle rect)
        {
            Cell cell = GetCellAt(x, y, width, height);

            if (!cell.IsEmpty && cell.contents.IsPlaced) 
                return;

            if (!cell.IsEmpty && cell.contents.Rect.Width * cell.contents.Rect.Height > rect.Width * rect.Height) 
                return;

            Tile t = new Tile(letter, player);
            t.Rect = rect;
            cell.Place(t);
        }