|
|
@ -317,6 +317,11 @@ namespace QwirkleClassLibrary.Games
|
|
|
|
/// <returns>bool</returns>
|
|
|
|
/// <returns>bool</returns>
|
|
|
|
public bool PlaceTile(Player player, Tile tile, int x, int y)
|
|
|
|
public bool PlaceTile(Player player, Tile tile, int x, int y)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if(!TileInbag(player, tile))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
OnPlaceTile(new PlaceTileNotifiedEventArgs(tile, "you cant play"));
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (!IsMoveCorrect(tile, x, y, board!)) return false;
|
|
|
|
if (!IsMoveCorrect(tile, x, y, board!)) return false;
|
|
|
|
if (board!.AddTileInCell(x, y, tile))
|
|
|
|
if (board!.AddTileInCell(x, y, tile))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -328,6 +333,18 @@ namespace QwirkleClassLibrary.Games
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public bool TileInbag(Player player, Tile tile)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for (int i = 0; i < player.Tiles.Count; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Tile? t = player.Tiles[i];
|
|
|
|
|
|
|
|
if (Object.ReferenceEquals(t, tile)) return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Allows a player to draw tiles from the bag as soon as he has less than 6 tiles
|
|
|
|
/// Allows a player to draw tiles from the bag as soon as he has less than 6 tiles
|
|
|
@ -494,7 +511,7 @@ namespace QwirkleClassLibrary.Games
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (b.GetCell(x, y)!.Tile == null)
|
|
|
|
if (b.GetCell(x, y)!.Tile != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
OnPlaceTile(new PlaceTileNotifiedEventArgs(t, " : Cell already used !"));
|
|
|
|
OnPlaceTile(new PlaceTileNotifiedEventArgs(t, " : Cell already used !"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|