|
|
|
@ -9,21 +9,21 @@ using System.Xml.Linq;
|
|
|
|
|
|
|
|
|
|
namespace QwirkleClassLibrary
|
|
|
|
|
{
|
|
|
|
|
public class Game : IPlayer
|
|
|
|
|
public class Game
|
|
|
|
|
{
|
|
|
|
|
private TileBag bag;
|
|
|
|
|
private bool gameRunning;
|
|
|
|
|
private Board board;
|
|
|
|
|
|
|
|
|
|
public ReadOnlyCollection<Player> PlayerList { get; private set; }
|
|
|
|
|
private readonly List<Player> players;
|
|
|
|
|
private readonly List<Player> players = new List<Player>();
|
|
|
|
|
|
|
|
|
|
public Game()
|
|
|
|
|
{
|
|
|
|
|
board = new Board();
|
|
|
|
|
bag = new TileBag(3);
|
|
|
|
|
|
|
|
|
|
players = new List<Player>();
|
|
|
|
|
Console.Write(bag.TilesBag.Count);
|
|
|
|
|
gameRunning = false;
|
|
|
|
|
PlayerList = players.AsReadOnly();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -43,7 +43,7 @@ namespace QwirkleClassLibrary
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < players.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (players[i].NameTag == PlayerTag)
|
|
|
|
|
if (players[i].GetNameTag == PlayerTag)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -55,12 +55,6 @@ namespace QwirkleClassLibrary
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Player CreatePlayer(string playerTag)
|
|
|
|
|
{
|
|
|
|
|
var player = new Player(playerTag);
|
|
|
|
|
return player;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool StartGame()
|
|
|
|
|
{
|
|
|
|
|
if (players.Count < 2)
|
|
|
|
@ -72,6 +66,7 @@ namespace QwirkleClassLibrary
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int GetPlayingPlayerPosition()
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < players.Count; i++)
|
|
|
|
@ -97,6 +92,7 @@ namespace QwirkleClassLibrary
|
|
|
|
|
|
|
|
|
|
public void SetNextPlayer(int old, int neew)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (old >= 0 || old != -1)
|
|
|
|
|
{
|
|
|
|
|
players[old].IsPlaying = false;
|
|
|
|
@ -133,7 +129,7 @@ namespace QwirkleClassLibrary
|
|
|
|
|
|
|
|
|
|
SetNextPlayer(posPlayerPlay, posPlayerNextPlay);
|
|
|
|
|
|
|
|
|
|
return (players[posPlayerNextPlay].NameTag);
|
|
|
|
|
return (players[posPlayerNextPlay].GetNameTag);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool GameRunning
|
|
|
|
@ -157,26 +153,6 @@ namespace QwirkleClassLibrary
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetNextPlayer(List<Player> playersList)
|
|
|
|
|
{
|
|
|
|
|
for(int i = 0; i < PlayerList.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (PlayerList[i].IsPlaying != true) continue;
|
|
|
|
|
|
|
|
|
|
PlayerList[i].IsPlaying = false;
|
|
|
|
|
PlayerList[(i + 1) % PlayerList.Count].IsPlaying = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void PlaceTile(Player player, Tile tile, int x, int y)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool ContinueToPlay()
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|