Fin de la page victoire
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
2f571a940d
commit
ce11503157
@ -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>
|
@ -1,48 +1,73 @@
|
|||||||
using CoreLibrary.Evenements;
|
using CoreLibrary.Evenements;
|
||||||
using CoreLibrary.Joueurs;
|
using CoreLibrary.Joueurs;
|
||||||
|
|
||||||
namespace MauiSpark.Pages;
|
namespace MauiSpark.Pages;
|
||||||
|
|
||||||
public partial class Victoire : ContentPage
|
|
||||||
{
|
partial class Message
|
||||||
public Victoire()
|
{
|
||||||
{
|
public string Titre { get; init; } = "";
|
||||||
NavigationPage.SetHasNavigationBar(this, false);
|
public string Texte { get; init; } = "";
|
||||||
|
public string Image { get; init; } = "";
|
||||||
InitializeComponent();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public async void QuandPartieTerminee(object? sender, PartiePartieTermineeEventArgs e)
|
|
||||||
{
|
public partial class VictoirePage : ContentPage
|
||||||
if (Application.Current == null || Application.Current.MainPage == null)
|
{
|
||||||
return;
|
public VictoirePage()
|
||||||
|
{
|
||||||
if (((NavigationPage)Application.Current.MainPage).CurrentPage != this)
|
NavigationPage.SetHasNavigationBar(this, false);
|
||||||
await Application.Current.MainPage.Navigation.PushAsync(this);
|
|
||||||
|
InitializeComponent();
|
||||||
IEnumerable<Page> pages = Application.Current.MainPage.Navigation.NavigationStack.Reverse().Skip(1);
|
}
|
||||||
|
|
||||||
foreach (Page page in pages)
|
public async void QuandPartieTerminee(object? sender, PartiePartieTermineeEventArgs e)
|
||||||
{
|
{
|
||||||
if (page is AccueilPage)
|
if (Application.Current == null || Application.Current.MainPage == null)
|
||||||
break;
|
return;
|
||||||
|
|
||||||
Application.Current.MainPage.Navigation.RemovePage(page);
|
if (((NavigationPage)Application.Current.MainPage).CurrentPage != this)
|
||||||
}
|
await Application.Current.MainPage.Navigation.PushAsync(this);
|
||||||
|
|
||||||
IReadOnlyList<Joueur> gagnants = e.Gagnants;
|
IEnumerable<Page> pages = Application.Current.MainPage.Navigation.NavigationStack.Reverse().Skip(1);
|
||||||
IReadOnlyList<Joueur> perdants = e.Perdants;
|
|
||||||
|
foreach (Page page in pages)
|
||||||
if (gagnants.Count == 1)
|
{
|
||||||
BindingContext = ("Victoire", $"Le joueur {gagnants.First().Nom} a gagné", "trophy.jpg");
|
if (page is AccueilPage)
|
||||||
else if (gagnants.Count > 1)
|
break;
|
||||||
BindingContext = ("Egalité", $"Les joueurs {string.Join(' ', gagnants.Select(joueur => joueur.Nom))} ont gagné", "egaliter.jpg");
|
|
||||||
else
|
Application.Current.MainPage.Navigation.RemovePage(page);
|
||||||
BindingContext = ("Défaite", "Personne n'a trouvé le code...", "defaite.png");
|
}
|
||||||
}
|
|
||||||
|
IReadOnlyList<Joueur> gagnants = e.Gagnants;
|
||||||
public async void QuandMenuPresse(object sender, EventArgs e)
|
IReadOnlyList<Joueur> perdants = e.Perdants;
|
||||||
{
|
|
||||||
await Navigation.PopAsync();
|
if (gagnants.Count == 1)
|
||||||
}
|
BindingContext = new Message()
|
||||||
|
{
|
||||||
|
Titre = "Victoire",
|
||||||
|
Texte = $"Le joueur {gagnants.First().Nom} a gagné",
|
||||||
|
Image = "trophy.jpg"
|
||||||
|
};
|
||||||
|
else if (gagnants.Count > 1)
|
||||||
|
BindingContext = new Message()
|
||||||
|
{
|
||||||
|
Titre = "Egalité",
|
||||||
|
Texte = $"Les joueurs {string.Join(' ', gagnants.Select(joueur => joueur.Nom))} ont gagné",
|
||||||
|
Image = "egalite.jpg"
|
||||||
|
};
|
||||||
|
else
|
||||||
|
BindingContext = new Message()
|
||||||
|
{
|
||||||
|
Titre = "Défaite",
|
||||||
|
Texte = "Personne n'a trouvé le code...",
|
||||||
|
Image = "defaite.png"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void QuandMenuPresse(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
await Navigation.PopAsync();
|
||||||
|
}
|
||||||
}
|
}
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
Loading…
Reference in new issue