diff --git a/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs b/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs index 3df7d1e..61d2172 100644 --- a/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs +++ b/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs @@ -23,7 +23,7 @@ public partial class Gameboard : ContentPage private List tilesSwap = []; - public Color ColorBC1 { get; set; } = Colors.White; + public Color ColorBC1 { get; set; } = Colors.Transparent; public Color ColorBC2 { get; set; } = Colors.Transparent; public Color ColorBC3 { get; set; } = Colors.Transparent; public Color ColorBC4 { get; set; } = Colors.Transparent; @@ -31,10 +31,21 @@ public partial class Gameboard : ContentPage public Gameboard() { + game.EndOfGameNotified += Game_EndOfGameNotified; + InitializeComponent(); BindingContext = game; + ChangeColorBC(); + + } + + private void Game_EndOfGameNotified(object? sender, EndOfGameNotifiedEventArgs e) + { + DisplayAlert("THE END.", "FAUT QU'ON PARLE DE CE QUE QU'ON VEUT FAIRE ICI !!!" ,"<3"); + } + private void OnDragStarting(object sender, DragStartingEventArgs e) { var tile = ((Element)sender).BindingContext as Tile; @@ -159,14 +170,27 @@ public partial class Gameboard : ContentPage if (game.CellsUsed.Count == 0 && !game.PlayerSwapping) { - DisplayAlert("Swap system", "\r\nWelcome to the swap system! To use the system, take the tiles you wish to swap and place them in the bag (you will not see the tiles disappear). Then, click on the skip button. /!\\ Attention, during the swap phase, you cannot play /!\\", "Copy !"); - game.PlayerSwapping = true; + //DisplayAlert("Swap system", "\r\nWelcome to the swap system! To use the system, take the tiles you wish to swap and place them in the bag (you will not see the tiles disappear). Then, click on the skip button. /!\\ Attention, during the swap phase, you cannot play /!\\", "Copy !"); + AnswerSwap(); + + + } game.SwapTilesNotified -= Game_SwapTilesNotified; game.PlaceTileNotified -= Game_PlaceTileNotified; } + private async void AnswerSwap() + { + bool answer = await DisplayAlert("Swap System", "Etes vous sur de vouloir swap vos tuiles ? Attention, si vous swapez vous ne pouvez pu jouer", "Yes", "No"); + + if (answer) + { + game.PlayerSwapping = true; + } + } + private void Game_SwapTilesNotified(object? sender, SwapTilesNotifiedEventArgs args) { DisplayAlert("Swap system", args.Reason, "<3");