parent
02cbd161a7
commit
b8b3153c3a
@ -1,20 +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.Defaite"
|
||||
xmlns:pages="clr-namespace:MauiSpark.Pages"
|
||||
Title="Defaite">
|
||||
<VerticalStackLayout >
|
||||
<FlexLayout Direction="Row" JustifyContent="SpaceAround" AlignContent="Center" VerticalOptions="Center" Margin="10">
|
||||
<Image Source="defaite.png" MaximumHeightRequest="100" MaximumWidthRequest="100" />
|
||||
<Frame HorizontalOptions="Center" VerticalOptions="Center" Style="{StaticResource FrameTitrePage}" >
|
||||
<Label Text="Defaite" Style="{StaticResource TexteTitre}"/>
|
||||
</Frame>
|
||||
<Image Source="defaite.png" MaximumHeightRequest="100" MaximumWidthRequest="100"/>
|
||||
</FlexLayout>
|
||||
<Frame Margin="20">
|
||||
<Label HorizontalOptions="Center" Text="{Binding}" Style="{StaticResource TexteFrame}"/>
|
||||
</Frame>
|
||||
<Button Text="Menu" VerticalOptions="End" HorizontalOptions="Center"></Button>
|
||||
</VerticalStackLayout>
|
||||
</ContentPage>
|
@ -1,14 +0,0 @@
|
||||
using CoreLibrary;
|
||||
using CoreLibrary.Events;
|
||||
|
||||
namespace MauiSpark.Pages;
|
||||
|
||||
public partial class Defaite : ContentPage
|
||||
{
|
||||
public Defaite(Partie p, PartieTermineeEventArgs e)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
BindingContext = $"Aucun des deux joueurs, {e.Perdants.First().Nom} et {e.Perdants.Last().Nom} n'a trouvé le code secret";
|
||||
}
|
||||
}
|
@ -1,20 +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.Egalite"
|
||||
xmlns:pages="clr-namespace:MauiSpark.Pages"
|
||||
Title="Egalite">
|
||||
<VerticalStackLayout>
|
||||
<FlexLayout Direction="Row" JustifyContent="SpaceAround" AlignContent="Center" VerticalOptions="Center" Margin="10">
|
||||
<Image Source="egaliter.jpg" MaximumHeightRequest="100" MaximumWidthRequest="100" />
|
||||
<Frame HorizontalOptions="Center" VerticalOptions="Center" Style="{StaticResource FrameTitrePage}">
|
||||
<Label Text="Egaliter" Style="{StaticResource TexteTitre}"/>
|
||||
</Frame>
|
||||
<Image Source="egaliter.jpg" MaximumHeightRequest="100" MaximumWidthRequest="100"/>
|
||||
</FlexLayout>
|
||||
<Frame Margin="20">
|
||||
<Label HorizontalOptions="Center" Text="Les deux joueur ont trouvé en même temps" Style="{StaticResource TexteFrame}"/>
|
||||
</Frame>
|
||||
<Button Text="Menu" VerticalOptions="End" HorizontalOptions="Center"></Button>
|
||||
</VerticalStackLayout>
|
||||
</ContentPage>
|
@ -1,9 +0,0 @@
|
||||
namespace MauiSpark.Pages;
|
||||
|
||||
public partial class Egalite : ContentPage
|
||||
{
|
||||
public Egalite()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
@ -1,14 +1,45 @@
|
||||
using CoreLibrary;
|
||||
using CoreLibrary.Events;
|
||||
|
||||
namespace MauiSpark.Pages;
|
||||
|
||||
public partial class Victoire : ContentPage
|
||||
{
|
||||
public Victoire(Partie partie, PartieTermineeEventArgs e)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
BindingContext = $"Le joueur {e.Gagnants.First().Nom} a gagné";
|
||||
}
|
||||
using CoreLibrary;
|
||||
using CoreLibrary.Events;
|
||||
|
||||
namespace MauiSpark.Pages;
|
||||
|
||||
public partial class Victoire : ContentPage
|
||||
{
|
||||
public Victoire()
|
||||
{
|
||||
NavigationPage.SetHasNavigationBar(this, false);
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public async void QuandPartieTerminee(object? sender, PartieTermineeEventArgs e)
|
||||
{
|
||||
if (Application.Current == null || Application.Current.MainPage == null)
|
||||
return;
|
||||
|
||||
if (((NavigationPage)Application.Current.MainPage).CurrentPage != this)
|
||||
await Application.Current.MainPage.Navigation.PushAsync(this);
|
||||
|
||||
IEnumerable<Page> pages = Application.Current.MainPage.Navigation.NavigationStack.Reverse().Skip(1);
|
||||
|
||||
foreach (Page page in pages)
|
||||
{
|
||||
if (page is Accueil)
|
||||
break;
|
||||
|
||||
Application.Current.MainPage.Navigation.RemovePage(page);
|
||||
}
|
||||
|
||||
if(e.Gagnants.Count() == 1)
|
||||
BindingContext = ("Victoire", $"Le joueur {e.Gagnants.First().Nom} a gagné");
|
||||
else if(e.Gagnants.Count() > 1)
|
||||
BindingContext = ("Egalité", $"Les joueurs {string.Join(' ', e.Gagnants)} ont gagné");
|
||||
else
|
||||
BindingContext = ("Défaite", "Personne n'a trouvé le code...");
|
||||
}
|
||||
|
||||
public async void QuandMenuPresse(object sender, EventArgs e)
|
||||
{
|
||||
await Navigation.PopAsync();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue