Début robot
continuous-integration/drone/push Build is failing Details

master
Céleste BARBOSA 11 months ago
parent b9dbd266bf
commit f7f4e0c3cb

@ -17,7 +17,7 @@ namespace ConsoleApp
/// <param name="e">L'instance de l'événement DemanderNomEventArgs créée par Partie.</param> /// <param name="e">L'instance de l'événement DemanderNomEventArgs créée par Partie.</param>
/// <returns>Le nom du joueur.</returns> /// <returns>Le nom du joueur.</returns>
/// </summary> /// </summary>
public static void DemanderNom(Object? sender, PartieDemanderJoueurEventArgs e) public static void DemanderNom(object? sender, PartieDemanderJoueurEventArgs e)
{ {
Console.WriteLine($"Joueur {e.Indice}"); Console.WriteLine($"Joueur {e.Indice}");
Console.Write(">>> "); Console.Write(">>> ");
@ -26,7 +26,10 @@ namespace ConsoleApp
Console.WriteLine(); Console.WriteLine();
e.JoueurDemande.SeConnecter(!string.IsNullOrEmpty(nom) ? Program.Manageur.DemanderJoueur(nom) : new Joueur($"Joueur {e.Indice}")); Joueur joueur = !string.IsNullOrEmpty(nom) ? Program.Manageur.DemanderJoueur(nom) : new Robot();
joueur.JoueurJouer += JoueurJouer;
e.JoueurDemande.SeConnecter(joueur);
} }
@ -35,46 +38,50 @@ namespace ConsoleApp
/// <param name="sender">La classe qui appelle l'événement; ici Partie.</param> /// <param name="sender">La classe qui appelle l'événement; ici Partie.</param>
/// <param name="e">L'instance de l'événement DebutPartieEventArgs créée par Partie.</param> /// <param name="e">L'instance de l'événement DebutPartieEventArgs créée par Partie.</param>
/// </summary> /// </summary>
public static void CommencerLaPartie(Object? sender, PartieDebutPartieEventArgs e) public static void CommencerLaPartie(object? sender, PartieDebutPartieEventArgs e)
{ {
Utils.DessinerSeparateur(); Utils.DessinerSeparateur();
Console.WriteLine("La partie commence, bonne chance à tous !\n"); Console.WriteLine("La partie commence, bonne chance à tous !\n");
} }
/// <summary> public static void JoueurJouer(object? sender, JoueurJouerEventArgs e)
/// Ecoute l'événement en rapport avec un nouveau tour.
/// <param name="sender">La classe qui appelle l'événement; ici Partie.</param>
/// <param name="e">L'instance de l'événement NouveauTourEventArgs créée par Partie.</param>
/// </summary>
public static void NouveauTour(Object? sender, PartieNouveauTourEventArgs e)
{ {
Utils.DessinerSeparateur(); Utils.DessinerSeparateur();
Console.WriteLine($"Tour {e.Tour} - {e.Joueur.Nom}\n"); Console.WriteLine($"{e.Nom} - Tour {e.Tour}\n");
(IReadOnlyList<IReadOnlyList<Jeton>> codes, IReadOnlyList<IReadOnlyList<Indicateur>> indicateurs) = e.Plateau.Grille;
Utils.DessinerPlateau(e.Plateau); Utils.DessinerPlateau(e.Plateau);
Console.WriteLine(); foreach(Jeton jeton in e.Code.Jetons)
Utils.DessinerPion(jeton.Couleur);
Code code = e.Code; while (!e.Code.Complet)
while(!code.Complet)
{ {
Jeton? jeton = Utils.SaisirJeton(code.Taille); Jeton? jeton = Utils.SaisirJeton(e.Code.Taille);
if (jeton.HasValue) if (jeton.HasValue)
{ {
e.Code.AjouterJeton(jeton.Value);
Utils.DessinerPion(jeton.Value.Couleur); Utils.DessinerPion(jeton.Value.Couleur);
code.AjouterJeton(jeton.Value);
} }
else else
{ {
e.Code.SupprimerDernierJeton();
Utils.SupprimerDernierJeton(); Utils.SupprimerDernierJeton();
code.SupprimerDernierJeton();
} }
} }
e.Plateau.AjouterCode(code); Console.WriteLine("\n");
if (!e.EstJoueur)
{
Task t = Task.Delay(1000);
t.GetAwaiter().GetResult();
}
e.Plateau.AjouterCode(e.Code);
} }
/// <summary> /// <summary>
@ -82,10 +89,8 @@ namespace ConsoleApp
/// <param name="sender">La classe qui appelle l'événement; ici Partie.</param> /// <param name="sender">La classe qui appelle l'événement; ici Partie.</param>
/// <param name="e">L'instance de l'événement AjouterCodeEventArgs créée par Partie.</param> /// <param name="e">L'instance de l'événement AjouterCodeEventArgs créée par Partie.</param>
/// </summary> /// </summary>
public static void AjouterCode(Object? sender, PartiePasserLaMainEventArgs e) public static void AjouterCode(object? sender, PartiePasserLaMainEventArgs e)
{ {
Console.WriteLine();
Utils.DessinerSeparateur(); Utils.DessinerSeparateur();
} }
@ -96,7 +101,7 @@ namespace ConsoleApp
/// </summary> /// </summary>
public static void PartieTerminee(Object? sender, PartiePartieTermineeEventArgs e) public static void PartieTerminee(Object? sender, PartiePartieTermineeEventArgs e)
{ {
Joueur[] gagnants = e.Gagnants.ToArray(); string[] gagnants = e.Gagnants.ToArray();
if (gagnants.Length > 1) if (gagnants.Length > 1)
{ {
@ -104,7 +109,7 @@ namespace ConsoleApp
} }
else if (gagnants.Length == 1) else if (gagnants.Length == 1)
{ {
Console.WriteLine($"C'est une victoire de {gagnants[0].Nom}."); Console.WriteLine($"C'est une victoire de {gagnants[0]}.");
} }
else else
{ {

@ -3,6 +3,7 @@ using CoreLibrary.Persistance;
using CoreLibrary.Regles; using CoreLibrary.Regles;
using CoreLibrary; using CoreLibrary;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using CoreLibrary.Joueurs;
namespace ConsoleApp namespace ConsoleApp
{ {
@ -23,7 +24,6 @@ namespace ConsoleApp
maPartie.PartieDemanderJoueur += Evenements.DemanderNom; maPartie.PartieDemanderJoueur += Evenements.DemanderNom;
maPartie.PartieDebutPartie += Evenements.CommencerLaPartie; maPartie.PartieDebutPartie += Evenements.CommencerLaPartie;
maPartie.PartieNouveauTour += Evenements.NouveauTour;
maPartie.PartiePasserLaMain += Evenements.AjouterCode; maPartie.PartiePasserLaMain += Evenements.AjouterCode;
maPartie.PartiePartieTerminee += Evenements.PartieTerminee; maPartie.PartiePartieTerminee += Evenements.PartieTerminee;

@ -1,4 +1,5 @@
using CoreLibrary.Exceptions; using CoreLibrary.Evenements;
using CoreLibrary.Exceptions;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Runtime.Serialization; using System.Runtime.Serialization;

@ -1,6 +0,0 @@
namespace CoreLibrary.Evenements
{
public class JoueurJoueCodeEventArgs : EventArgs
{
}
}

@ -0,0 +1,22 @@
using CoreLibrary.Core;
namespace CoreLibrary.Evenements
{
public class JoueurJouerEventArgs
{
public int Tour { get; private init; }
public string Nom { get; private init; }
public Plateau Plateau { get; private init; }
public Code Code { get; private init; }
public bool EstJoueur { get; private init; }
public JoueurJouerEventArgs(int tour, string nom, Plateau plateau, Code code, bool estJoueur)
{
Tour = tour;
Nom = nom;
Plateau = plateau;
Code = code;
EstJoueur = estJoueur;
}
}
}

@ -1,12 +1,14 @@
namespace CoreLibrary.Evenements using CoreLibrary.Joueurs;
namespace CoreLibrary.Evenements
{ {
public class JoueurSeConnecterEventArgs : EventArgs public class JoueurSeConnecterEventArgs : EventArgs
{ {
public string Nom { get; private init; } public Joueur Joueur { get; private init; }
public JoueurSeConnecterEventArgs(string nom) public JoueurSeConnecterEventArgs(Joueur joueur)
{ {
Nom = nom; Joueur = joueur;
} }
} }
} }

@ -0,0 +1,22 @@
using CoreLibrary.Core;
namespace CoreLibrary.Evenements
{
public class PartieDemanderJoueurJouerEventArgs : EventArgs
{
public int Tour { get; private init; }
public string Nom { get; private init; }
public Plateau Plateau { get; private init; }
public Code Code { get; private init; }
public bool EstJoueur { get; private init; }
public PartieDemanderJoueurJouerEventArgs(int tour, string nom, Plateau plateau, Code code, bool estJoueur)
{
Tour = tour;
Nom = nom;
Plateau = plateau;
Code = code;
EstJoueur = estJoueur;
}
}
}

@ -1,21 +0,0 @@
using CoreLibrary.Core;
using CoreLibrary.Joueurs;
namespace CoreLibrary.Evenements
{
public class PartieNouveauTourEventArgs : EventArgs
{
public int Tour { get; private init; }
public string Joueur { get; private init; }
public Plateau Plateau { get; private init; }
public Code Code { get; private init; }
public PartieNouveauTourEventArgs(int tour, string joueur, Plateau plateau, Code code)
{
Tour = tour;
Joueur = joueur;
Plateau = plateau;
Code = code;
}
}
}

@ -4,6 +4,7 @@ using CoreLibrary.Evenements;
using CoreLibrary.Regles; using CoreLibrary.Regles;
using CoreLibrary.Statistiques; using CoreLibrary.Statistiques;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using CoreLibrary.Core;
namespace CoreLibrary.Joueurs namespace CoreLibrary.Joueurs
{ {
@ -12,8 +13,10 @@ namespace CoreLibrary.Joueurs
public class Joueur : IEstPersistant public class Joueur : IEstPersistant
{ {
public event EventHandler<JoueurSeConnecterEventArgs>? JoueurSeConnecter; public event EventHandler<JoueurSeConnecterEventArgs>? JoueurSeConnecter;
public event EventHandler<JoueurJouerEventArgs>? JoueurJouer;
private void QuandJoueurSeConnecter() => JoueurSeConnecter?.Invoke(this, new JoueurSeConnecterEventArgs(Nom)); private void QuandJoueurSeConnecter(Joueur joueur) => JoueurSeConnecter?.Invoke(this, new JoueurSeConnecterEventArgs(joueur));
private void QuandJoueurJouer(int tour, string nom, Plateau plateau, Code code, bool estJoueur) => JoueurJouer?.Invoke(this, new JoueurJouerEventArgs(tour, nom, plateau, code, estJoueur));
[DataMember] [DataMember]
private Dictionary<(IRegles, Statistique), int> statistiques = new Dictionary<(IRegles, Statistique), int>(); private Dictionary<(IRegles, Statistique), int> statistiques = new Dictionary<(IRegles, Statistique), int>();
@ -31,18 +34,25 @@ namespace CoreLibrary.Joueurs
Nom = nom; Nom = nom;
} }
public Joueur SeConnecter(Joueur joueur) public void SeConnecter(Joueur joueur)
{ {
if (EstConnecte) if (EstConnecte)
throw new JoueurDejaConnecteException(this); throw new JoueurDejaConnecteException(this);
Nom = joueur.Nom; QuandJoueurSeConnecter(joueur);
statistiques = joueur.statistiques; }
EstConnecte = true;
QuandJoueurSeConnecter(); public void JouerPartie(Partie partie)
{
partie.PartieDemanderJoueurJouer += QuandDemanderJoueurJouer;
}
public virtual void QuandDemanderJoueurJouer(object? sender, PartieDemanderJoueurJouerEventArgs e)
{
if (e.Nom != Nom)
return;
return this; QuandJoueurJouer(e.Tour, e.Nom, e.Plateau, e.Code, e.EstJoueur);
} }
public override string ToString() => Nom; public override string ToString() => Nom;

@ -0,0 +1,26 @@
using CoreLibrary.Core;
using CoreLibrary.Evenements;
namespace CoreLibrary.Joueurs
{
public class Robot : Joueur
{
private static int nbRobots = 0;
public Robot() :
base($"Naps {++nbRobots}")
{
}
public override void QuandDemanderJoueurJouer(object? sender, PartieDemanderJoueurJouerEventArgs e)
{
if (e.Nom != Nom)
return;
while (!e.Code.Complet)
e.Code.AjouterJeton(new Jeton());
base.QuandDemanderJoueurJouer(sender, e);
}
}
}

@ -55,11 +55,11 @@ namespace CoreLibrary.Manageurs
{ {
partie.PartieDemanderJoueur += (sender, e) => Sauvegarder(); partie.PartieDemanderJoueur += (sender, e) => Sauvegarder();
partie.PartieDebutPartie += (sender, e) => Sauvegarder(); partie.PartieDebutPartie += (sender, e) => Sauvegarder();
partie.PartieNouveauTour += (sender, e) => Sauvegarder(); partie.PartieDemanderJoueurJouer += (sender, e) => Sauvegarder();
partie.PartiePasserLaMain += (sender, e) => partie.PartiePasserLaMain += (sender, e) =>
{ {
DemanderJoueur(e.Joueur).IncrementerStatistique(partie.Regles, Statistique.CoupJoue); DemanderJoueurExistant(e.Joueur)?.IncrementerStatistique(partie.Regles, Statistique.CoupJoue);
Sauvegarder(); Sauvegarder();
}; };
@ -67,23 +67,23 @@ namespace CoreLibrary.Manageurs
{ {
if (e.Gagnants.Count == 1) if (e.Gagnants.Count == 1)
{ {
DemanderJoueur(e.Gagnants[0]).IncrementerStatistique(partie.Regles, Statistique.PartieGagnee); DemanderJoueurExistant(e.Gagnants[0])?.IncrementerStatistique(partie.Regles, Statistique.PartieGagnee);
} }
else else
{ {
foreach (string gagnant in e.Gagnants) foreach (string gagnant in e.Gagnants)
DemanderJoueur(gagnant).IncrementerStatistique(partie.Regles, Statistique.PartieEgalite); DemanderJoueurExistant(gagnant)?.IncrementerStatistique(partie.Regles, Statistique.PartieEgalite);
} }
foreach (string perdant in e.Perdants) foreach (string perdant in e.Perdants)
{ {
DemanderJoueur(perdant).IncrementerStatistique(partie.Regles, Statistique.PartiePerdue); DemanderJoueurExistant(perdant)?.IncrementerStatistique(partie.Regles, Statistique.PartiePerdue);
} }
Sauvegarder(); Sauvegarder();
}; };
} }
public Joueur DemanderJoueur(string nom) private Joueur? DemanderJoueurExistant(string nom)
{ {
foreach (Joueur joueur in joueurs) foreach (Joueur joueur in joueurs)
{ {
@ -93,11 +93,19 @@ namespace CoreLibrary.Manageurs
} }
} }
Joueur nouveauJoueur = new Joueur(nom); return null;
}
joueurs.Add(nouveauJoueur); public Joueur DemanderJoueur(string nom)
{
Joueur? joueur = DemanderJoueurExistant(nom);
if (joueur == null)
{
joueur = new Joueur(nom);
joueurs.Add(joueur);
}
return nouveauJoueur; return joueur;
} }
} }
} }

@ -13,24 +13,24 @@ namespace CoreLibrary
{ {
public event EventHandler<PartieDemanderJoueurEventArgs>? PartieDemanderJoueur; public event EventHandler<PartieDemanderJoueurEventArgs>? PartieDemanderJoueur;
public event EventHandler<PartieDebutPartieEventArgs>? PartieDebutPartie; public event EventHandler<PartieDebutPartieEventArgs>? PartieDebutPartie;
public event EventHandler<PartieNouveauTourEventArgs>? PartieNouveauTour; public event EventHandler<PartieDemanderJoueurJouerEventArgs>? PartieDemanderJoueurJouer;
public event EventHandler<PartiePasserLaMainEventArgs>? PartiePasserLaMain; public event EventHandler<PartiePasserLaMainEventArgs>? PartiePasserLaMain;
public event EventHandler<PartiePartieTermineeEventArgs>? PartiePartieTerminee; public event EventHandler<PartiePartieTermineeEventArgs>? PartiePartieTerminee;
private void QuandPartieDemanderJoueur(Joueur joueurDemande) => PartieDemanderJoueur?.Invoke(this, new PartieDemanderJoueurEventArgs(joueurs.Count + 1, joueurDemande)); private void QuandPartieDemanderJoueur(Joueur joueurDemande) => PartieDemanderJoueur?.Invoke(this, new PartieDemanderJoueurEventArgs(joueurs.Count + 1, joueurDemande));
private void QuandPartieDebutPartie() => PartieDebutPartie?.Invoke(this, new PartieDebutPartieEventArgs()); private void QuandPartieDebutPartie() => PartieDebutPartie?.Invoke(this, new PartieDebutPartieEventArgs());
private void QuandPartieNouveauTour() => PartieNouveauTour?.Invoke(this, new PartieNouveauTourEventArgs(Tour, joueurs.ElementAt(courant), plateaux.ElementAt(courant), new Code(Regles.TailleCode))); private void QuandPartieDemanderJoueurJouer() => PartieDemanderJoueurJouer?.Invoke(this, new PartieDemanderJoueurJouerEventArgs(Tour, Joueurs.ElementAt(courant), plateaux.ElementAt(courant), new Code(Regles.TailleCode), joueurs[Joueurs.ElementAt(courant)]));
private void QuandPartiePasserLaMain() => PartiePasserLaMain?.Invoke(this, new PartiePasserLaMainEventArgs(joueurs.ElementAt(courant))); private void QuandPartiePasserLaMain() => PartiePasserLaMain?.Invoke(this, new PartiePasserLaMainEventArgs(Joueurs.ElementAt(courant)));
private void QuandPartiePartieTerminee(IReadOnlyList<string> gagnants, IReadOnlyList<string> perdants) => PartiePartieTerminee?.Invoke(this, new PartiePartieTermineeEventArgs(gagnants, perdants)); private void QuandPartiePartieTerminee(IReadOnlyList<string> gagnants, IReadOnlyList<string> perdants) => PartiePartieTerminee?.Invoke(this, new PartiePartieTermineeEventArgs(gagnants, perdants));
[DataMember] [DataMember]
private readonly List<string> joueurs = new List<string>(); private readonly Dictionary<string, bool> joueurs = new Dictionary<string, bool>();
[DataMember] [DataMember]
private readonly List<Plateau> plateaux = new List<Plateau>(); private readonly List<Plateau> plateaux = new List<Plateau>();
[DataMember] [DataMember]
private int courant = 0; private int courant = 0;
public IReadOnlyList<string> Joueurs => joueurs; public IReadOnlyList<string> Joueurs => joueurs.Keys.ToList();
[DataMember] [DataMember]
public bool Termine { get; private set; } = false; public bool Termine { get; private set; } = false;
[DataMember] [DataMember]
@ -54,7 +54,7 @@ namespace CoreLibrary
partie.PartieDemanderJoueur = null; partie.PartieDemanderJoueur = null;
partie.PartieDebutPartie = null; partie.PartieDebutPartie = null;
partie.PartieNouveauTour = null; partie.PartieDemanderJoueurJouer = null;
partie.PartiePasserLaMain = null; partie.PartiePasserLaMain = null;
partie.PartiePartieTerminee = null; partie.PartiePartieTerminee = null;
} }
@ -77,9 +77,11 @@ namespace CoreLibrary
private void JoueurConnecte(object? sender, JoueurSeConnecterEventArgs e) private void JoueurConnecte(object? sender, JoueurSeConnecterEventArgs e)
{ {
joueurs.Add(e.Nom); joueurs.Add(e.Joueur.Nom, e.Joueur.GetType().Equals(typeof(Joueur)));
plateaux.Add(new Plateau(Regles.TailleCode, Regles.NbTour)); plateaux.Add(new Plateau(Regles.TailleCode, Regles.NbTour));
e.Joueur.JouerPartie(this);
if (joueurs.Count < Regles.NbJoueurs) if (joueurs.Count < Regles.NbJoueurs)
{ {
DemanderJoueur(); DemanderJoueur();
@ -107,7 +109,7 @@ namespace CoreLibrary
private void NouveauTour() private void NouveauTour()
{ {
QuandPartieNouveauTour(); QuandPartieDemanderJoueurJouer();
} }
private void PlateauAjouterCode(object? sender, PlateauAjouterCodeEventArgs e) private void PlateauAjouterCode(object? sender, PlateauAjouterCodeEventArgs e)
@ -142,9 +144,9 @@ namespace CoreLibrary
for (int i = 0; i < joueurs.Count; ++i) for (int i = 0; i < joueurs.Count; ++i)
{ {
if (plateaux.ElementAt(i).Victoire) if (plateaux.ElementAt(i).Victoire)
gagnants.Add(joueurs[i]); gagnants.Add(Joueurs[i]);
else else
perdants.Add(joueurs[i]); perdants.Add(Joueurs[i]);
} }
QuandPartiePartieTerminee(gagnants, perdants); QuandPartiePartieTerminee(gagnants, perdants);

@ -1,46 +1,59 @@
[ [
{ {
"Nom": "Céleste", "Nom": "a",
"statistiques": [ "statistiques": [
{ {
"Key": { "Key": {
"Item1": { "Item1": {
"__type": "ReglesClassiques:#CoreLibrary.Regles" "__type": "ReglesClassiques:#CoreLibrary.Regles"
}, },
"Item2": 3 "Item2": 3
}, },
"Value": 2 "Value": 2
} }
] ]
}, },
{ {
"Nom": "Pauline", "Nom": "Céleste",
"statistiques": [ "statistiques": [
{ {
"Key": { "Key": {
"Item1": { "Item1": {
"__type": "ReglesClassiques:#CoreLibrary.Regles" "__type": "ReglesClassiques:#CoreLibrary.Regles"
}, },
"Item2": 3 "Item2": 3
}, },
"Value": 2 "Value": 30
} },
] {
}, "Key": {
{ "Item1": {
"Nom": "a", "__type": "ReglesClassiques:#CoreLibrary.Regles"
"statistiques": [ ] },
}, "Item2": 1
{ },
"Nom": "b", "Value": 2
"statistiques": [ ] }
}, ]
{ },
"Nom": "e", {
"statistiques": [ ] "Nom": "C",
}, "statistiques": [ ]
{ },
"Nom": "f", {
"statistiques": [ ] "Nom": "Pauline",
} "statistiques": [ ]
},
{
"Nom": "b",
"statistiques": [ ]
},
{
"Nom": "A",
"statistiques": [ ]
},
{
"Nom": "B",
"statistiques": [ ]
}
] ]

File diff suppressed because it is too large Load Diff

@ -32,6 +32,8 @@ namespace MauiSpark.Pages
return ((Enfant)obj).Joueur.Equals(Joueur); return ((Enfant)obj).Joueur.Equals(Joueur);
} }
public override int GetHashCode() => Joueur.GetHashCode();
} }
partial class Classement : INotifyPropertyChanged partial class Classement : INotifyPropertyChanged
@ -43,7 +45,7 @@ namespace MauiSpark.Pages
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nomPropriete)); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nomPropriete));
} }
private Dictionary<string, IComparer<Enfant>> Tris => new Dictionary<string, IComparer<Enfant>> { private static Dictionary<string, IComparer<Enfant>> Tris => new Dictionary<string, IComparer<Enfant>> {
{ "Nom", Comparer<Enfant>.Create((enfant1, enfant2) => string.Compare(enfant1.Joueur.Nom, enfant2.Joueur.Nom)) }, { "Nom", Comparer<Enfant>.Create((enfant1, enfant2) => string.Compare(enfant1.Joueur.Nom, enfant2.Joueur.Nom)) },
{ "CoupMoyen", Comparer<Enfant>.Create((enfant1, enfant2) => enfant2.NbCoupMoyen - enfant1.NbCoupMoyen) }, { "CoupMoyen", Comparer<Enfant>.Create((enfant1, enfant2) => enfant2.NbCoupMoyen - enfant1.NbCoupMoyen) },
{ "Gagnee", Comparer<Enfant>.Create((enfant1, enfant2) => enfant2.PartieGagnee - enfant1.PartieGagnee) }, { "Gagnee", Comparer<Enfant>.Create((enfant1, enfant2) => enfant2.PartieGagnee - enfant1.PartieGagnee) },
@ -63,6 +65,7 @@ namespace MauiSpark.Pages
QuandProprieteChangee(nameof(Enfants)); QuandProprieteChangee(nameof(Enfants));
} }
} }
private bool inverser = false; private bool inverser = false;
public bool Inverser public bool Inverser
{ {
@ -76,6 +79,7 @@ namespace MauiSpark.Pages
QuandProprieteChangee(nameof(Enfants)); QuandProprieteChangee(nameof(Enfants));
} }
} }
private IRegles regles = new ReglesClassiques(); private IRegles regles = new ReglesClassiques();
public IRegles Regles public IRegles Regles
{ {
@ -89,6 +93,7 @@ namespace MauiSpark.Pages
QuandProprieteChangee(nameof(Enfants)); QuandProprieteChangee(nameof(Enfants));
} }
} }
public IComparer<Enfant> Tri => Tris.GetValueOrDefault(TypeTri) ?? Tris["CoupMoyen"]; public IComparer<Enfant> Tri => Tris.GetValueOrDefault(TypeTri) ?? Tris["CoupMoyen"];
public IEnumerable<Enfant> Enfants => Inverser ? public IEnumerable<Enfant> Enfants => Inverser ?
MauiProgram.Manageur.Joueurs.Select(joueur => new Enfant(joueur, this)).Order(Tri).Reverse() : MauiProgram.Manageur.Joueurs.Select(joueur => new Enfant(joueur, this)).Order(Tri).Reverse() :

Loading…
Cancel
Save