From c5027304b0a052d7ad35462dcd5cccbea53ff191 Mon Sep 17 00:00:00 2001 From: "jeremy.mouyon" Date: Tue, 21 May 2024 17:20:34 +0200 Subject: [PATCH] the xaml edit is BACCKK BABY ! Welcome to data bidding, wait teacher for 2 question : - where create game - when get back entry --- Qwirkle/QwirkleConsoleApp/Program.cs | 2 +- Qwirkle/QwirkleViews/App.xaml.cs | 8 ++- Qwirkle/QwirkleViews/MainPage.xaml | 22 ++++--- Qwirkle/QwirkleViews/MainPage.xaml.cs | 63 ++++++++++++++++--- Qwirkle/QwirkleViews/MauiProgram.cs | 2 - Qwirkle/QwirkleViews/Pages/SetPlayers.xaml | 17 +++-- Qwirkle/QwirkleViews/Pages/SetPlayers.xaml.cs | 39 +++++++++++- Qwirkle/QwirkleViews/QwirkleViews.csproj | 4 ++ Qwirkle/QwirkleViews/Views/ButtonShadow.xaml | 18 +++--- .../QwirkleViews/Views/ButtonShadow.xaml.cs | 18 ++++++ Qwirkle/QwirkleViews/Views/EntryPlayer.xaml | 7 ++- .../QwirkleViews/Views/EntryPlayer.xaml.cs | 28 +++++++-- 12 files changed, 182 insertions(+), 46 deletions(-) diff --git a/Qwirkle/QwirkleConsoleApp/Program.cs b/Qwirkle/QwirkleConsoleApp/Program.cs index 494b9eb..e98a73b 100644 --- a/Qwirkle/QwirkleConsoleApp/Program.cs +++ b/Qwirkle/QwirkleConsoleApp/Program.cs @@ -227,7 +227,7 @@ static void ShowBoard(Game game) for (int y = 0; y < board.Columns; y++) { Cell? cell = board.GetCell(y, i); - if (cell != null && cell.IsFree == false) + if (cell != null && !cell.IsFree) { Tile? tile = cell.GetTile; if (tile != null) diff --git a/Qwirkle/QwirkleViews/App.xaml.cs b/Qwirkle/QwirkleViews/App.xaml.cs index c9acbda..da15420 100644 --- a/Qwirkle/QwirkleViews/App.xaml.cs +++ b/Qwirkle/QwirkleViews/App.xaml.cs @@ -1,4 +1,8 @@ -namespace Qwirkle +using Qwirkle.Views; +using Microsoft.Maui.Controls; +using Qwirkle.Pages; + +namespace Qwirkle { public partial class App : Application { @@ -7,6 +11,8 @@ InitializeComponent(); MainPage = new AppShell(); + + Routing.RegisterRoute(nameof(SetPlayers), typeof(SetPlayers)); } } } diff --git a/Qwirkle/QwirkleViews/MainPage.xaml b/Qwirkle/QwirkleViews/MainPage.xaml index 75e9e6c..c2ca4fa 100644 --- a/Qwirkle/QwirkleViews/MainPage.xaml +++ b/Qwirkle/QwirkleViews/MainPage.xaml @@ -20,23 +20,25 @@ Aspect="AspectFit" /> - - + + + - + - + - - - - - + + + - + diff --git a/Qwirkle/QwirkleViews/MainPage.xaml.cs b/Qwirkle/QwirkleViews/MainPage.xaml.cs index 81e1b9a..e73c4f4 100644 --- a/Qwirkle/QwirkleViews/MainPage.xaml.cs +++ b/Qwirkle/QwirkleViews/MainPage.xaml.cs @@ -1,25 +1,68 @@ -namespace Qwirkle +using Qwirkle.Views; +using QwirkleClassLibrary; +using QwirkleClassLibrary.Games; +using Microsoft.Maui.Controls; +using Qwirkle.Pages; + +namespace Qwirkle { public partial class MainPage : ContentPage { - int count = 0; public MainPage() { InitializeComponent(); + BindingContext = this; } - /*private void OnCounterClicked(object sender, EventArgs e) + + public ButtonShadow Button1 { get; set; } + = new ButtonShadow + { + Text = "Play" + }; + + public ButtonShadow Button2 { get; set; } + = new ButtonShadow + { + Text = "Continue" + }; + + public ButtonShadow Button3 { get; set; } + = new ButtonShadow + { + Text = "Leaderboard" + }; + + public ButtonShadow Button4 { get; set; } + = new ButtonShadow + { + Text = "Rules" + }; + + public ButtonShadow Button5 { get; set; } + = new ButtonShadow + { + Text = "Settings" + }; + + public ButtonShadow Button6 { get; set; } + = new ButtonShadow + { + Text = "Credits" + }; + + void OnInfoClicked(object sender, EventArgs e) { - count++; + Game game = new Game(); + DisplayAlert("Game notification", "Enter minimun 2 player and max 4 player !", "Ok ! Lets's go !"); + + Navigation.PushAsync(new SetPlayers()); + } + + - if (count == 1) - CounterBtn.Text = $"Clicked {count} time"; - else - CounterBtn.Text = $"Clicked {count} times"; - SemanticScreenReader.Announce(CounterBtn.Text); - }*/ } } diff --git a/Qwirkle/QwirkleViews/MauiProgram.cs b/Qwirkle/QwirkleViews/MauiProgram.cs index 1c04a59..cdd1ba8 100644 --- a/Qwirkle/QwirkleViews/MauiProgram.cs +++ b/Qwirkle/QwirkleViews/MauiProgram.cs @@ -11,8 +11,6 @@ namespace Qwirkle .UseMauiApp() .ConfigureFonts(fonts => { - //fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); - //fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); fonts.AddFont("DiloWorld.ttf", "DiloWorld"); fonts.AddFont("Lexend-Medium.ttf", "Lexend-Meduim"); }); diff --git a/Qwirkle/QwirkleViews/Pages/SetPlayers.xaml b/Qwirkle/QwirkleViews/Pages/SetPlayers.xaml index 3476daf..3c0714e 100644 --- a/Qwirkle/QwirkleViews/Pages/SetPlayers.xaml +++ b/Qwirkle/QwirkleViews/Pages/SetPlayers.xaml @@ -11,17 +11,22 @@ Text="SetPlayers" Style="{StaticResource Title}"/> - + + + - + - - - +