diff --git a/Qwirkle/QwirkleViews/App.xaml.cs b/Qwirkle/QwirkleViews/App.xaml.cs index 89fe1be..97133c1 100644 --- a/Qwirkle/QwirkleViews/App.xaml.cs +++ b/Qwirkle/QwirkleViews/App.xaml.cs @@ -16,6 +16,7 @@ namespace Qwirkle Routing.RegisterRoute(nameof(SetPlayers), typeof(SetPlayers)); Routing.RegisterRoute(nameof(Gameboard), typeof(Gameboard)); Routing.RegisterRoute(nameof(Rules), typeof(Rules)); + Routing.RegisterRoute(nameof(MainPage), typeof(MainPage)); } diff --git a/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs b/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs index 61d2172..63c0983 100644 --- a/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs +++ b/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs @@ -31,7 +31,6 @@ public partial class Gameboard : ContentPage public Gameboard() { - game.EndOfGameNotified += Game_EndOfGameNotified; InitializeComponent(); BindingContext = game; @@ -44,6 +43,8 @@ public partial class Gameboard : ContentPage private void Game_EndOfGameNotified(object? sender, EndOfGameNotifiedEventArgs e) { DisplayAlert("THE END.", "FAUT QU'ON PARLE DE CE QUE QU'ON VEUT FAIRE ICI !!!" ,"<3"); + Navigation.PushAsync(new MainPage()); + game.ClearGame(); } private void OnDragStarting(object sender, DragStartingEventArgs e) @@ -89,6 +90,7 @@ public partial class Gameboard : ContentPage private void OnButtonSkipClicked(object sender, EventArgs e) { game.NextPlayerNotified += Game_NextPlayerNotified; + game.EndOfGameNotified += Game_EndOfGameNotified; if (game.PlayerSwapping) { @@ -106,6 +108,7 @@ public partial class Gameboard : ContentPage game.CheckGameOver(game.GetPlayingPlayer()); game.SetNextPlayer(); game.NextPlayerNotified -= Game_NextPlayerNotified; + game.EndOfGameNotified -= Game_EndOfGameNotified; ChangeColorBC(); } diff --git a/Qwirkle/QwirkleViews/Pages/Gameboard.xaml b/Qwirkle/QwirkleViews/Pages/Gameboard.xaml index 3095be4..2eaf015 100644 --- a/Qwirkle/QwirkleViews/Pages/Gameboard.xaml +++ b/Qwirkle/QwirkleViews/Pages/Gameboard.xaml @@ -35,7 +35,7 @@ DropCommand="{Binding OnDropB, Source={x:Reference root}}" /> - +