예제 #1
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);
        }
예제 #2
0
 /// <summary>
 /// Places a tile in the specified cell.
 /// </summary>
 /// <param name="player">The player.</param>
 /// <param name="letter">The letter.</param>
 /// <param name="cell">The cell.</param>
 /// <remarks></remarks>
 public void PlaceTile(Player player, string letter, Cell cell)
 {
     cell.Place(new Tile(letter, player));
 }
예제 #3
0
        /// <summary>
        /// Places a tile in the specified cell, given row and column.
        /// </summary>
        /// <param name="player">The player.</param>
        /// <param name="letter">The letter.</param>
        /// <param name="col">The col.</param>
        /// <param name="row">The row.</param>
        /// <remarks></remarks>
        public void PlaceTile(Player player, string letter, int col, int row)
        {
            Cell cell = Cells[col, row];

            cell.Place(new Tile(letter, player));
        }
예제 #4
0
 /// <summary>
 /// Places a tile in the specified cell.
 /// </summary>
 /// <param name="player">The player.</param>
 /// <param name="letter">The letter.</param>
 /// <param name="cell">The cell.</param>
 /// <remarks></remarks>
 public void PlaceTile(Player player, string letter, Cell cell)
 {
     cell.Place(new Tile(letter, player));
 }