fix end game / pop-up / start leaderboard edit
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
d8d106ced0
commit
1bd9bd0a53
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<toolkit:Popup xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Qwirkle.PopUpEndGame"
|
||||
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
|
||||
x:Name="root"
|
||||
CanBeDismissedByTappingOutsideOfPopup="False"
|
||||
>
|
||||
|
||||
<VerticalStackLayout HeightRequest="400" WidthRequest="500">
|
||||
|
||||
<Label
|
||||
Text="THE END :("
|
||||
Style="{StaticResource SuperTitle}"
|
||||
FontSize="Medium"
|
||||
/>
|
||||
|
||||
<Label Text="THE WINNER IS :"></Label>
|
||||
|
||||
<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>
|
||||
|
||||
<Button Text="Skip" Style="{StaticResource GameButton}" Clicked="OnButtonNextClick"></Button>
|
||||
|
||||
</VerticalStackLayout>
|
||||
</toolkit:Popup>
|
@ -0,0 +1,38 @@
|
||||
using CommunityToolkit.Maui.Views;
|
||||
using QwirkleClassLibrary.Games;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Qwirkle;
|
||||
|
||||
public partial class PopUpEndGame : Popup
|
||||
{
|
||||
public PopUpEndGame()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var scoreboard = game.ObservableScoreBoard.OrderByDescending(x => x.Value).ThenBy(x => x.Key);
|
||||
ScoreboardList = new ObservableCollection<KeyValuePair<string, int>>(scoreboard);
|
||||
}
|
||||
|
||||
private Game game = ((App)Application.Current!).Game;
|
||||
|
||||
private ObservableCollection<KeyValuePair<string, int>>? scoreboardList;
|
||||
public ObservableCollection<KeyValuePair<string, int>>? ScoreboardList
|
||||
{
|
||||
get => scoreboardList;
|
||||
set
|
||||
{
|
||||
if (scoreboardList != value)
|
||||
{
|
||||
scoreboardList = value;
|
||||
OnPropertyChanged(nameof(ScoreboardList));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async void OnButtonNextClick(object sender, EventArgs e)
|
||||
{
|
||||
await CloseAsync();
|
||||
}
|
||||
|
||||
}
|
After Width: | Height: | Size: 586 KiB |
@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Qwirkle.Views.ScoreboardLine"
|
||||
x:Name="root">
|
||||
<StackLayout>
|
||||
<Grid ColumnDefinitions="4*, auto, 2*"
|
||||
RowDefinitions="50">
|
||||
|
||||
<Label
|
||||
Grid.Column="0"
|
||||
Text="{Binding Nameplayer, Source={x:Reference root}}"
|
||||
Style="{StaticResource ContentTab}"/>
|
||||
|
||||
<Rectangle
|
||||
Style="{StaticResource RectangleTab}"
|
||||
Grid.Column="1"/>
|
||||
|
||||
<Label
|
||||
Grid.Column="2"
|
||||
Text="{Binding Score, Source={x:Reference root}}"
|
||||
Style="{StaticResource ContentTab}"/>
|
||||
</Grid>
|
||||
<Rectangle/>
|
||||
</StackLayout>
|
||||
</ContentView>
|
@ -1,43 +0,0 @@
|
||||
|
||||
|
||||
namespace Qwirkle.Views
|
||||
{
|
||||
public partial class ScoreboardLine : ContentView
|
||||
{
|
||||
public static readonly BindableProperty NameplayerProperty =
|
||||
BindableProperty.Create(nameof(Nameplayer), typeof(string), typeof(ScoreboardLine), default(string), propertyChanged: OnPlayerChanged);
|
||||
|
||||
public string Nameplayer
|
||||
{
|
||||
get => (string)GetValue(NameplayerProperty);
|
||||
set => SetValue(NameplayerProperty, value);
|
||||
}
|
||||
|
||||
private static void OnPlayerChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
var bin = (ScoreboardLine)bindable;
|
||||
bin.OnPropertyChanged(nameof(Nameplayer));
|
||||
}
|
||||
|
||||
public static readonly BindableProperty ScoreProperty =
|
||||
BindableProperty.Create(nameof(Score), typeof(int), typeof(ScoreboardLine), default(int), propertyChanged: OnScoreChanged);
|
||||
|
||||
public int Score
|
||||
{
|
||||
get => (int)GetValue(ScoreProperty);
|
||||
set => SetValue(ScoreProperty, value);
|
||||
}
|
||||
|
||||
private static void OnScoreChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
var bin = (ScoreboardLine)bindable;
|
||||
bin.OnPropertyChanged(nameof(Score));
|
||||
}
|
||||
|
||||
public ScoreboardLine()
|
||||
{
|
||||
InitializeComponent();
|
||||
BindingContext = this;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue