|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
@ -11,16 +12,18 @@ namespace QwirkleClassLibrary
|
|
|
|
|
public class Game
|
|
|
|
|
{
|
|
|
|
|
private TileBag bag;
|
|
|
|
|
private List<Player> players;
|
|
|
|
|
private bool gameRunning;
|
|
|
|
|
private Board board;
|
|
|
|
|
|
|
|
|
|
public ReadOnlyCollection<Player> PlayerList { get; private set; }
|
|
|
|
|
private readonly List<Player> players = new List<Player>();
|
|
|
|
|
|
|
|
|
|
public Game()
|
|
|
|
|
{
|
|
|
|
|
this.players = new List<Player>();
|
|
|
|
|
board = new Board();
|
|
|
|
|
bag = new TileBag(3);
|
|
|
|
|
gameRunning = false;
|
|
|
|
|
PlayerList = players.AsReadOnly();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool AddPlayerInGame(string? PlayerTag)
|
|
|
|
@ -80,17 +83,15 @@ namespace QwirkleClassLibrary
|
|
|
|
|
get { return players.Count; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<Tile> ListTilesBag
|
|
|
|
|
{
|
|
|
|
|
get { return bag.TilesInBag(); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// a passer en program cs
|
|
|
|
|
public string ShowTileOfPlayer(int posplayer)
|
|
|
|
|
{
|
|
|
|
|
List<Tile> tiles = players[posplayer].Tiles;
|
|
|
|
|
List<Tile> tiles = players[posplayer].Tiles.ToList();
|
|
|
|
|
|
|
|
|
|
string r = ("Tile of " + posplayer + " : ");
|
|
|
|
|
|
|
|
|
|
StringBuilder stringBuilder = new StringBuilder(); // A UTILISER !!!
|
|
|
|
|
|
|
|
|
|
foreach (Tile tile in tiles)
|
|
|
|
|
{
|
|
|
|
|
r = (r + " " + tile.NameColorTile());
|
|
|
|
@ -121,7 +122,7 @@ namespace QwirkleClassLibrary
|
|
|
|
|
{
|
|
|
|
|
for (int j = 0; j < 6; j++)
|
|
|
|
|
{
|
|
|
|
|
Tile tile = ListTilesBag[j];
|
|
|
|
|
Tile tile = bag.TilesBag[j];
|
|
|
|
|
players[i].AddTilePlayer(tile);
|
|
|
|
|
bag.RemoveTileInBag(tile);
|
|
|
|
|
}
|
|
|
|
|