174 lines
10 KiB
XML
174 lines
10 KiB
XML
<UserControl xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:vm="using:LANCommander.Launcher.ViewModels.Components"
|
|
xmlns:controls="using:LANCommander.Launcher.Controls"
|
|
x:Class="LANCommander.Launcher.Views.Components.GameActionBarView"
|
|
x:DataType="vm:GameActionBarViewModel"
|
|
controls:AutoFocus.IsEnabled="True">
|
|
|
|
<UserControl.Styles>
|
|
<!-- Running state: "Running" text visible, "Stop" hidden -->
|
|
<Style Selector="SplitButton.Running TextBlock.RunningState">
|
|
<Setter Property="Opacity" Value="1" />
|
|
<Setter Property="Transitions">
|
|
<Setter.Value>
|
|
<Transitions>
|
|
<DoubleTransition Property="Opacity" Duration="0:0:0.15" />
|
|
</Transitions>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
<Style Selector="SplitButton.Running StackPanel.Stop">
|
|
<Setter Property="Opacity" Value="0" />
|
|
<Setter Property="Transitions">
|
|
<Setter.Value>
|
|
<Transitions>
|
|
<DoubleTransition Property="Opacity" Duration="0:0:0.15" />
|
|
</Transitions>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<!-- Hover: fade out "Running", fade in "Stop" -->
|
|
<Style Selector="SplitButton.Running:pointerover TextBlock.RunningState">
|
|
<Setter Property="Opacity" Value="0" />
|
|
</Style>
|
|
<Style Selector="SplitButton.Running:pointerover StackPanel.Stop">
|
|
<Setter Property="Opacity" Value="1" />
|
|
</Style>
|
|
|
|
<!-- Make the caret/secondary button independently focusable for gamepad navigation -->
|
|
<Style Selector="SplitButton /template/ Button#PART_SecondaryButton">
|
|
<Setter Property="Focusable" Value="True" />
|
|
<Setter Property="IsTabStop" Value="True" />
|
|
</Style>
|
|
|
|
<!-- Hover: turn button red (error/danger) -->
|
|
<Style Selector="SplitButton.Running:pointerover /template/ Button#PART_PrimaryButton /template/ ContentPresenter#PART_ContentPresenter">
|
|
<Setter Property="Background" Value="{DynamicResource ButtonErrorBgBrush}" />
|
|
</Style>
|
|
<Style Selector="SplitButton.Running:pointerover /template/ Button#PART_SecondaryButton /template/ ContentPresenter#PART_ContentPresenter">
|
|
<Setter Property="Background" Value="{DynamicResource ButtonErrorBgBrush}" />
|
|
</Style>
|
|
<Style Selector="SplitButton.Running:pointerover /template/ Button#PART_PrimaryButton:pressed /template/ ContentPresenter#PART_ContentPresenter">
|
|
<Setter Property="Background" Value="{DynamicResource ButtonErrorActiveBrush}" />
|
|
</Style>
|
|
<Style Selector="SplitButton.Running:pointerover /template/ Button#PART_SecondaryButton:pressed /template/ ContentPresenter#PART_ContentPresenter">
|
|
<Setter Property="Background" Value="{DynamicResource ButtonErrorActiveBrush}" />
|
|
</Style>
|
|
</UserControl.Styles>
|
|
|
|
<StackPanel Spacing="12" HorizontalAlignment="Left">
|
|
<!-- Game Action Bar -->
|
|
<Border Padding="0,0,0,8"
|
|
Background="Transparent">
|
|
<StackPanel Spacing="16">
|
|
<!-- Primary Action Row + Stats -->
|
|
<Grid ColumnDefinitions="Auto,*,Auto">
|
|
<!-- Buttons (left side) -->
|
|
<StackPanel Grid.Column="0" Orientation="Horizontal" Spacing="12">
|
|
<!-- Install SplitButton (not installed). Flyout assigned in code-behind. -->
|
|
<SplitButton x:Name="InstallSplitButton"
|
|
Command="{Binding InstallCommand}"
|
|
IsVisible="{Binding !IsInstalled}"
|
|
IsEnabled="{Binding CanInstall}"
|
|
Classes="Primary Large">
|
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
|
<TextBlock Text="Install" FontWeight="SemiBold" IsVisible="{Binding !IsInstalling}" />
|
|
<TextBlock Text="Installing..." IsVisible="{Binding IsInstalling}" />
|
|
</StackPanel>
|
|
</SplitButton>
|
|
|
|
<!-- Play / Update / Stop SplitButton (installed) -->
|
|
<SplitButton x:Name="PlaySplitButton"
|
|
Command="{Binding PrimaryActionCommand}"
|
|
IsVisible="{Binding IsInstalled}"
|
|
IsEnabled="{Binding PlayButtonIsEnabled}"
|
|
Classes.Running="{Binding IsRunning}"
|
|
Classes.Starting="{Binding IsStarting}"
|
|
Classes.Stopping="{Binding IsStopping}"
|
|
Classes="Primary Large">
|
|
<Panel>
|
|
<!-- Idle + update available: Update -->
|
|
<StackPanel Orientation="Horizontal" Spacing="8"
|
|
IsVisible="{Binding ShowUpdateLabel}">
|
|
<TextBlock Text="Update" FontWeight="SemiBold" IsVisible="{Binding !IsInstalling}" />
|
|
<TextBlock Text="Updating..." IsVisible="{Binding IsInstalling}" />
|
|
</StackPanel>
|
|
|
|
<!-- Idle + no update: Play / Starting -->
|
|
<StackPanel Orientation="Horizontal" Spacing="8"
|
|
IsVisible="{Binding ShowPlayLabel}">
|
|
<TextBlock Text="▶" FontWeight="Bold" IsVisible="{Binding !IsStarting}" />
|
|
<TextBlock Text="Play" FontWeight="SemiBold" IsVisible="{Binding !IsStarting}" />
|
|
<TextBlock Text="Starting" IsVisible="{Binding IsStarting}" />
|
|
</StackPanel>
|
|
|
|
<!-- Running: overlapping "Running" and "Stop" labels -->
|
|
<Panel IsVisible="{Binding IsRunning}">
|
|
<!-- Shown by default; fades out on hover via CSS -->
|
|
<TextBlock Classes="RunningState" IsVisible="{Binding !IsStopping}" Text="Running" />
|
|
<TextBlock Classes="StoppingState" IsVisible="{Binding IsStopping}" Text="Stopping" />
|
|
<!-- Hidden by default; fades in on hover via CSS -->
|
|
<StackPanel Classes="Stop" Orientation="Horizontal" Spacing="8">
|
|
<PathIcon Data="{StaticResource Regular_Stop}"
|
|
Width="14" Height="14" />
|
|
<TextBlock Text="Stop" FontWeight="SemiBold" />
|
|
</StackPanel>
|
|
</Panel>
|
|
</Panel>
|
|
<!-- Flyout assigned in code-behind (consolidated game menu). -->
|
|
</SplitButton>
|
|
|
|
<!-- Debug Scripts button (when script debugging is enabled and installed) -->
|
|
<SplitButton Command="{Binding OpenPowerShellConsoleCommand}"
|
|
IsVisible="{Binding IsScriptDebuggingEnabled}"
|
|
IsEnabled="{Binding IsInstalled}"
|
|
Padding="12,14"
|
|
ToolTip.Tip="Debug Scripts">
|
|
<TextBlock Text="🐛" />
|
|
|
|
<SplitButton.Flyout>
|
|
<MenuFlyout Placement="BottomEdgeAlignedLeft">
|
|
<MenuItem Header="Open PowerShell Console" Command="{Binding OpenPowerShellConsoleCommand}" />
|
|
<Separator />
|
|
<MenuItem Header="Run Install Scripts" Command="{Binding RunInstallScriptsCommand}" />
|
|
<MenuItem Header="Run Uninstall Scripts" Command="{Binding RunUninstallScriptsCommand}" />
|
|
<MenuItem Header="Run Name Change Scripts" Command="{Binding RunNameChangeScriptsCommand}" />
|
|
<MenuItem Header="Run Key Change Scripts" Command="{Binding RunKeyChangeScriptsCommand}" />
|
|
</MenuFlyout>
|
|
</SplitButton.Flyout>
|
|
</SplitButton>
|
|
<!-- Add to Library -->
|
|
<IconButton Command="{Binding AddToLibraryCommand}"
|
|
IsVisible="{Binding !IsInLibrary}"
|
|
IsEnabled="{Binding !IsAddingToLibrary}"
|
|
Classes="Text"
|
|
IconType="Regular"
|
|
IconValue="Plus"
|
|
Padding="12"
|
|
ToolTip.Tip="Add to Library" />
|
|
|
|
</StackPanel>
|
|
|
|
<!-- Stats (right side) -->
|
|
<StackPanel Grid.Column="2" Orientation="Horizontal" Spacing="32" VerticalAlignment="Center" Margin="48,0,0,0">
|
|
<StackPanel Spacing="2"
|
|
IsVisible="{Binding DownloadSizeText, Converter={x:Static StringConverters.IsNotNullOrEmpty}}">
|
|
<TextBlock Text="Download Size" FontSize="11" Opacity="0.6" />
|
|
<TextBlock Text="{Binding DownloadSizeText}" FontSize="14" FontWeight="SemiBold" />
|
|
</StackPanel>
|
|
<StackPanel Spacing="2">
|
|
<TextBlock Text="Play Time" FontSize="11" Opacity="0.6" />
|
|
<TextBlock Text="{Binding PlayTime}" FontSize="14" FontWeight="SemiBold" />
|
|
</StackPanel>
|
|
<StackPanel Spacing="2">
|
|
<TextBlock Text="Last Played" FontSize="11" Opacity="0.6" />
|
|
<TextBlock Text="{Binding LastPlayed}" FontSize="14" FontWeight="SemiBold" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</Grid>
|
|
</StackPanel>
|
|
</Border>
|
|
</StackPanel>
|
|
</UserControl>
|