Added basic score page
This commit is contained in:
@@ -140,7 +140,11 @@ namespace YJMPD_UWP
|
|||||||
|
|
||||||
private async void BackToGame_Click(object sender, RoutedEventArgs e)
|
private async void BackToGame_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
bool b = await Util.ShowConfirmDialog("Not implemented", "", Util.DialogType.OKCANCEL);
|
bool b = await Util.ShowConfirmDialog("View Scores", "Go to the scores page (test)?", Util.DialogType.OKCANCEL);
|
||||||
|
if(b)
|
||||||
|
{
|
||||||
|
App.Navigate(typeof(ScoreView));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Content_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
|
private void Content_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
|
||||||
|
|||||||
@@ -8,7 +8,13 @@
|
|||||||
<Setter Property="TextWrapping" Value="WrapWholeWords" />
|
<Setter Property="TextWrapping" Value="WrapWholeWords" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style TargetType="StackPanel" x:Key="Base">
|
<Style TargetType="StackPanel" x:Key="BaseStackPanel">
|
||||||
|
<Setter Property="Margin" Value="10" />
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="RelativePanel" x:Key="BaseRelativePanel">
|
||||||
|
<Setter Property="Margin" Value="10" />
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="Grid" x:Key="BaseGrid">
|
||||||
<Setter Property="Margin" Value="10" />
|
<Setter Property="Margin" Value="10" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
@@ -23,6 +29,11 @@
|
|||||||
<Setter Property="FontSize" Value="14" />
|
<Setter Property="FontSize" Value="14" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="TextBlock" x:Key="Icon">
|
||||||
|
<Setter Property="FontFamily" Value="Segoe MDL2 Assets" />
|
||||||
|
<Setter Property="FontSize" Value="14" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
<Style TargetType="Button" x:Key="Green">
|
<Style TargetType="Button" x:Key="Green">
|
||||||
<Setter Property="Background" Value="DarkGreen" />
|
<Setter Property="Background" Value="DarkGreen" />
|
||||||
<Setter Property="Foreground" Value="White" />
|
<Setter Property="Foreground" Value="White" />
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using YJMPD_UWP.Model.Object;
|
||||||
|
|
||||||
|
namespace YJMPD_UWP.ViewModels
|
||||||
|
{
|
||||||
|
public class ScoreVM : TemplateVM
|
||||||
|
{
|
||||||
|
private List<Player> players;
|
||||||
|
|
||||||
|
public ScoreVM() : base("Scores")
|
||||||
|
{
|
||||||
|
this.players = App.Game.Players.OrderBy(p => p.Points).ToList();
|
||||||
|
App.Game.OnPlayersUpdate += Game_OnPlayersUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Game_OnPlayersUpdate(object sender, Helpers.EventArgs.GamePlayersUpdatedEventArgs e)
|
||||||
|
{
|
||||||
|
dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
|
||||||
|
{
|
||||||
|
this.players = App.Game.Players.OrderBy(p => p.Points).ToList();
|
||||||
|
NotifyPropertyChanged(nameof(Players));
|
||||||
|
NotifyPropertyChanged(nameof(PlayersCount));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Player> Players
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return new List<Player>(players);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string PlayersCount
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return "There are currently " + App.Game.Players.Count + " players in the match.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|
||||||
<ScrollViewer>
|
<ScrollViewer>
|
||||||
<StackPanel Style="{StaticResource Base}" >
|
<StackPanel Style="{StaticResource BaseStackPanel}" >
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Style="{StaticResource Header}" Text="About this app" />
|
<TextBlock Style="{StaticResource Header}" Text="About this app" />
|
||||||
<TextBlock>
|
<TextBlock>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
</Page.Resources>
|
</Page.Resources>
|
||||||
|
|
||||||
<ScrollViewer>
|
<ScrollViewer>
|
||||||
<StackPanel Style="{StaticResource Base}" >
|
<StackPanel Style="{StaticResource BaseStackPanel}" >
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Text="Start a match" Style="{StaticResource Header}" />
|
<TextBlock Text="Start a match" Style="{StaticResource Header}" />
|
||||||
<Button Content="Start match" Style="{StaticResource Green}" Click="StartMatchButton_Click" IsEnabled="{Binding MatchAvailable}" Visibility="{Binding StartMatch, Converter={StaticResource BoolToVisConverter}}" />
|
<Button Content="Start match" Style="{StaticResource Green}" Click="StartMatchButton_Click" IsEnabled="{Binding MatchAvailable}" Visibility="{Binding StartMatch, Converter={StaticResource BoolToVisConverter}}" />
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<Page
|
||||||
|
x:Class="YJMPD_UWP.Views.ScoreView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="using:YJMPD_UWP.Views"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
|
||||||
|
<ScrollViewer>
|
||||||
|
<Grid Style="{StaticResource BaseGrid}" >
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<StackPanel Margin="0,10,0,0" Grid.Row="0">
|
||||||
|
<TextBlock Text="Players" Style="{StaticResource Header}" />
|
||||||
|
|
||||||
|
<TextBlock Text="{Binding PlayersCount}" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<ListView x:Name="PlayersList" ItemsSource="{Binding Players}" SelectionMode="None" Grid.Row="1" IsTapEnabled="False">
|
||||||
|
<ListView.ItemTemplate>
|
||||||
|
<DataTemplate x:Name="ListViewDataTemplate">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Text="{Binding Username}" Margin="0,0,5,0" />
|
||||||
|
<TextBlock Text="{Binding Points}" Margin="0,0,5,0" />
|
||||||
|
<TextBlock Text="{Binding PointsTotal}" />
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListView.ItemTemplate>
|
||||||
|
</ListView>
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="2">
|
||||||
|
<Button Style="{StaticResource Green}" Name="ReadyButton" Click="ReadyButton_Click">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Style="{StaticResource Icon}" Text="" Visibility="Collapsed" Name="ReadyCheck" Margin="0,0,10,0" />
|
||||||
|
<TextBlock Text="Ready" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</ScrollViewer>
|
||||||
|
</Page>
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices.WindowsRuntime;
|
||||||
|
using Windows.Foundation;
|
||||||
|
using Windows.Foundation.Collections;
|
||||||
|
using Windows.UI.Xaml;
|
||||||
|
using Windows.UI.Xaml.Controls;
|
||||||
|
using Windows.UI.Xaml.Controls.Primitives;
|
||||||
|
using Windows.UI.Xaml.Data;
|
||||||
|
using Windows.UI.Xaml.Input;
|
||||||
|
using Windows.UI.Xaml.Media;
|
||||||
|
using Windows.UI.Xaml.Navigation;
|
||||||
|
using YJMPD_UWP.ViewModels;
|
||||||
|
|
||||||
|
namespace YJMPD_UWP.Views
|
||||||
|
{
|
||||||
|
public sealed partial class ScoreView : Page
|
||||||
|
{
|
||||||
|
ScoreVM scorevm;
|
||||||
|
|
||||||
|
public ScoreView()
|
||||||
|
{
|
||||||
|
scorevm = new ScoreVM();
|
||||||
|
this.DataContext = scorevm;
|
||||||
|
this.InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReadyButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ReadyCheck.Visibility = Visibility.Visible;
|
||||||
|
ReadyButton.IsEnabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|
||||||
<ScrollViewer>
|
<ScrollViewer>
|
||||||
<StackPanel Style="{StaticResource Base}" >
|
<StackPanel Style="{StaticResource BaseStackPanel}" >
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Text="Username" Style="{StaticResource Header}" />
|
<TextBlock Text="Username" Style="{StaticResource Header}" />
|
||||||
<TextBox Text="{Binding Username, Mode=TwoWay}" />
|
<TextBox Text="{Binding Username, Mode=TwoWay}" />
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|
||||||
<ScrollViewer>
|
<ScrollViewer>
|
||||||
<StackPanel Style="{StaticResource Base}" >
|
<StackPanel Style="{StaticResource BaseStackPanel}" >
|
||||||
|
|
||||||
<StackPanel Margin="0,10,0,0">
|
<StackPanel Margin="0,10,0,0">
|
||||||
<TextBlock Text="{Binding Information}" Style="{StaticResource Subtext}" />
|
<TextBlock Text="{Binding Information}" Style="{StaticResource Subtext}" />
|
||||||
|
|||||||
@@ -119,6 +119,7 @@
|
|||||||
<Compile Include="ViewModels\AboutVM.cs" />
|
<Compile Include="ViewModels\AboutVM.cs" />
|
||||||
<Compile Include="ViewModels\MainPageVM.cs" />
|
<Compile Include="ViewModels\MainPageVM.cs" />
|
||||||
<Compile Include="ViewModels\MatchVM.cs" />
|
<Compile Include="ViewModels\MatchVM.cs" />
|
||||||
|
<Compile Include="ViewModels\ScoreVM.cs" />
|
||||||
<Compile Include="ViewModels\SettingsVM.cs" />
|
<Compile Include="ViewModels\SettingsVM.cs" />
|
||||||
<Compile Include="ViewModels\StatisticsVM.cs" />
|
<Compile Include="ViewModels\StatisticsVM.cs" />
|
||||||
<Compile Include="ViewModels\TemplateVM.cs" />
|
<Compile Include="ViewModels\TemplateVM.cs" />
|
||||||
@@ -128,6 +129,9 @@
|
|||||||
<Compile Include="Views\MatchView.xaml.cs">
|
<Compile Include="Views\MatchView.xaml.cs">
|
||||||
<DependentUpon>MatchView.xaml</DependentUpon>
|
<DependentUpon>MatchView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Views\ScoreView.xaml.cs">
|
||||||
|
<DependentUpon>ScoreView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Views\SettingsView.xaml.cs">
|
<Compile Include="Views\SettingsView.xaml.cs">
|
||||||
<DependentUpon>SettingsView.xaml</DependentUpon>
|
<DependentUpon>SettingsView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -183,6 +187,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Views\ScoreView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Views\SettingsView.xaml">
|
<Page Include="Views\SettingsView.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
|
|||||||
Reference in New Issue
Block a user