|
|
@ -26,8 +26,8 @@ namespace MauiSpark.Pages
|
|
|
|
public IEnumerable<Classement> GetClassement(Func<Joueur, object> critereTri)
|
|
|
|
public IEnumerable<Classement> GetClassement(Func<Joueur, object> critereTri)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
IEnumerable<Joueur> joueursTries = NbClique % 2 == 0
|
|
|
|
IEnumerable<Joueur> joueursTries = NbClique % 2 == 0
|
|
|
|
? MauiProgram.Manageur.joueurs.OrderBy(critereTri)
|
|
|
|
? MauiProgram.Manageur.Joueurs.OrderBy(critereTri)
|
|
|
|
: MauiProgram.Manageur.joueurs.OrderByDescending(critereTri);
|
|
|
|
: MauiProgram.Manageur.Joueurs.OrderByDescending(critereTri);
|
|
|
|
|
|
|
|
|
|
|
|
NbClique++;
|
|
|
|
NbClique++;
|
|
|
|
|
|
|
|
|
|
|
@ -71,6 +71,7 @@ namespace MauiSpark.Pages
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
critereTri = joueur =>
|
|
|
|
critereTri = joueur =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
int totalParties = joueur.Statistique(regles, Statistique.PartiePerdue) +
|
|
|
|
int totalParties = joueur.Statistique(regles, Statistique.PartiePerdue) +
|
|
|
|
joueur.Statistique(regles, Statistique.PartieGagnee) +
|
|
|
|
joueur.Statistique(regles, Statistique.PartieGagnee) +
|
|
|
|
joueur.Statistique(regles, Statistique.PartieEgalite);
|
|
|
|
joueur.Statistique(regles, Statistique.PartieEgalite);
|
|
|
@ -80,7 +81,7 @@ namespace MauiSpark.Pages
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BindingContext = GetClassement(critereTri);
|
|
|
|
BindingContext = GetClassement(critereTri);
|
|
|
|
int a = 2;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -99,12 +100,21 @@ namespace MauiSpark.Pages
|
|
|
|
|
|
|
|
|
|
|
|
public int Place
|
|
|
|
public int Place
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get => manageur.joueurs
|
|
|
|
get => manageur.Joueurs
|
|
|
|
.OrderBy(critereTri)
|
|
|
|
.OrderBy(critereTri)
|
|
|
|
.ToList()
|
|
|
|
.ToList()
|
|
|
|
.IndexOf(joueur) + 1;
|
|
|
|
.IndexOf(joueur) + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public double NbCoupMoyen
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int totalParties = PartieEgalite + PartiePerdue + PartieGagnee;
|
|
|
|
|
|
|
|
return totalParties == 0 ? 0 : (double)joueur.Statistique(regles, Statistique.CoupJoue) / totalParties;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int PartieGagnee
|
|
|
|
public int PartieGagnee
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get => joueur.Statistique(regles, Statistique.PartieGagnee);
|
|
|
|
get => joueur.Statistique(regles, Statistique.PartieGagnee);
|
|
|
@ -118,18 +128,6 @@ namespace MauiSpark.Pages
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get => joueur.Statistique(regles, Statistique.PartieEgalite);
|
|
|
|
get => joueur.Statistique(regles, Statistique.PartieEgalite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public double NbCoupMoyen
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int totalParties = joueur.Statistique(regles, Statistique.PartiePerdue) +
|
|
|
|
|
|
|
|
joueur.Statistique(regles, Statistique.PartieGagnee) +
|
|
|
|
|
|
|
|
joueur.Statistique(regles, Statistique.PartieEgalite);
|
|
|
|
|
|
|
|
return totalParties == 0 ? 0 : (double)joueur.Statistique(regles, Statistique.CoupJoue) / totalParties;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Classement(Joueur joueur, Manageur manageur, Func<Joueur, object> critereTri, IRegles regles)
|
|
|
|
public Classement(Joueur joueur, Manageur manageur, Func<Joueur, object> critereTri, IRegles regles)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.manageur = manageur;
|
|
|
|
this.manageur = manageur;
|
|
|
|