From 19f0e016b720f928f9780fa78abc53a0d8a4f372 Mon Sep 17 00:00:00 2001 From: "nicolas.barbosa" Date: Sat, 25 May 2024 10:12:59 +0200 Subject: [PATCH 1/2] ajout de plateau --- Sources/MauiSpark/MauiSpark.csproj | 3 ++ Sources/MauiSpark/Pages/Plateau.xaml | 11 ++++++ Sources/MauiSpark/Pages/Plateau.xaml.cs | 9 +++++ Sources/MauiSpark/Views/CTableauScore.xaml | 2 +- Sources/MauiSpark/Views/CTableauScore.xaml.cs | 34 ++++++++----------- 5 files changed, 39 insertions(+), 20 deletions(-) create mode 100644 Sources/MauiSpark/Pages/Plateau.xaml create mode 100644 Sources/MauiSpark/Pages/Plateau.xaml.cs diff --git a/Sources/MauiSpark/MauiSpark.csproj b/Sources/MauiSpark/MauiSpark.csproj index 01cba09..f180fbb 100644 --- a/Sources/MauiSpark/MauiSpark.csproj +++ b/Sources/MauiSpark/MauiSpark.csproj @@ -79,6 +79,9 @@ MSBuild:Compile + + MSBuild:Compile + MSBuild:Compile diff --git a/Sources/MauiSpark/Pages/Plateau.xaml b/Sources/MauiSpark/Pages/Plateau.xaml new file mode 100644 index 0000000..2ffcd6c --- /dev/null +++ b/Sources/MauiSpark/Pages/Plateau.xaml @@ -0,0 +1,11 @@ + + + + + + + + \ No newline at end of file diff --git a/Sources/MauiSpark/Pages/Plateau.xaml.cs b/Sources/MauiSpark/Pages/Plateau.xaml.cs new file mode 100644 index 0000000..8ed32c8 --- /dev/null +++ b/Sources/MauiSpark/Pages/Plateau.xaml.cs @@ -0,0 +1,9 @@ +namespace MauiSpark.Pages; + +public partial class Plateau : ContentPage +{ + public Plateau() + { + InitializeComponent(); + } +} \ No newline at end of file diff --git a/Sources/MauiSpark/Views/CTableauScore.xaml b/Sources/MauiSpark/Views/CTableauScore.xaml index 684ab52..01cdf7a 100644 --- a/Sources/MauiSpark/Views/CTableauScore.xaml +++ b/Sources/MauiSpark/Views/CTableauScore.xaml @@ -1,4 +1,4 @@ - + diff --git a/Sources/MauiSpark/Views/CTableauScore.xaml.cs b/Sources/MauiSpark/Views/CTableauScore.xaml.cs index 5f7430e..5bdde19 100644 --- a/Sources/MauiSpark/Views/CTableauScore.xaml.cs +++ b/Sources/MauiSpark/Views/CTableauScore.xaml.cs @@ -1,12 +1,8 @@ -using CoreLibrary.Events; using CoreLibrary.Joueurs; using CoreLibrary.Manager; -using System.Collections.ObjectModel; -using System.ComponentModel; -using System.Runtime.CompilerServices; - -namespace MauiSpark.Views; - + +namespace MauiSpark.Views; + public class JoueurClassementNbCoupParPartie { private Manager manager; @@ -31,8 +27,8 @@ public class JoueurClassementNbCoupParPartie this.manager = manager; this.joueur = joueur; } -} - +} + public class JoueurClassementPartieGagnee { private Manager manager; @@ -56,8 +52,8 @@ public class JoueurClassementPartieGagnee this.manager = manager; this.joueur = joueur; } -} - +} + public class JoueurClassementPartieEgalite { private Manager manager; @@ -81,8 +77,8 @@ public class JoueurClassementPartieEgalite this.manager = manager; this.joueur = joueur; } -} - +} + public class JoueurClassementPartiePerdue { private Manager manager; @@ -135,7 +131,7 @@ public class JoueurClassementAlphabet } } - public partial class CTableauScore : ContentView +public partial class CTableauScore : ContentView { public IEnumerable GetClassementNbCoupParPartie() { @@ -179,13 +175,13 @@ public class JoueurClassementAlphabet } - public CTableauScore() - { - InitializeComponent(); + public CTableauScore() + { + InitializeComponent(); } - + public void UpdateClassement(Func> getClassement) { BindingContext = getClassement(); - } + } } \ No newline at end of file From 75a3f25d60d36f4035218704adca919673a869ba Mon Sep 17 00:00:00 2001 From: "nicolas.barbosa" Date: Sat, 25 May 2024 10:54:39 +0200 Subject: [PATCH 2/2] =?UTF-8?q?d=C3=A9but=20du=20plateau?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/CoreLibrary/Manager/Manager.cs | 9 ++++++ Sources/CoreLibrary/Partie.cs | 2 +- Sources/MauiSpark/AppShell.xaml | 4 +++ Sources/MauiSpark/MauiProgram.cs | 6 +++- Sources/MauiSpark/Pages/Plateau.xaml | 37 +++++++++++++++++++++---- Sources/MauiSpark/Pages/Plateau.xaml.cs | 10 ++++++- 6 files changed, 60 insertions(+), 8 deletions(-) diff --git a/Sources/CoreLibrary/Manager/Manager.cs b/Sources/CoreLibrary/Manager/Manager.cs index 55ad615..48ec4af 100644 --- a/Sources/CoreLibrary/Manager/Manager.cs +++ b/Sources/CoreLibrary/Manager/Manager.cs @@ -1,4 +1,5 @@ using CoreLibrary.Joueurs; +using CoreLibrary; using CoreLibrary.Regles; namespace CoreLibrary.Manager @@ -8,6 +9,14 @@ namespace CoreLibrary.Manager private Joueur[] joueurs = []; public IReadOnlyList Joueurs => Array.AsReadOnly(joueurs); + + public Partie Partie { get; private set; } + + public Manager() + { + Partie = new Partie(new ReglesClassiques()); + } + public void Charger() { joueurs = [ diff --git a/Sources/CoreLibrary/Partie.cs b/Sources/CoreLibrary/Partie.cs index c56a8bd..0699b67 100644 --- a/Sources/CoreLibrary/Partie.cs +++ b/Sources/CoreLibrary/Partie.cs @@ -10,7 +10,7 @@ namespace CoreLibrary /// public class Partie { - private readonly IRegles regles; + public IRegles Regles { get; private set; } /// diff --git a/Sources/MauiSpark/AppShell.xaml b/Sources/MauiSpark/AppShell.xaml index 7242e6c..02ae22b 100644 --- a/Sources/MauiSpark/AppShell.xaml +++ b/Sources/MauiSpark/AppShell.xaml @@ -37,4 +37,8 @@ Title="Egalite" ContentTemplate="{DataTemplate pages:Egalite}" /> + + diff --git a/Sources/MauiSpark/MauiProgram.cs b/Sources/MauiSpark/MauiProgram.cs index be3b5b2..bcd04ec 100644 --- a/Sources/MauiSpark/MauiProgram.cs +++ b/Sources/MauiSpark/MauiProgram.cs @@ -1,4 +1,5 @@ -using CoreLibrary.Manager; +using CoreLibrary.Events; +using CoreLibrary.Manager; using Microsoft.Extensions.Logging; namespace MauiSpark @@ -10,6 +11,9 @@ namespace MauiSpark public static MauiApp CreateMauiApp() { Manager.Charger(); + Manager.Partie.Jouer(); + + Manager.Partie.DemanderJoueur += (Object? sender, DemanderJoueurEventArgs e) => null; var builder = MauiApp.CreateBuilder(); builder diff --git a/Sources/MauiSpark/Pages/Plateau.xaml b/Sources/MauiSpark/Pages/Plateau.xaml index 2ffcd6c..9b21f98 100644 --- a/Sources/MauiSpark/Pages/Plateau.xaml +++ b/Sources/MauiSpark/Pages/Plateau.xaml @@ -3,9 +3,36 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="MauiSpark.Pages.Plateau" Title="Plateau"> - - - - - + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Sources/MauiSpark/Pages/Plateau.xaml.cs b/Sources/MauiSpark/Pages/Plateau.xaml.cs index 8ed32c8..dfd0f0c 100644 --- a/Sources/MauiSpark/Pages/Plateau.xaml.cs +++ b/Sources/MauiSpark/Pages/Plateau.xaml.cs @@ -1,3 +1,6 @@ +using CoreLibrary.Events; +using CoreLibrary.Manager; + namespace MauiSpark.Pages; public partial class Plateau : ContentPage @@ -5,5 +8,10 @@ public partial class Plateau : ContentPage public Plateau() { InitializeComponent(); - } + } + + public void NouveauTour(Object? sender, NouveauTourEventArgs e) + { + BindingContext = e; + } } \ No newline at end of file