Fin de la page victoire
continuous-integration/drone/push Build is failing Details

master
Céleste BARBOSA 11 months ago
parent 2f571a940d
commit ce11503157

@ -7,7 +7,7 @@ namespace CoreLibrary.Regles
{
public string Nom => "Règles classiques";
public int NbJoueurs => 2;
public int NbTour => 12;
public int NbTour => 1;
public int TailleCode => 4;
}
}

@ -79,6 +79,9 @@
<Compile Update="Pages\ReglesPage.xaml.cs">
<DependentUpon>ReglesPage.xaml</DependentUpon>
</Compile>
<Compile Update="Pages\VictoirePage.xaml.cs">
<DependentUpon>VictoirePage.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
@ -103,7 +106,7 @@
<MauiXaml Update="Pages\TableauScore.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Pages\Victoire.xaml">
<MauiXaml Update="Pages\VictoirePage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Vues\BoutonClassementVue.xaml">

@ -23,7 +23,7 @@ public partial class ModePage : ContentPage
partie.PartieDemanderJoueur += new ConnexionPage().QuandDemanderNom;
partie.PartieNouveauTour += new PlateauPage().QuandNouveauTour;
partie.PartiePartieTerminee += new Victoire().QuandPartieTerminee;
partie.PartiePartieTerminee += new VictoirePage().QuandPartieTerminee;
partie.Jouer();
}

@ -13,7 +13,7 @@
<StackLayout BindableLayout.ItemsSource="{Binding .}">
<BindableLayout.ItemTemplate>
<DataTemplate>
<vues:ReglesVue Titre="{Binding Titre}" Description="{Binding Description}" Margin="10"/>
<vues:ReglesVue Titre="{Binding Titre}" Description="{Binding Description}" Margin="20"/>
</DataTemplate>
</BindableLayout.ItemTemplate>
</StackLayout>

@ -19,8 +19,6 @@ public partial class ReglesPage : ContentPage
NavigationPage.SetHasNavigationBar(this, false);
BindingContext = (Regles[])[
reglesClassiques,
reglesClassiques,
reglesClassiques
];

@ -1,35 +0,0 @@
<?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.Victoire"
xmlns:pages="clr-namespace:MauiSpark.Pages"
xmlns:vues="clr-namespace:MauiSpark.Vues"
Title="Victoire">
<Grid
ColumnDefinitions="*"
RowDefinitions="*, auto, *">
<Grid
ColumnDefinitions="*, *, *"
RowDefinitions="*">
<vues:ImageResultatVue Image="{Binding [2]}" HorizontalOptions="Start"/>
<vues:TitreVue Texte="{Binding [0]}" Grid.Column="1"/>
<vues:ImageResultatVue Image="{Binding [2]}" Grid.Column="2" HorizontalOptions="End"/>
</Grid>
<Frame Grid.Row="1">
<Label HorizontalOptions="Center" Text="{Binding [1]}"/>
</Frame>
<Button
Grid.Row="2"
Text="Menu"
VerticalOptions="Center"
Margin="0, 50"
Clicked="QuandMenuPresse"/>
</Grid>
</ContentPage>

@ -0,0 +1,42 @@
<?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.VictoirePage"
xmlns:pages="clr-namespace:MauiSpark.Pages"
xmlns:vues="clr-namespace:MauiSpark.Vues"
x:Name="victoirePage"
Title="VictoirePage">
<Grid
ColumnDefinitions="*"
RowDefinitions="*, auto, *">
<Grid
ColumnDefinitions="*, *, *"
RowDefinitions="*">
<vues:ImageResultatVue Image="{Binding Source={x:Reference victoirePage}, Path=BindingContext.Image}" HorizontalOptions="Center" VerticalOptions="Center"/>
<vues:TitreVue Texte="{Binding Source={x:Reference victoirePage}, Path=BindingContext.Titre}" Grid.Column="1" VerticalOptions="Center"/>
<vues:ImageResultatVue Image="{Binding Source={x:Reference victoirePage}, Path=BindingContext.Image}" Grid.Column="2" HorizontalOptions="Center" VerticalOptions="Center"/>
</Grid>
<Border
Grid.Row="1"
StrokeThickness="2"
StrokeShape="RoundRectangle 10"
Margin="20"
Padding="20">
<Label HorizontalOptions="Center" Text="{Binding Texte}"/>
</Border>
<Button
Grid.Row="2"
Text="Menu"
VerticalOptions="Center"
Margin="0, 50"
Clicked="QuandMenuPresse"/>
</Grid>
</ContentPage>

@ -3,9 +3,19 @@ using CoreLibrary.Joueurs;
namespace MauiSpark.Pages;
public partial class Victoire : ContentPage
partial class Message
{
public Victoire()
public string Titre { get; init; } = "";
public string Texte { get; init; } = "";
public string Image { get; init; } = "";
}
public partial class VictoirePage : ContentPage
{
public VictoirePage()
{
NavigationPage.SetHasNavigationBar(this, false);
@ -34,11 +44,26 @@ public partial class Victoire : ContentPage
IReadOnlyList<Joueur> perdants = e.Perdants;
if (gagnants.Count == 1)
BindingContext = ("Victoire", $"Le joueur {gagnants.First().Nom} a gagné", "trophy.jpg");
BindingContext = new Message()
{
Titre = "Victoire",
Texte = $"Le joueur {gagnants.First().Nom} a gagné",
Image = "trophy.jpg"
};
else if (gagnants.Count > 1)
BindingContext = ("Egalité", $"Les joueurs {string.Join(' ', gagnants.Select(joueur => joueur.Nom))} ont gagné", "egaliter.jpg");
BindingContext = new Message()
{
Titre = "Egalité",
Texte = $"Les joueurs {string.Join(' ', gagnants.Select(joueur => joueur.Nom))} ont gagné",
Image = "egalite.jpg"
};
else
BindingContext = ("Défaite", "Personne n'a trouvé le code...", "defaite.png");
BindingContext = new Message()
{
Titre = "Défaite",
Texte = "Personne n'a trouvé le code...",
Image = "defaite.png"
};
}
public async void QuandMenuPresse(object sender, EventArgs e)

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

@ -2,11 +2,11 @@ namespace MauiSpark.Vues;
public partial class ImageResultatVue : ContentView
{
public static readonly BindableProperty ImageProperty = BindableProperty.Create(nameof(Image), typeof(string), typeof(ImageResultatVue), default(string));
public static readonly BindableProperty ImageProperty = BindableProperty.Create(nameof(Image), typeof(ImageSource), typeof(ImageResultatVue), null);
public string Image
public ImageSource Image
{
get => (string)GetValue(ImageProperty);
get => (ImageSource)GetValue(ImageProperty);
set => SetValue(ImageProperty, value);
}

Loading…
Cancel
Save