|
|
@ -37,16 +37,31 @@ public partial class Plateau : ContentPage
|
|
|
|
private Code? code;
|
|
|
|
private Code? code;
|
|
|
|
private Joueur? joueur;
|
|
|
|
private Joueur? joueur;
|
|
|
|
|
|
|
|
|
|
|
|
public Plateau(Partie partie)
|
|
|
|
public Plateau()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NavigationPage.SetHasBackButton(this, false);
|
|
|
|
|
|
|
|
NavigationPage.SetHasNavigationBar(this, false);
|
|
|
|
NavigationPage.SetHasNavigationBar(this, false);
|
|
|
|
|
|
|
|
NavigationPage.SetHasBackButton(this, true);
|
|
|
|
|
|
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
InitializeComponent();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void QuandNouveauTour(object? sender, NouveauTourEventArgs e)
|
|
|
|
public async void QuandNouveauTour(object? sender, NouveauTourEventArgs e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (Application.Current != null && Application.Current.MainPage != null && ((NavigationPage)Application.Current.MainPage).CurrentPage != this)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
IEnumerable<Page> pages = Application.Current.MainPage.Navigation.NavigationStack.Reverse();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach(Page page in pages)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (page is Accueil)
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Application.Current.MainPage.Navigation.RemovePage(page);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await Application.Current.MainPage.Navigation.PushAsync(this);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
code = e.Code;
|
|
|
|
code = e.Code;
|
|
|
|
joueur = e.Joueur;
|
|
|
|
joueur = e.Joueur;
|
|
|
|
|
|
|
|
|
|
|
@ -60,7 +75,8 @@ public partial class Plateau : ContentPage
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
code.AjouterJeton(new Jeton(couleur));
|
|
|
|
if(code != null)
|
|
|
|
|
|
|
|
code.AjouterJeton(new Jeton(couleur));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (CodeCompletException)
|
|
|
|
catch (CodeCompletException)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -72,7 +88,8 @@ public partial class Plateau : ContentPage
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
code.SupprimerDernierJeton();
|
|
|
|
if(code != null)
|
|
|
|
|
|
|
|
code.SupprimerDernierJeton();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(CodeVideException)
|
|
|
|
catch(CodeVideException)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -84,7 +101,8 @@ public partial class Plateau : ContentPage
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
joueur.Code(code);
|
|
|
|
if(joueur != null && code != null)
|
|
|
|
|
|
|
|
joueur.Code(code);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (CodeIncompletException)
|
|
|
|
catch (CodeIncompletException)
|
|
|
|
{
|
|
|
|
{
|
|
|
|