Debut reprise d'une partie
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
1baca9f63a
commit
10dae20440
@ -1,50 +0,0 @@
|
||||
[
|
||||
{
|
||||
"EstConnecte": false,
|
||||
"Nom": "Céleste",
|
||||
"statistiques": [
|
||||
{
|
||||
"Key": {
|
||||
"Item1": {
|
||||
"__type": "ReglesClassiques:#CoreLibrary.Regles"
|
||||
},
|
||||
"Item2": 3
|
||||
},
|
||||
"Value": 10
|
||||
},
|
||||
{
|
||||
"Key": {
|
||||
"Item1": {
|
||||
"__type": "ReglesClassiques:#CoreLibrary.Regles"
|
||||
},
|
||||
"Item2": 3
|
||||
},
|
||||
"Value": 11
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"EstConnecte": false,
|
||||
"Nom": "Pauline",
|
||||
"statistiques": [
|
||||
{
|
||||
"Key": {
|
||||
"Item1": {
|
||||
"__type": "ReglesClassiques:#CoreLibrary.Regles"
|
||||
},
|
||||
"Item2": 3
|
||||
},
|
||||
"Value": 10
|
||||
},
|
||||
{
|
||||
"Key": {
|
||||
"Item1": {
|
||||
"__type": "ReglesClassiques:#CoreLibrary.Regles"
|
||||
},
|
||||
"Item2": 3
|
||||
},
|
||||
"Value": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="MauiSpark.Pages.ReprendrePage"
|
||||
xmlns:vues="clr-namespace:MauiSpark.Vues"
|
||||
x:Name="reprendrePage"
|
||||
Title="ReprendrePage">
|
||||
|
||||
<ScrollView>
|
||||
<StackLayout>
|
||||
<vues:TitreVue Texte="Reprendre une partie"/>
|
||||
|
||||
<StackLayout BindableLayout.ItemsSource="{Binding .}">
|
||||
<BindableLayout.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<vues:PartieCommenceeVue Partie="{Binding .}" Margin="20"/>
|
||||
</DataTemplate>
|
||||
</BindableLayout.ItemTemplate>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
</ContentPage>
|
@ -0,0 +1,13 @@
|
||||
namespace MauiSpark.Pages;
|
||||
|
||||
public partial class ReprendrePage : ContentPage
|
||||
{
|
||||
public ReprendrePage()
|
||||
{
|
||||
NavigationPage.SetHasNavigationBar(this, false);
|
||||
|
||||
BindingContext = MauiProgram.Manageur.PartiesNonTerminees;
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Name="partieCommenceeVue"
|
||||
x:Class="MauiSpark.Vues.PartieCommenceeVue">
|
||||
|
||||
<Border
|
||||
StrokeThickness="2"
|
||||
StrokeShape="RoundRectangle 10">
|
||||
|
||||
<Grid RowDefinitions="*, *, *" ColumnDefinitions="*" Margin="20">
|
||||
<Label Text="{Binding NomRegles, Source={x:Reference partieCommenceeVue}}" FontSize="Large" Margin="0, 0, 0, 20"/>
|
||||
|
||||
<Grid Grid.Row="1" RowDefinitions="*, *" Margin="0, 0, 0, 20">
|
||||
<Label Grid.Row="0" Text="{Binding NombreJoueurs, Source={x:Reference partieCommenceeVue}}" FontSize="Medium"/>
|
||||
<Label Grid.Row="1" Text="{Binding TourActuel, Source={x:Reference partieCommenceeVue}}" FontSize="Medium"/>
|
||||
</Grid>
|
||||
|
||||
<StackLayout Grid.Row="3" BindableLayout.ItemsSource="{Binding Joueurs, Source={x:Reference partieCommenceeVue}}">
|
||||
<BindableLayout.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Label Text="{Binding .}" FontSize="Medium"/>
|
||||
</DataTemplate>
|
||||
</BindableLayout.ItemTemplate>
|
||||
</StackLayout>
|
||||
|
||||
<Grid.GestureRecognizers>
|
||||
<TapGestureRecognizer Tapped="PartiePressee"/>
|
||||
</Grid.GestureRecognizers>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ContentView>
|
@ -0,0 +1,60 @@
|
||||
using CoreLibrary;
|
||||
using CoreLibrary.Joueurs;
|
||||
using MauiSpark.Pages;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace MauiSpark.Vues;
|
||||
|
||||
public partial class PartieCommenceeVue : ContentView, INotifyPropertyChanged
|
||||
{
|
||||
public static readonly BindableProperty PartieProperty = BindableProperty.Create(nameof(Partie), typeof(Partie), typeof(PartieCommenceeVue), null, propertyChanged: QuandPartieChangee);
|
||||
|
||||
public Partie Partie
|
||||
{
|
||||
get => (Partie)GetValue(PartieProperty);
|
||||
set => SetValue(PartieProperty, value);
|
||||
}
|
||||
|
||||
public string NomRegles
|
||||
{
|
||||
get => Partie != null ? Partie.Regles.Nom : "";
|
||||
}
|
||||
|
||||
public string TourActuel
|
||||
{
|
||||
get => $"Tour : {(Partie != null ? Partie.Tour : 0)} / {(Partie != null ? Partie.Regles.NbTour : 0)}";
|
||||
}
|
||||
|
||||
public Joueur[] Joueurs
|
||||
{
|
||||
get => Partie != null ? Partie.Joueurs.ToArray() : [];
|
||||
}
|
||||
|
||||
public string NombreJoueurs => $"Joueurs : {Joueurs.Length} / {(Partie != null ? Partie.Regles.NbJoueurs : 0)}";
|
||||
|
||||
private static void QuandPartieChangee(BindableObject bindable, object ancienneValeur, object nouvelleValeur)
|
||||
{
|
||||
((PartieCommenceeVue)bindable).OnPropertyChanged(nameof(NomRegles));
|
||||
((PartieCommenceeVue)bindable).OnPropertyChanged(nameof(TourActuel));
|
||||
((PartieCommenceeVue)bindable).OnPropertyChanged(nameof(Joueurs));
|
||||
((PartieCommenceeVue)bindable).OnPropertyChanged(nameof(NombreJoueurs));
|
||||
}
|
||||
|
||||
private void PartiePressee(object? sender, EventArgs e)
|
||||
{
|
||||
if (Partie == null)
|
||||
return;
|
||||
|
||||
Partie.PartieDemanderJoueur += new ConnexionPage().QuandDemanderNom;
|
||||
Partie.PartieNouveauTour += new PlateauPage().QuandNouveauTour;
|
||||
Partie.PartiePartieTerminee += new VictoirePage().QuandPartieTerminee;
|
||||
|
||||
Partie.Jouer();
|
||||
}
|
||||
|
||||
public PartieCommenceeVue()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue