parent
15f0c4e1ef
commit
09d2d5adb5
@ -1,50 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
|
||||||
x:Class="Qwirkle.Pages.Scoreboard"
|
|
||||||
xmlns:controls="clr-namespace:Qwirkle.Views"
|
|
||||||
Title="Scoreboard">
|
|
||||||
<ScrollView>
|
|
||||||
<VerticalStackLayout Spacing="25" Padding="5, 5, 5, 10">
|
|
||||||
|
|
||||||
<Grid Style="{StaticResource GridMain}">
|
|
||||||
<controls:GoBack></controls:GoBack>
|
|
||||||
<Label Text="Scoreboard"
|
|
||||||
Style="{StaticResource Title}"
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Border Style="{StaticResource TabBorder}">
|
|
||||||
|
|
||||||
<Border.Shadow>
|
|
||||||
<Shadow/>
|
|
||||||
</Border.Shadow>
|
|
||||||
<Border.StrokeShape>
|
|
||||||
<RoundRectangle CornerRadius="3"/>
|
|
||||||
</Border.StrokeShape>
|
|
||||||
|
|
||||||
<VerticalStackLayout>
|
|
||||||
<controls:ScoreboardLine></controls:ScoreboardLine>
|
|
||||||
<Rectangle/>
|
|
||||||
|
|
||||||
<controls:ScoreboardLine></controls:ScoreboardLine>
|
|
||||||
<Rectangle/>
|
|
||||||
|
|
||||||
<controls:ScoreboardLine></controls:ScoreboardLine>
|
|
||||||
<Rectangle/>
|
|
||||||
|
|
||||||
<controls:ScoreboardLine></controls:ScoreboardLine>
|
|
||||||
<Rectangle/>
|
|
||||||
|
|
||||||
<controls:ScoreboardLine></controls:ScoreboardLine>
|
|
||||||
<Rectangle/>
|
|
||||||
|
|
||||||
</VerticalStackLayout>
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
</VerticalStackLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
</ContentPage>
|
|
@ -1,9 +0,0 @@
|
|||||||
namespace Qwirkle.Pages;
|
|
||||||
|
|
||||||
public partial class Scoreboard : ContentPage
|
|
||||||
{
|
|
||||||
public Scoreboard()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,24 @@
|
|||||||
|
<?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.Scoreboard"
|
||||||
|
xmlns:controls="clr-namespace:Qwirkle.Views"
|
||||||
|
x:Name="root">
|
||||||
|
|
||||||
|
|
||||||
|
<VerticalStackLayout MaximumWidthRequest="200" Background="Transparent">
|
||||||
|
|
||||||
|
<CollectionView ItemsSource="{Binding NamesPlayers}">
|
||||||
|
<CollectionView.ItemsLayout>
|
||||||
|
<GridItemsLayout Orientation="Vertical"/>
|
||||||
|
</CollectionView.ItemsLayout>
|
||||||
|
<CollectionView.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<controls:ScoreboardLine Nameplayer="{Binding NameTag}"></controls:ScoreboardLine>
|
||||||
|
</DataTemplate>
|
||||||
|
</CollectionView.ItemTemplate>
|
||||||
|
</CollectionView>
|
||||||
|
|
||||||
|
</VerticalStackLayout>
|
||||||
|
|
||||||
|
</ContentView>
|
@ -0,0 +1,57 @@
|
|||||||
|
using QwirkleClassLibrary.Players;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace Qwirkle.Views;
|
||||||
|
|
||||||
|
public partial class Scoreboard : ContentView, INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
private IOrderedEnumerable<KeyValuePair<Player, int>> scoreboard;
|
||||||
|
private Dictionary<Player, int> currentScoreBoard;
|
||||||
|
|
||||||
|
private List<Player> namesPlayers;
|
||||||
|
public List<Player> NamesPlayers
|
||||||
|
{
|
||||||
|
get => namesPlayers;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (namesPlayers != value)
|
||||||
|
{
|
||||||
|
namesPlayers = value;
|
||||||
|
OnPropertyChanged(nameof(NamesPlayers));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public Scoreboard()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
BindingContext = this;
|
||||||
|
|
||||||
|
scoreboard = ((App)Application.Current!).Game.ScoreBoard.OrderByDescending(x => x.Value).ThenBy(x => x.Key.NameTag);
|
||||||
|
currentScoreBoard = scoreboard.ToDictionary<Player, int>();
|
||||||
|
|
||||||
|
NamesPlayers = currentScoreBoard.Keys.ToList();
|
||||||
|
|
||||||
|
((App)Application.Current!).Game.Board.PropertyChanged += Board_PropertyChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Board_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
scoreboard = ((App)Application.Current!).Game.ScoreBoard.OrderByDescending(x => x.Value).ThenBy(x => x.Key.NameTag);
|
||||||
|
currentScoreBoard = scoreboard.ToDictionary<Player, int>();
|
||||||
|
|
||||||
|
NamesPlayers = currentScoreBoard.Keys.ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler? PropertyChanged;
|
||||||
|
|
||||||
|
protected void OnPropertyChanged(string propertyName)
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in new issue