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 string returnedNotified { get; private set; }
public string ReturnedNotified { get; private set; }
public AddPlayerNotifiedEventArgs(string returnedNotified)
{
this.returnedNotified = returnedNotified;
ReturnedNotified = returnedNotified;
}
}
}

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

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

@ -4,14 +4,14 @@ namespace QwirkleClassLibrary.Events
{
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)
{
this.tile = tile;
this.reason = reason;
this.Tile = tile;
this.Reason = reason;
}
}
}

@ -10,27 +10,26 @@ namespace QwirkleClassLibrary.Players
{
public class Leaderboard
{
public ReadOnlyCollection<Score> LB => leaderb.AsReadOnly();
private readonly List<Score> leaderb = new();
public Leaderboard() { }
public ReadOnlyCollection<Score> Lb => leaderboard.AsReadOnly();
private readonly List<Score> leaderboard = new();
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 -1;
}
public void AddScoreInLead(ReadOnlyDictionary<Player, int> ScoreBoard)
public void AddScoreInLead(ReadOnlyDictionary<Player, int> scoreBoard)
{
DateTime now = DateTime.Today;
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)
{
@ -39,14 +38,14 @@ namespace QwirkleClassLibrary.Players
if (i != -1)
{
leaderb[i].Date = now;
leaderboard[i].Date = now;
if (first)
{
leaderb[i].Victories++;
leaderboard[i].Victories++;
}
leaderb[i].Points = pair.Value;
leaderboard[i].Points = pair.Value;
}
else
@ -57,7 +56,7 @@ namespace QwirkleClassLibrary.Players
v = 1;
}
Score score = new Score(pair.Key.NameTag, now, pair.Value, v);
leaderb.Add(score);
leaderboard.Add(score);
}
first = false;

@ -14,7 +14,7 @@ namespace QwirkleConsoleApp
{
ForegroundColor = ConsoleColor.Yellow;
WriteLine();
WriteLine(args.returnedNotified);
WriteLine(args.ReturnedNotified);
WriteLine();
ResetColor();
}
@ -23,7 +23,7 @@ namespace QwirkleConsoleApp
{
ForegroundColor = ConsoleColor.Yellow;
WriteLine();
WriteLine(args.player.NameTag + "'s turn");
WriteLine(args.Player.NameTag + "'s turn");
WriteLine();
ResetColor();
}
@ -32,7 +32,7 @@ namespace QwirkleConsoleApp
{
ForegroundColor = ConsoleColor.Magenta;
WriteLine();
WriteLine("The tile [" + args.tile.ToString() + "] " + args.reason);
WriteLine("The tile [" + args.Tile.ToString() + "] " + args.Reason);
WriteLine();
ResetColor();
}
@ -41,7 +41,7 @@ namespace QwirkleConsoleApp
{
ForegroundColor = ConsoleColor.Red;
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();
ResetColor();

@ -263,9 +263,9 @@ static void ShowLeaderboard(Leaderboard leaderboard)
WriteLine(" --------------------- THE LEADERBOARD : ---------------------");
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();

Loading…
Cancel
Save