sound + up end game

master
Jérémy Mouyon 11 months ago
parent 134a8be31f
commit 332ac4979a

@ -1,5 +1,7 @@
using CommunityToolkit.Maui;
using CommunityToolkit.Maui.Views;
using Microsoft.Extensions.Logging;
using Microsoft.Maui;
namespace Qwirkle
{
@ -11,6 +13,7 @@ namespace Qwirkle
builder
.UseMauiApp<App>()
.UseMauiCommunityToolkit()
.UseMauiCommunityToolkitMediaElement()
.ConfigureFonts(fonts =>
{
fonts.AddFont("DiloWorld.ttf", "DiloWorld");

@ -11,6 +11,7 @@ using Color = Microsoft.Maui.Graphics.Color;
using System.Drawing;
using QwirkleClassLibrary.Persistences;
using CommunityToolkit.Maui.Views;
using System.Diagnostics;
namespace Qwirkle.Pages;
@ -191,7 +192,7 @@ public partial class Gameboard : ContentPage
private void Game_NextPlayerNotified(object? sender, NextPlayerNotifiedEventArgs args)
{
DisplayAlert("Player switch !", "It's your turn : " + args.Player.NameTag, "<3");
Debug.WriteLine(args.Player.NameTag);
}
private void OnButtonSwapClicked(object sender, EventArgs e)
@ -208,7 +209,7 @@ public partial class Gameboard : ContentPage
private async Task 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");
bool answer = await DisplayAlert("Swap System", "Are you sure you want to swap your tiles? Attention, if you swap you can not play", "Yes", "No");
if (answer)
{
@ -236,7 +237,13 @@ public partial class Gameboard : ContentPage
if (answer)
{
IGamePersistence gameIntermediateSave = new GamePersistenceXml();
gameIntermediateSave.SaveGame(game);
game.ClearGame();
await Navigation.PopToRootAsync();
}
}

@ -6,6 +6,8 @@
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:Name="root">
<ContentPage.Resources>
<x:Double x:Key="CellWidth">75</x:Double>
<x:Double x:Key="CellHeight">75</x:Double>
@ -26,6 +28,8 @@
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<toolkit:MediaElement Source = "embed://f1.mp3" ShouldAutoPlay = "True" ShouldShowPlaybackControls="False" Volume="10"/>
<Border WidthRequest="80" HeightRequest="80"
BackgroundColor="Transparent"

@ -5,6 +5,7 @@
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:Name="root"
CanBeDismissedByTappingOutsideOfPopup="False"
xmlns:controls="clr-namespace:Qwirkle.Views"
>
<VerticalStackLayout HeightRequest="400" WidthRequest="500">
@ -19,35 +20,7 @@
<Label Text="{Binding ScoreboardList[0].Key, Source={x:Reference root}}" Style="{StaticResource SuperTitle}" TextColor="HotPink" FontSize="Medium"></Label>
<CollectionView ItemsSource="{Binding ScoreboardList}" BindingContext="{x:Reference root}">
<CollectionView.ItemsLayout>
<GridItemsLayout Orientation="Vertical"/>
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
<StackLayout>
<Grid ColumnDefinitions="4*, auto, 2*"
RowDefinitions="50">
<Label
Grid.Column="0"
Text="{Binding Key}"
Style="{StaticResource ContentTab}"/>
<Rectangle
Style="{StaticResource RectangleTab}"
Grid.Column="1"/>
<Label
Grid.Column="2"
Text="{Binding Value}"
Style="{StaticResource ContentTab}"/>
</Grid>
<Rectangle/>
</StackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<controls:Scoreboard></controls:Scoreboard>
<Button Text="Skip" Style="{StaticResource GameButton}" Clicked="OnButtonNextClick"></Button>

@ -41,7 +41,7 @@
<ItemGroup>
<!-- App Icon -->
<!-- <MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />-->
<MauiIcon Include="Resources\AppIcon\appicon.svg"/>
<MauiIcon Include="Resources\AppIcon\appicon.svg" />
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
@ -66,6 +66,7 @@
<ItemGroup>
<PackageReference Include="CommunityToolkit.Maui" Version="9.0.0" />
<PackageReference Include="CommunityToolkit.Maui.MediaElement" Version="3.1.1" />
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.40" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.40" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0-preview.4.24266.19" />

@ -1,3 +1,5 @@
using Qwirkle.Pages;
namespace Qwirkle.Views;
public partial class GoBack : ContentView
@ -7,8 +9,8 @@ public partial class GoBack : ContentView
InitializeComponent();
}
private void Button_OnClicked(object? sender, EventArgs e)
private async void Button_OnClicked(object? sender, EventArgs e)
{
Navigation.PopAsync();
await Navigation.PopToRootAsync();
}
}
Loading…
Cancel
Save