push now push npow
continuous-integration/drone/push Build is passing Details

test_old_branch
Jérémy Mouyon 11 months ago
parent 8724cc88ed
commit fb6773e40a

@ -13,7 +13,8 @@ namespace QwirkleClassLibrary
public class Game : IPlayer, IRules public class Game : IPlayer, IRules
{ {
private Dictionary<Player, int> scoreBoard = new(); public ReadOnlyDictionary<Player, int> ScoreBoard => scoreBoard.AsReadOnly();
private readonly Dictionary<Player, int> scoreBoard = new();
private TileBag bag; private TileBag bag;
public bool GameRunning { get; private set; } public bool GameRunning { get; private set; }
@ -78,7 +79,6 @@ namespace QwirkleClassLibrary
} }
players.Add(CreatePlayer(playerTag)); players.Add(CreatePlayer(playerTag));
//scores.Add(new Score(players[players.Count-1]));
OnPlayerNotified(new AddPlayerNotifiedEventArgs("Player was correctly added")); OnPlayerNotified(new AddPlayerNotifiedEventArgs("Player was correctly added"));
return true; return true;
} }
@ -125,7 +125,7 @@ namespace QwirkleClassLibrary
{ {
if(GetPlayingPlayerPosition() == -1) if(GetPlayingPlayerPosition() == -1)
{ {
throw new ArgumentException(); throw new ArgumentException("No player play.");
} }
return players[GetPlayingPlayerPosition()]; return players[GetPlayingPlayerPosition()];
} }
@ -166,7 +166,7 @@ namespace QwirkleClassLibrary
if (GameRunning) if (GameRunning)
{ {
players[0].IsPlaying = true; players[0].IsPlaying = true;
//OnNextPlayer(new NextPlayerNotifiedEventArgs(players[0])); OnNextPlayer(new NextPlayerNotifiedEventArgs(players[0]));
return players[0].NameTag; return players[0].NameTag;
} }
else else

@ -204,11 +204,11 @@ static void MainMenu(Game game)
WriteLine("Game is starting !"); WriteLine("Game is starting !");
Console.ResetColor(); Console.ResetColor();
NotificationClass nc = new NotificationClass();
game.NextPlayerNotified += nc.NotificationNextPlayer;
do do
{ {
NotificationClass nc = new NotificationClass();
game.NextPlayerNotified += nc.NotificationNextPlayer;
game.SetNextPlayer(); game.SetNextPlayer();
WriteLine(" --------------------- GAME ! ------------------------"); WriteLine(" --------------------- GAME ! ------------------------");
@ -216,6 +216,8 @@ static void MainMenu(Game game)
game.DrawTiles(game.GetPlayingPlayer()); game.DrawTiles(game.GetPlayingPlayer());
MenuSwitch(game); MenuSwitch(game);
game.NextPlayerNotified -= nc.NotificationNextPlayer;
} while (game.IsGameOver()); } while (game.IsGameOver());
} }

Loading…
Cancel
Save