138 lines
6.6 KiB
XML
138 lines
6.6 KiB
XML
|
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||
|
|
xmlns:vm="using:TournamentOrganizer.ViewModels"
|
||
|
|
mc:Ignorable="d" d:DesignWidth="1000" d:DesignHeight="600"
|
||
|
|
x:Class="TournamentOrganizer.Views.GamesView"
|
||
|
|
x:DataType="vm:GamesViewModel">
|
||
|
|
<Design.DataContext>
|
||
|
|
<vm:GamesViewModel />
|
||
|
|
</Design.DataContext>
|
||
|
|
|
||
|
|
<UserControl.Styles>
|
||
|
|
<Style Selector="Button.dropdown-item">
|
||
|
|
<Setter Property="Padding" Value="8,4"/>
|
||
|
|
<Setter Property="BorderThickness" Value="0"/>
|
||
|
|
<Setter Property="Background" Value="Transparent"/>
|
||
|
|
<Setter Property="HorizontalContentAlignment" Value="Left"/>
|
||
|
|
</Style>
|
||
|
|
<Style Selector="Button.dropdown-item:pointerover">
|
||
|
|
<Setter Property="Background" Value="{DynamicResource SystemControlBackgroundListLowBrush}"/>
|
||
|
|
</Style>
|
||
|
|
</UserControl.Styles>
|
||
|
|
|
||
|
|
<Grid RowDefinitions="Auto,*,Auto" ColumnDefinitions="*,*">
|
||
|
|
<TextBlock Grid.ColumnSpan="2" Grid.Row="0" Text="Games Management" FontSize="20" FontWeight="Bold" Margin="16,16,16,8"/>
|
||
|
|
|
||
|
|
<!-- Left Panel: Game List and Filter -->
|
||
|
|
<Border Grid.Column="0" Grid.Row="1" BorderBrush="Gray" BorderThickness="1" Margin="8" CornerRadius="4" Padding="8">
|
||
|
|
<DockPanel>
|
||
|
|
<!-- Header with New Game button -->
|
||
|
|
<DockPanel DockPanel.Dock="Top" Margin="0,0,0,8">
|
||
|
|
<Button Command="{Binding CreateNewGameCommand}" DockPanel.Dock="Right" Padding="8,4">
|
||
|
|
<StackPanel Orientation="Horizontal" Spacing="4">
|
||
|
|
<TextBlock Text="+" FontSize="16" FontWeight="Bold" VerticalAlignment="Center"/>
|
||
|
|
<TextBlock Text="New Game" VerticalAlignment="Center"/>
|
||
|
|
</StackPanel>
|
||
|
|
</Button>
|
||
|
|
<TextBlock Text="Games" FontSize="16" FontWeight="SemiBold" VerticalAlignment="Center"/>
|
||
|
|
</DockPanel>
|
||
|
|
|
||
|
|
<!-- Filter -->
|
||
|
|
<StackPanel DockPanel.Dock="Top" Spacing="6" Margin="0,0,0,8">
|
||
|
|
<TextBlock Text="Filters" FontWeight="SemiBold" FontSize="12"/>
|
||
|
|
<TextBox Watermark="Filter by game name..." Text="{Binding FilterGameName}"/>
|
||
|
|
</StackPanel>
|
||
|
|
|
||
|
|
<!-- Game List -->
|
||
|
|
<ListBox ItemsSource="{Binding Games}"
|
||
|
|
SelectedItem="{Binding SelectedGame}">
|
||
|
|
<ListBox.ItemTemplate>
|
||
|
|
<DataTemplate x:DataType="vm:GameDisplay">
|
||
|
|
<StackPanel Spacing="2">
|
||
|
|
<TextBlock Text="{Binding Name}" FontWeight="SemiBold"/>
|
||
|
|
<TextBlock Text="{Binding S1RuleSetName, StringFormat='Stage 1: {0}'}" FontSize="11" Foreground="Gray"/>
|
||
|
|
<TextBlock Text="{Binding S2RuleSetName, StringFormat='Stage 2: {0}'}" FontSize="11" Foreground="Gray" IsVisible="{Binding S2RuleSet, Converter={x:Static ObjectConverters.IsNotNull}}"/>
|
||
|
|
<ItemsControl ItemsSource="{Binding AssociatedEvents}">
|
||
|
|
<ItemsControl.ItemTemplate>
|
||
|
|
<DataTemplate x:DataType="x:String">
|
||
|
|
<TextBlock Text="{Binding, StringFormat='Event: {0}'}" FontSize="10" Foreground="#1976D2"/>
|
||
|
|
</DataTemplate>
|
||
|
|
</ItemsControl.ItemTemplate>
|
||
|
|
</ItemsControl>
|
||
|
|
</StackPanel>
|
||
|
|
</DataTemplate>
|
||
|
|
</ListBox.ItemTemplate>
|
||
|
|
</ListBox>
|
||
|
|
</DockPanel>
|
||
|
|
</Border>
|
||
|
|
|
||
|
|
<!-- Right Panel: Game Editor -->
|
||
|
|
<Border Grid.Column="1" Grid.Row="1" BorderBrush="Gray" BorderThickness="1" Margin="8" CornerRadius="4" Padding="8">
|
||
|
|
<DockPanel>
|
||
|
|
<TextBlock DockPanel.Dock="Top" Text="Game Details" FontSize="16" FontWeight="SemiBold" Margin="0,0,0,8"/>
|
||
|
|
|
||
|
|
<StackPanel DockPanel.Dock="Bottom" Spacing="6" Margin="0,8,0,0">
|
||
|
|
<Button Content="Save Game" Command="{Binding SaveGameCommand}" HorizontalAlignment="Stretch" IsEnabled="{Binding IsEditing}"/>
|
||
|
|
<Button Content="Delete Game" Command="{Binding DeleteGameCommand}" HorizontalAlignment="Stretch" IsEnabled="{Binding IsEditing}"/>
|
||
|
|
</StackPanel>
|
||
|
|
|
||
|
|
<ScrollViewer>
|
||
|
|
<StackPanel Spacing="8" IsEnabled="{Binding IsEditing}">
|
||
|
|
<!-- Game Name -->
|
||
|
|
<StackPanel Spacing="4">
|
||
|
|
<TextBlock Text="Game Name" FontWeight="SemiBold"/>
|
||
|
|
<TextBox Text="{Binding GameName}"/>
|
||
|
|
</StackPanel>
|
||
|
|
|
||
|
|
<!-- Description -->
|
||
|
|
<StackPanel Spacing="4">
|
||
|
|
<TextBlock Text="Description" FontWeight="SemiBold"/>
|
||
|
|
<TextBox Text="{Binding GameDescription}" AcceptsReturn="True" TextWrapping="Wrap" MinHeight="60"/>
|
||
|
|
</StackPanel>
|
||
|
|
|
||
|
|
<!-- Stage 1 -->
|
||
|
|
<StackPanel Spacing="4">
|
||
|
|
<TextBlock Text="Stage 1 Rule Set" FontWeight="SemiBold"/>
|
||
|
|
<ComboBox ItemsSource="{Binding S1RuleSetOptions}" SelectedItem="{Binding SelectedS1RuleSet}">
|
||
|
|
<ComboBox.ItemTemplate>
|
||
|
|
<DataTemplate x:DataType="vm:RuleSetOption">
|
||
|
|
<TextBlock Text="{Binding Label}"/>
|
||
|
|
</DataTemplate>
|
||
|
|
</ComboBox.ItemTemplate>
|
||
|
|
</ComboBox>
|
||
|
|
</StackPanel>
|
||
|
|
|
||
|
|
<!-- Stage 2 (optional) -->
|
||
|
|
<StackPanel Spacing="4">
|
||
|
|
<TextBlock Text="Stage 2 Rule Set (optional)" FontWeight="SemiBold"/>
|
||
|
|
<ComboBox ItemsSource="{Binding S2RuleSetOptions}" SelectedItem="{Binding SelectedS2RuleSet}">
|
||
|
|
<ComboBox.ItemTemplate>
|
||
|
|
<DataTemplate x:DataType="vm:RuleSetOption">
|
||
|
|
<TextBlock Text="{Binding Label}"/>
|
||
|
|
</DataTemplate>
|
||
|
|
</ComboBox.ItemTemplate>
|
||
|
|
</ComboBox>
|
||
|
|
</StackPanel>
|
||
|
|
|
||
|
|
<!-- Stage 1 Group Settings (only shown when Stage 2 is enabled) -->
|
||
|
|
<StackPanel Spacing="4" IsVisible="{Binding ShowStage1GroupSettings}">
|
||
|
|
<TextBlock Text="Stage 1 Groups" FontWeight="SemiBold"/>
|
||
|
|
<NumericUpDown Value="{Binding S1Groups}" Minimum="1" Maximum="100"/>
|
||
|
|
</StackPanel>
|
||
|
|
|
||
|
|
<StackPanel Spacing="4" IsVisible="{Binding ShowStage1GroupSettings}">
|
||
|
|
<TextBlock Text="Stage 1 Group Advances" FontWeight="SemiBold"/>
|
||
|
|
<NumericUpDown Value="{Binding S1GroupAdvances}" Minimum="1" Maximum="100"/>
|
||
|
|
</StackPanel>
|
||
|
|
</StackPanel>
|
||
|
|
</ScrollViewer>
|
||
|
|
</DockPanel>
|
||
|
|
</Border>
|
||
|
|
|
||
|
|
<!-- Status Bar -->
|
||
|
|
<TextBlock Grid.ColumnSpan="2" Grid.Row="2" Text="{Binding StatusMessage}" Margin="8" Foreground="Gray" FontSize="12"/>
|
||
|
|
</Grid>
|
||
|
|
</UserControl>
|