Corrected some stuff for the class diagram
continuous-integration/drone/push Build is failing Details

test_old_branch
Jules LASCRET 11 months ago
parent 5a1ddf3bd7
commit 9cfb22166d

@ -2,11 +2,11 @@
{ {
public class AddPlayerNotifiedEventArgs : EventArgs public class AddPlayerNotifiedEventArgs : EventArgs
{ {
public string returnedNotified { get; private set; } public string ReturnedNotified { get; private set; }
public AddPlayerNotifiedEventArgs(string returnedNotified) public AddPlayerNotifiedEventArgs(string returnedNotified)
{ {
this.returnedNotified = returnedNotified; ReturnedNotified = returnedNotified;
} }
} }
} }

@ -4,11 +4,11 @@ namespace QwirkleClassLibrary.Events
{ {
public class EndOfGameNotifiedEventArgs public class EndOfGameNotifiedEventArgs
{ {
public Player player { get; private set; } public Player Player { get; private set; }
public EndOfGameNotifiedEventArgs(Player player) public EndOfGameNotifiedEventArgs(Player player)
{ {
this.player = player; this.Player = player;
} }
} }
} }

@ -4,11 +4,11 @@ namespace QwirkleClassLibrary.Events
{ {
public class NextPlayerNotifiedEventArgs : EventArgs public class NextPlayerNotifiedEventArgs : EventArgs
{ {
public Player player { get; private set; } public Player Player { get; private set; }
public NextPlayerNotifiedEventArgs(Player player) public NextPlayerNotifiedEventArgs(Player player)
{ {
this.player = player; this.Player = player;
} }
} }
} }

@ -4,14 +4,14 @@ namespace QwirkleClassLibrary.Events
{ {
public class PlaceTileNotifiedEventArgs : EventArgs public class PlaceTileNotifiedEventArgs : EventArgs
{ {
public Tile tile { get; private set; } public Tile Tile { get; private set; }
public string reason { get; private set; } public string Reason { get; private set; }
public PlaceTileNotifiedEventArgs(Tile tile, string reason) public PlaceTileNotifiedEventArgs(Tile tile, string reason)
{ {
this.tile = tile; this.Tile = tile;
this.reason = reason; this.Reason = reason;
} }
} }
} }

@ -10,27 +10,26 @@ namespace QwirkleClassLibrary.Players
{ {
public class Leaderboard public class Leaderboard
{ {
public ReadOnlyCollection<Score> LB => leaderb.AsReadOnly(); public ReadOnlyCollection<Score> Lb => leaderboard.AsReadOnly();
private readonly List<Score> leaderb = new(); private readonly List<Score> leaderboard = new();
public Leaderboard() { }
public int IsPlayerIn(Player player) public int IsPlayerIn(Player player)
{ {
for (int i = 0; i < leaderb.Count; i++) for (int i = 0; i < leaderboard.Count; i++)
{ {
if (player.NameTag == leaderb[i].PlayerName) if (player.NameTag == leaderboard[i].PlayerName)
{ {
return i; return i;
} }
} }
return -1; return -1;
} }
public void AddScoreInLead(ReadOnlyDictionary<Player, int> ScoreBoard)
public void AddScoreInLead(ReadOnlyDictionary<Player, int> scoreBoard)
{ {
DateTime now = DateTime.Today; DateTime now = DateTime.Today;
bool first = true; bool first = true;
var sb = ScoreBoard.OrderByDescending(x => x.Value).ThenBy(x => x.Key.NameTag); var sb = scoreBoard.OrderByDescending(x => x.Value).ThenBy(x => x.Key.NameTag);
foreach (KeyValuePair<Player, int> pair in sb) foreach (KeyValuePair<Player, int> pair in sb)
{ {
@ -39,14 +38,14 @@ namespace QwirkleClassLibrary.Players
if (i != -1) if (i != -1)
{ {
leaderb[i].Date = now; leaderboard[i].Date = now;
if (first) if (first)
{ {
leaderb[i].Victories++; leaderboard[i].Victories++;
} }
leaderb[i].Points = pair.Value; leaderboard[i].Points = pair.Value;
} }
else else
@ -57,7 +56,7 @@ namespace QwirkleClassLibrary.Players
v = 1; v = 1;
} }
Score score = new Score(pair.Key.NameTag, now, pair.Value, v); Score score = new Score(pair.Key.NameTag, now, pair.Value, v);
leaderb.Add(score); leaderboard.Add(score);
} }
first = false; first = false;

@ -14,7 +14,7 @@ namespace QwirkleConsoleApp
{ {
ForegroundColor = ConsoleColor.Yellow; ForegroundColor = ConsoleColor.Yellow;
WriteLine(); WriteLine();
WriteLine(args.returnedNotified); WriteLine(args.ReturnedNotified);
WriteLine(); WriteLine();
ResetColor(); ResetColor();
} }
@ -23,7 +23,7 @@ namespace QwirkleConsoleApp
{ {
ForegroundColor = ConsoleColor.Yellow; ForegroundColor = ConsoleColor.Yellow;
WriteLine(); WriteLine();
WriteLine(args.player.NameTag + "'s turn"); WriteLine(args.Player.NameTag + "'s turn");
WriteLine(); WriteLine();
ResetColor(); ResetColor();
} }
@ -32,7 +32,7 @@ namespace QwirkleConsoleApp
{ {
ForegroundColor = ConsoleColor.Magenta; ForegroundColor = ConsoleColor.Magenta;
WriteLine(); WriteLine();
WriteLine("The tile [" + args.tile.ToString() + "] " + args.reason); WriteLine("The tile [" + args.Tile.ToString() + "] " + args.Reason);
WriteLine(); WriteLine();
ResetColor(); ResetColor();
} }
@ -41,7 +41,7 @@ namespace QwirkleConsoleApp
{ {
ForegroundColor = ConsoleColor.Red; ForegroundColor = ConsoleColor.Red;
WriteLine(); WriteLine();
WriteLine("This end of game ! The last player is " + args.player.NameTag + " !"); WriteLine("This end of game ! The last player is " + args.Player.NameTag + " !");
WriteLine(); WriteLine();
ResetColor(); ResetColor();

@ -263,9 +263,9 @@ static void ShowLeaderboard(Leaderboard leaderboard)
WriteLine(" --------------------- THE LEADERBOARD : ---------------------"); WriteLine(" --------------------- THE LEADERBOARD : ---------------------");
WriteLine("Position : | PlayerTag : | Last Date : | Points : | Victories :"); WriteLine("Position : | PlayerTag : | Last Date : | Points : | Victories :");
for (int i=0; i<leaderboard.LB.Count; i++) for (int i=0; i<leaderboard.Lb.Count; i++)
{ {
WriteLine("[" + (i+1) + "] " + leaderboard.LB[i].ToString()); WriteLine("[" + (i+1) + "] " + leaderboard.Lb[i].ToString());
} }
WriteLine(); WriteLine();

Loading…
Cancel
Save