0
0
mirror of https://github.com/sp-tarkov/launcher.git synced 2025-02-12 17:10:44 -05:00

Merge pull request 'next' (!62) from waffle.lord/Launcher:next into master

Reviewed-on: SPT/Launcher#62
This commit is contained in:
IsWaffle 2024-07-08 22:44:26 +00:00
commit 8ca094cc56
36 changed files with 1016 additions and 602 deletions

View File

@ -141,7 +141,6 @@ namespace SPT.Launcher
try
{
Process.Start(clientProcess);
LogManager.Instance.Info("[LaunchGame] Game process started");
}

View File

@ -13,7 +13,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>

View File

@ -1,31 +1,48 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SPT.Launcher"
x:Class="SPT.Launcher.App">
x:Class="SPT.Launcher.App"
RequestedThemeVariant="Dark"
>
<Application.DataTemplates>
<local:ViewLocator/>
</Application.DataTemplates>
<Application.Styles>
<StyleInclude Source="avares://DialogHost.Avalonia/Styles.xaml"/>
<FluentTheme Mode="Light"/>
<FluentTheme />
</Application.Styles>
<Application.Resources>
<!-- Colors -->
<Color x:Key="SPT_DarkGray">#121212</Color>
<Color x:Key="SPT_Yellow">#FFC107</Color>
<Color x:Key="SPT_White">#FFFFFF</Color>
<Color x:Key="SPT_Gray">#282828</Color>
<Color x:Key="SPT_DarkGrayBlue">#323947</Color>
<!-- Brushes -->
<SolidColorBrush x:Key="SPT_Foreground_Light" Color="{StaticResource SPT_White}"/>
<SolidColorBrush x:Key="SPT_Background_Light" Color="{StaticResource SPT_Gray}"/>
<SolidColorBrush x:Key="SPT_Background_Dark" Color="{StaticResource SPT_DarkGray}"/>
<SolidColorBrush x:Key="SPT_Brush_Yellow" Color="{StaticResource SPT_Yellow}"/>
<SolidColorBrush x:Key="SPT_Brush_DarkGrayBlue" Color="{StaticResource SPT_DarkGrayBlue}"/>
<SolidColorBrush x:Key="SPT_Brush_Lighter" Color="Gainsboro"/>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<!-- let's be real... we are never going to use a light theme lol -waffle.lazy -->
<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="AccentBrush">#436082</SolidColorBrush>
<SolidColorBrush x:Key="AccentBrush2">#567ca8</SolidColorBrush>
<SolidColorBrush x:Key="AccentBrush3">#6998ce</SolidColorBrush>
<SolidColorBrush x:Key="AltAccentBrush">#6a6357</SolidColorBrush>
<SolidColorBrush x:Key="AltAccentBrush2">#908676</SolidColorBrush>
<SolidColorBrush x:Key="AltAccentBrush3">#b6a995</SolidColorBrush>
<SolidColorBrush x:Key="BackgroundBrush">White</SolidColorBrush>
<SolidColorBrush x:Key="BackgroundBrush2">#cccccc</SolidColorBrush>
<SolidColorBrush x:Key="AltBackgroundBrush">#cca480</SolidColorBrush>
<SolidColorBrush x:Key="ForegroundBrush">Black</SolidColorBrush>
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="AccentBrush">#54a4ff</SolidColorBrush>
<SolidColorBrush x:Key="AccentBrush2">#4383cc</SolidColorBrush>
<SolidColorBrush x:Key="AccentBrush3">#326299</SolidColorBrush>
<SolidColorBrush x:Key="AltAccentBrush">#b2a58d</SolidColorBrush>
<SolidColorBrush x:Key="AltAccentBrush2">#7f7564</SolidColorBrush>
<SolidColorBrush x:Key="AltAccentBrush3">#4c463b</SolidColorBrush>
<SolidColorBrush x:Key="BackgroundBrush">#181a1b</SolidColorBrush>
<SolidColorBrush x:Key="BackgroundBrush2">#393e41</SolidColorBrush>
<SolidColorBrush x:Key="AltBackgroundBrush">#37332d</SolidColorBrush>
<SolidColorBrush x:Key="ForegroundBrush">White</SolidColorBrush>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
<!-- Path Geometry for re-usable icons -->
<PathGeometry x:Key="FolderWithPlus" Figures="M20 6h-8l-2-2H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-1 8h-3v3h-2v-3h-3v-2h3V9h2v3h3v2z" FillRule="NonZero"

View File

@ -1,24 +1,64 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cc="using:SPT.Launcher.CustomControls"
xmlns:rxui="using:Avalonia.ReactiveUI"
>
<Design.PreviewWith>
<StackPanel Spacing="5" Background="{StaticResource SPT_Background_Dark}" Margin="50">
<Button Content="Blah"/>
<TextBox Text="Some cool text here" Margin="5"/>
<TextBox Watermark="This is a watermark" Margin="5"/>
<CheckBox Content="This is a checkbox"/>
<Border Classes="card">
<StackPanel Spacing="5" Margin="50">
<Label Content="Some label here"/>
<Label Content="Some acc label here" Classes="acc"/>
<Label Content="Some alt label here" Classes="alt"/>
<Label Classes="versionMismatch" Content="invalid version tag" />
<Button Content="button" />
<Button Content="outlined button" Classes="outlined"></Button>
<Button Content="Icon button" Classes="icon"/>
<Button Content="acc button" Classes="acc"/>
<Button Content="alt button" Classes="alt"/>
<Button IsEnabled="False" Content="disabled button"/>
<Button Content="link button" Classes="link"/>
<Button Content="underline link button" Classes="ulink"/>
<ComboBox SelectedIndex="0">
<ComboBoxItem>Item 1</ComboBoxItem>
<ComboBoxItem>Item 2</ComboBoxItem>
<ComboBoxItem>Item 3</ComboBoxItem>
</ComboBox>
<TextBox Text="Some cool text here" Margin="5" />
<TextBox Watermark="This is a watermark" Margin="5" />
<CheckBox Content="unchecked" />
<CheckBox Content="checked" IsChecked="True"/>
<ProgressBar Value="40" />
<ProgressBar IsIndeterminate="True" />
<ProgressBar Classes="error" />
</StackPanel>
</Border>
</Design.PreviewWith>
<!-- Add Styles Here -->
<!-- Textblock Styles -->
<Style Selector="TextBlock.alt">
<Setter Property="Foreground" Value="{DynamicResource AltAccentBrush}"/>
</Style>
<!-- Border Styles -->
<Style Selector="Border.card">
<Setter Property="CornerRadius" Value="5"/>
<Setter Property="BoxShadow" Value="2 5 5 black"/>
<Setter Property="BorderBrush" Value="{DynamicResource AltBackgroundBrush}"/>
<Setter Property="Background" Value="{DynamicResource BackgroundBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Margin" Value="10"></Setter>
</Style>
<!-- BoxShadow="2 5 5 black"></Setter> CornerRadius="5" -->
<!-- BorderBrush="{DynamicResource AltBackgroundBrush}" -->
<!-- Background="{DynamicResource BackgroundBrush}" -->
<!-- Margin="15" -->
<!-- BorderThickness="1" -->
<!-- Notification Manager Styles -->
<Style Selector="WindowNotificationManager">
<Setter Property="Margin" Value="0 35 0 0"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="MaxItems" Value="2"/>
</Style>
@ -40,89 +80,46 @@
</LayoutTransformControl>
</ControlTemplate>
</Setter>
<Style.Animations>
<Animation Duration="0:0:0.45" Easing="SineEaseIn" FillMode="Forward">
<KeyFrame Cue="0%">
<Setter Property="Opacity" Value="0"/>
<Setter Property="ZIndex" Value="0"/>
<Setter Property="TranslateTransform.Y" Value="-100"/>
<Setter Property="ScaleTransform.ScaleX" Value="1"/>
<Setter Property="ScaleTransform.ScaleY" Value="1"/>
</KeyFrame>
<KeyFrame Cue="30%">
<Setter Property="Opacity" Value="0"/>
</KeyFrame>
<KeyFrame Cue="99%">
<Setter Property="ZIndex" Value="0"/>
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="Opacity" Value="1"/>
<Setter Property="ZIndex" Value="1"/>
<Setter Property="TranslateTransform.Y" Value="0"/>
<Setter Property="ScaleTransform.ScaleX" Value="1"/>
<Setter Property="ScaleTransform.ScaleY" Value="1"/>
</KeyFrame>
</Animation>
</Style.Animations>
</Style>
<Style Selector="NotificationCard[IsClosing=true] /template/ LayoutTransformControl#PART_LayoutTransformControl">
<Style.Animations>
<Animation Duration="0:0:0.3" Easing="SineEaseOut" FillMode="Backward">
<KeyFrame Cue="0%">
<Setter Property="Opacity" Value="1"/>
<Setter Property="TranslateTransform.X" Value="0"/>
<Setter Property="TranslateTransform.Y" Value="0"/>
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="Opacity" Value="0"/>
<Setter Property="TranslateTransform.X" Value="0"/>
<Setter Property="TranslateTransform.Y" Value="-100"/>
</KeyFrame>
</Animation>
</Style.Animations>
</Style>
<!-- TitleBar Styles -->
<Style Selector="cc|TitleBar">
<Setter Property="Background" Value="{StaticResource SPT_Background_Dark}"/>
<Setter Property="Foreground" Value="{StaticResource SPT_Foreground_Light}"/>
<Setter Property="ButtonForeground" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/>
<Setter Property="Background" Value="{DynamicResource BackgroundBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
<Setter Property="ButtonForeground" Value="{DynamicResource AltAccentBrush}"/>
</Style>
<Style Selector="cc|TitleBar.versiontag">
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_Yellow}"/>
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/>
<Setter Property="BorderThickness" Value="0 0 0 2"/>
</Style>
<!-- TextBox Styles -->
<!-- SourceRef: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/TextBox.xaml -->
<Style Selector="TextBox">
<Setter Property="Background" Value="{StaticResource SPT_Background_Light}"/>
<Setter Property="Background" Value="{DynamicResource BackgroundBrush2}"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Foreground" Value="{StaticResource SPT_Brush_Lighter}"/>
<Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
</Style>
<Style Selector="TextBox:focus">
<Setter Property="Foreground" Value="{StaticResource SPT_Brush_Lighter}"/>
<Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
</Style>
<Style Selector="TextBox:pointerover">
<Setter Property="Foreground" Value="{StaticResource SPT_Brush_Lighter}"/>
<Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
</Style>
<Style Selector="TextBox:pointerover /template/ Border#PART_BorderElement">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="DimGray"/>
<Setter Property="BorderBrush" Value="{DynamicResource AltAccentBrush}"/>
</Style>
<Style Selector="TextBox:pointerover /template/ TextBlock#PART_Watermark, TextBox:focus /template/ TextBlock#PART_FloatingWatermark">
<Setter Property="Foreground" Value="DimGray"/>
<Setter Property="Foreground" Value="{DynamicResource AltAccentBrush2}"/>
</Style>
<Style Selector="TextBox:focus /template/ TextBlock#PART_Watermark, TextBox:focus /template/ TextBlock#PART_FloatingWatermark">
<Setter Property="Foreground" Value="DimGray"/>
<Setter Property="Foreground" Value="{DynamicResource AltAccentBrush3}"/>
</Style>
<Style Selector="TextBox /template/ TextBlock#PART_Watermark, TextBox:focus /template/ TextBlock#PART_FloatingWatermark">
@ -131,22 +128,21 @@
<Style Selector="TextBox:focus /template/ Border#PART_BorderElement">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_Yellow}"/>
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
<!-- Label Styles -->
<!-- SourceRef: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/Label.xaml -->
<Style Selector="Label">
<Setter Property="Foreground" Value="{StaticResource SPT_Foreground_Light}"/>
<Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
</Style>
<Style Selector="Label.yellow">
<Setter Property="Foreground" Value="{StaticResource SPT_Brush_Yellow}"/>
<Style Selector="Label.acc">
<Setter Property="Foreground" Value="{DynamicResource AccentBrush}"/>
</Style>
<Style Selector="Label.dark">
<Setter Property="Foreground" Value="DimGray"/>
<Style Selector="Label.alt">
<Setter Property="Foreground" Value="{DynamicResource AltAccentBrush}"/>
</Style>
<Style Selector="Label.versionMismatch">
@ -154,10 +150,9 @@
</Style>
<!-- ProgressBar Styles -->
<!-- SourceRef: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/ProgressBar.xaml -->
<Style Selector="ProgressBar">
<Setter Property="Foreground" Value="{StaticResource SPT_Brush_Yellow}"/>
<Setter Property="Background" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/>
<Setter Property="Foreground" Value="{DynamicResource AccentBrush}"/>
<Setter Property="Background" Value="{DynamicResource BackgroundBrush2}"/>
</Style>
<Style Selector="ProgressBar.error">
@ -165,11 +160,9 @@
<Style.Animations>
<Animation Duration="0:0:0.5" FillMode="Forward">
<KeyFrame Cue="0%">
<Setter Property="Foreground" Value="{StaticResource SPT_Brush_Yellow}"/>
<Setter Property="Value" Value="0"/>
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="Foreground" Value="Red"/>
<Setter Property="Value" Value="100"/>
</KeyFrame>
</Animation>
@ -177,159 +170,176 @@
</Style>
<!-- Seperator Styles -->
<!-- SourceRef: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/Separator.xaml -->
<Style Selector="Separator">
<Setter Property="Background" Value="{StaticResource SPT_Background_Dark}"/>
<Setter Property="Background" Value="{DynamicResource BackgroundBrush}"/>
</Style>
<!-- Button Styles -->
<!-- SourceRef: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/Button.xaml -->
<Style Selector="Button">
<Setter Property="Background" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/>
<Setter Property="Foreground" Value="{StaticResource SPT_Background_Dark}"/>
</Style>
<Style Selector="Button:pointerover">
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Background" Value="{DynamicResource BackgroundBrush2}"/>
<Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
</Style>
<Style Selector="Button:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{StaticResource SPT_Background_Light}"/>
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_Yellow}"/>
<Setter Property="Background" Value="{DynamicResource BackgroundBrush2}"/>
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush2}"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
<Style Selector="Button:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="{StaticResource SPT_Brush_Yellow}"/>
<Setter Property="Background" Value="{DynamicResource AccentBrush}"/>
</Style>
<Style Selector="Button:disabled /template/ ContentPresenter">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BackgroundBrush2}"/>
</Style>
<!-- Button yellow -->
<Style Selector="Button.yellow">
<Setter Property="Background" Value="{StaticResource SPT_Brush_Yellow}"/>
<Setter Property="Foreground" Value="{StaticResource SPT_Background_Dark}"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<!-- Button acc -->
<Style Selector="Button.acc">
<Setter Property="Background" Value="{DynamicResource AccentBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
</Style>
<Style Selector="Button.yellow:pointerover">
<Setter Property="FontWeight" Value="SemiBold"/>
</Style>
<Style Selector="Button.yellow:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="Gold"/>
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/>
<Style Selector="Button.acc:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource AccentBrush2}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BackgroundBrush2}"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
<Style Selector="Button.yellow:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="{StaticResource SPT_Brush_Lighter}"/>
<Style Selector="Button.acc:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource AccentBrush3}"/>
</Style>
<Style Selector="Button.yellow:disabled /template/ ContentPresenter">
<Style Selector="Button.acc:disabled /template/ ContentPresenter">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BackgroundBrush2}"/>
</Style>
<!-- Button Link Style -->
<Style Selector="Button.link">
<Setter Property="Foreground" Value="{StaticResource SPT_Brush_Lighter}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<!-- Button alt -->
<Style Selector="Button.alt">
<Setter Property="Background" Value="{DynamicResource AltAccentBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
</Style>
<Style Selector="Button.link:pointerover /template/ ContentPresenter">
<Setter Property="TextBlock.Foreground" Value="{StaticResource SPT_Brush_Yellow}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
</Style>
<Style Selector="Button.link:pressed /template/ ContentPresenter">
<Setter Property="TextBlock.Foreground" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
</Style>
<!-- Button Bordered Link Style -->
<Style Selector="Button.borderedlink">
<Setter Property="Foreground" Value="{StaticResource SPT_Brush_Lighter}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_Lighter}"/>
<Style Selector="Button.alt:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource AltAccentBrush2}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BackgroundBrush2}"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
<Style Selector="Button.borderedlink:pointerover /template/ ContentPresenter">
<Setter Property="TextBlock.Foreground" Value="{StaticResource SPT_Brush_Yellow}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_Yellow}"/>
<Style Selector="Button.alt:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource AltAccentBrush3}"/>
</Style>
<Style Selector="Button.borderedlink:pressed /template/ ContentPresenter">
<Setter Property="TextBlock.Foreground" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/>
<Style Selector="Button.alt:disabled /template/ ContentPresenter">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BackgroundBrush2}"/>
</Style>
<!-- Button Link Styles -->
<Style Selector="Button.ulink">
<Setter Property="TextBlock.TextDecorations" Value="Underline"/>
</Style>
<Style Selector="Button.link, Button.ulink">
<Setter Property="Foreground" Value="{DynamicResource AltAccentBrush}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
</Style>
<!-- Button Profile Info Style -->
<Style Selector="Button.profileinfo">
<Setter Property="Background" Value="{StaticResource SPT_Background_Dark}"/>
<Setter Property="BorderBrush" Value="{StaticResource SPT_Background_Dark}"/>
<Style Selector="Button.link:pointerover /template/ ContentPresenter, Button.ulink:pointerover /template/ ContentPresenter">
<Setter Property="TextBlock.Foreground" Value="{DynamicResource AccentBrush}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
</Style>
<Style Selector="Button.link:pressed /template/ ContentPresenter, Button.ulink:pressed /template/ ContentPresenter">
<Setter Property="TextBlock.Foreground" Value="{DynamicResource AccentBrush3}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
</Style>
<!-- Outlined Button -->
<Style Selector="Button.outlined">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
<Style Selector="Button.outlined:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource AltBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush2}"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
<Style Selector="Button.outlined:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource AccentBrush3}"/>
</Style>
<Style Selector="Button.outlined:disabled /template/ ContentPresenter">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{DynamicResource BackgroundBrush2}"/>
</Style>
<!-- Icon button -->
<Style Selector="Button.icon">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
<Style Selector="Button.icon:pointerover">
<Setter Property="Background" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/>
<Style Selector="Button.icon:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource AltBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush2}"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
<Style Selector="Button.icon:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource AccentBrush3}"/>
</Style>
<Style Selector="Button.icon:disabled /template/ ContentPresenter">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{DynamicResource BackgroundBrush2}"/>
</Style>
<!-- Checkbox styles -->
<!-- SourceRef: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/CheckBox.xaml -->
<Style Selector="CheckBox">
<Setter Property="Foreground" Value="{StaticResource SPT_Foreground_Light}"/>
<Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
</Style>
<Style Selector="CheckBox /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BackgroundBrush2}"/>
</Style>
<Style Selector="CheckBox:pointerover /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_Yellow}"/>
</Style>
<Style Selector="CheckBox:pointerover /template/ ContentPresenter#ContentPresenter">
<Setter Property="TextBlock.Foreground" Value="{StaticResource SPT_Foreground_Light}" />
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/>
</Style>
<Style Selector="CheckBox:checked">
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Foreground" Value="{StaticResource SPT_Foreground_Light}"/>
<Setter Property="Foreground" Value="{DynamicResource AccentBrush}"/>
</Style>
<Style Selector="CheckBox:checked /template/ Border#NormalRectangle">
<Setter Property="Background" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/>
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_Yellow}"/>
<Setter Property="Background" Value="{DynamicResource BackgroundBrush2}"/>
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/>
</Style>
<Style Selector="CheckBox:checked /template/ Path#CheckGlyph">
<Setter Property="Fill" Value="{StaticResource SPT_Brush_Yellow}"/>
<Setter Property="Fill" Value="{DynamicResource AccentBrush}"/>
</Style>
<!-- ComboBox Styles -->
<!-- Source Ref: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/ComboBox.xaml -->
<Style Selector="ComboBox">
<Setter Property="Foreground" Value="{StaticResource SPT_Foreground_Light}"/>
<Setter Property="PlaceholderForeground" Value="{StaticResource SPT_Brush_Lighter}"/>
<Setter Property="Background" Value="{StaticResource SPT_Background_Dark}"/>
<Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
<Setter Property="PlaceholderForeground" Value="{DynamicResource ForegroundBrush}"/>
<Setter Property="Background" Value="{DynamicResource BackgroundBrush}"/>
<Setter Property="Template">
<ControlTemplate>
<DataValidationErrors>
@ -357,8 +367,8 @@
Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
Background="{DynamicResource ComboBoxBackgroundUnfocused}"
BorderBrush="{DynamicResource ComboBoxBackgroundBorderBrushUnfocused}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}" />
<TextBlock x:Name="PlaceholderTextBlock"
@ -402,7 +412,9 @@
<Panel Height="12"
Width="12" />
<Path x:Name="DropDownGlyph"
VerticalAlignment="Center" />
VerticalAlignment="Center"
Data="M1939 486L2029 576L1024 1581L19 576L109 486L1024 1401L1939 486Z"
/>
</Panel>
</Viewbox>
<Popup Name="PART_Popup"
@ -413,8 +425,8 @@
PlacementTarget="Background"
IsLightDismissEnabled="True">
<Border x:Name="PopupBorder"
Background="{StaticResource SPT_Background_Dark}"
BorderBrush="{StaticResource SPT_Background_Dark}"
Background="{DynamicResource BackgroundBrush2}"
BorderBrush="{DynamicResource BackgroundBrush2}"
BorderThickness="{DynamicResource ComboBoxDropdownBorderThickness}"
Margin="0,-1,0,-1"
Padding="{DynamicResource ComboBoxDropdownBorderPadding}"
@ -423,11 +435,9 @@
<ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
<ItemsPresenter Name="PART_ItemsPresenter"
Items="{TemplateBinding Items}"
Margin="{DynamicResource ComboBoxDropdownContentMargin}"
ItemsPanel="{TemplateBinding ItemsPanel}"
ItemTemplate="{TemplateBinding ItemTemplate}"
VirtualizationMode="{TemplateBinding VirtualizationMode}" />
/>
</ScrollViewer>
</Border>
</Popup>
@ -437,48 +447,42 @@
</Setter>
</Style>
<Style Selector="ComboBox">
<Setter Property="Background" Value="{DynamicResource AltBackgroundBrush}"/>
</Style>
<Style Selector="ComboBox:dropdownopen">
<Setter Property="Background" Value="{DynamicResource BackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/>
</Style>
<Style Selector="ComboBox /template/ Path#DropDownGlyph">
<Setter Property="Fill" Value="{StaticResource SPT_Foreground_Light}" />
<Setter Property="Fill" Value="{DynamicResource ForegroundBrush}" />
</Style>
<Style Selector="ComboBox:pointerover /template/ Path#DropDownGlyph">
<Setter Property="Fill" Value="{StaticResource SPT_Brush_Yellow}" />
<Setter Property="Fill" Value="{DynamicResource AccentBrush}" />
</Style>
<Style Selector="ComboBox:pointerover">
<Setter Property="Foreground" Value="{StaticResource SPT_Brush_Yellow}"/>
</Style>
<Style Selector="ComboBox:pointerover /template/ Border#Background">
<Setter Property="Background" Value="Black"/>
<Setter Property="BorderBrush" Value="Black" />
</Style>
<Style Selector="ComboBox /template/ Border#PopupBorder">
<Setter Property="Background" Value="Black"/>
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="Foreground" Value="{DynamicResource AccentBrush}"/>
</Style>
<!-- ComboBoxItem Styles -->
<!-- Source Ref: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/ComboBoxItem.xaml-->
<Style Selector="ComboBoxItem /template/ ContentPresenter">
<Setter Property="Background" Value="Black"/>
</Style>
<Style Selector="ComboBoxItem">
<Setter Property="Foreground" Value="{StaticResource SPT_Foreground_Light}"/>
<Setter Property="Background" Value="{StaticResource SPT_Background_Dark}"/>
<Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
<Setter Property="Background" Value="{DynamicResource BackgroundBrush2}"/>
</Style>
<Style Selector="ComboBoxItem:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{StaticResource SPT_Background_Light}" />
<Setter Property="BorderBrush" Value="{StaticResource SPT_Background_Light}" />
<Setter Property="TextBlock.Foreground" Value="{StaticResource SPT_Foreground_Light}" />
<Setter Property="Background" Value="{DynamicResource AltAccentBrush2}" />
<Setter Property="BorderBrush" Value="{DynamicResource BackgroundBrush2}" />
<Setter Property="TextBlock.Foreground" Value="{DynamicResource ForegroundBrush}" />
</Style>
<Style Selector="ComboBoxItem:selected /template/ ContentPresenter">
<Setter Property="Background" Value="{StaticResource SPT_Brush_Yellow}" />
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_Yellow}" />
<Setter Property="TextBlock.Foreground" Value="{StaticResource SPT_Background_Dark}" />
<Setter Property="Background" Value="{DynamicResource AccentBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}" />
<Setter Property="TextBlock.Foreground" Value="{DynamicResource ForegroundBrush}" />
</Style>
</Styles>

View File

@ -0,0 +1,113 @@
<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:helpers="using:SPT.Launcher.Helpers"
xmlns:cvt="using:SPT.Launcher.Converters"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPT.Launcher.CustomControls.DetailedProfileCard"
MinWidth="250" MinHeight="250"
PointerEntered="InputElement_OnPointerEntered"
PointerExited="InputElement_OnPointerExited"
PointerPressed="InputElement_OnPointerPressed"
PointerReleased="InputElement_OnPointerReleased"
>
<UserControl.Resources>
<cvt:ImageSourceConverter x:Key="ImageSourceCvt" />
</UserControl.Resources>
<Border x:Name="CardBorder" Classes="card" Margin="15">
<Border.Transitions>
<Transitions>
<TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.200"/>
<BrushTransition Duration="0:0:0.200" Property="Background" />
<BoxShadowsTransition Property="BoxShadow" Duration="0:0:0.200" />
<DoubleTransition Property="Opacity" Duration="0:0:0.200" />
</Transitions>
</Border.Transitions>
<Grid RowDefinitions="Auto, Auto, *, Auto, Auto" ColumnDefinitions="Auto, *, Auto" Margin="10">
<!-- SPT version -->
<Label x:Name="SptVersion" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3"
Background="Transparent" HorizontalAlignment="Center"
ToolTip.Tip="{Binding $parent[UserControl].ProfileInfo.MismatchMessage}"
Classes.versionMismatch="{Binding $parent[UserControl].ProfileInfo.VersionMismatch}"
>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding $parent[UserControl].ProfileInfo.SPT.version}"
/>
<Path Data="{StaticResource Alert}" Fill="{Binding ElementName=SptVersion, Path=Foreground}"
Margin="10 0"
IsVisible="{Binding $parent[UserControl].ProfileInfo.VersionMismatch}"
/>
</StackPanel>
</Label>
<!-- Side image -->
<Image Grid.Row="1" Grid.Column="0"
Source="{Binding $parent[UserControl].ProfileInfo.SideImage, Converter={StaticResource ImageSourceCvt}}"
Height="50" />
<!-- Name and nickname -->
<StackPanel Grid.Row="1" Grid.Column="1" Margin="10 0 0 0">
<Label Content="{Binding $parent[UserControl].ProfileInfo.Username}" FontSize="18" FontWeight="SemiBold"
/>
<Label Content="{Binding $parent[UserControl].ProfileInfo.Nickname}" FontSize="16" Classes="acc"
IsVisible="{Binding $parent[UserControl].ProfileInfo.HasData}"
/>
</StackPanel>
<!-- No data label -->
<Label Grid.Row="0" Grid.RowSpan="5" Grid.Column="1"
Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=no_profile_data}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontWeight="SemiBold"
Classes="alt"
IsVisible="{Binding !$parent[UserControl].ProfileInfo.HasData}"
/>
<!-- Level -->
<StackPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3"
HorizontalAlignment="Center" VerticalAlignment="Center">
<Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=level}"
IsVisible="{Binding HasData}"
FontSize="20"
HorizontalAlignment="Center"
Margin="0"
Padding="0"
Classes="alt"
/>
<Label Content="{Binding $parent[UserControl].ProfileInfo.Level}"
FontSize="30"
FontWeight="Bold"
Margin="0"
Padding="0"
IsVisible="{Binding HasData}"
HorizontalAlignment="Center"
/>
</StackPanel>
<!-- remaining xp -->
<StackPanel Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3"
HorizontalAlignment="Center"
Orientation="Horizontal"
IsVisible="{Binding $parent[UserControl].ProfileInfo.HasData}"
>
<Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=next_level_in}"/>
<Label Content="{Binding $parent[UserControl].ProfileInfo.RemainingExp}"
FontWeight="SemiBold"
Classes="acc"
/>
<Label Content="xp"/>
</StackPanel>
<!-- xp progress -->
<ProgressBar Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="3"
Value="{Binding $parent[UserControl].ProfileInfo.XPLevelProgress}"
IsVisible="{Binding $parent[UserControl].ProfileInfo.HasData}"
/>
</Grid>
</Border>
</UserControl>

View File

@ -0,0 +1,107 @@
using System.Threading.Tasks;
using System.Windows.Input;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Media;
using Avalonia.Media.Immutable;
using Avalonia.Media.Transformation;
using Avalonia.Threading;
using SPT.Launcher.Models.Launcher;
namespace SPT.Launcher.CustomControls;
public partial class DetailedProfileCard : UserControl
{
public DetailedProfileCard()
{
InitializeComponent();
var border = this.GetControl<Border>("CardBorder");
border.Opacity = 0;
border.BoxShadow = BoxShadows.Parse("0 0 0 black");
border.RenderTransform = TransformOperations.Parse("scale(0.95)");
Task.Run(async () =>
{
await Dispatcher.UIThread.InvokeAsync(async () =>
{
border.Opacity = 1;
border.RenderTransform = TransformOperations.Parse("scale(1)");
border.BoxShadow = BoxShadows.Parse("2 5 5 black");
});
});
}
public static readonly StyledProperty<ProfileInfo> ProfileInfoProperty =
AvaloniaProperty.Register<DetailedProfileCard, ProfileInfo>(
"ProfileInfo");
public ProfileInfo ProfileInfo
{
get => GetValue(ProfileInfoProperty);
set => SetValue(ProfileInfoProperty, value);
}
public static readonly StyledProperty<ICommand> LoginCommandProperty = AvaloniaProperty.Register<DetailedProfileCard, ICommand>(
"LoginCommand");
public ICommand LoginCommand
{
get => GetValue(LoginCommandProperty);
set => SetValue(LoginCommandProperty, value);
}
private void InputElement_OnPointerEntered(object? sender, PointerEventArgs e)
{
if (Application.Current != null && Application.Current.TryFindResource("AltBackgroundBrush", this.ActualThemeVariant, out var brush))
{
if (brush is ImmutableSolidColorBrush immutableBrush)
{
var border = this.GetControl<Border>("CardBorder");
border.BoxShadow = BoxShadows.Parse("5 7 10 black");
border.Background = immutableBrush;
border.RenderTransform = TransformOperations.Parse("scale(1.02)");
}
}
}
private void InputElement_OnPointerExited(object? sender, PointerEventArgs e)
{
if (Application.Current != null && Application.Current.TryFindResource("BackgroundBrush", this.ActualThemeVariant, out var brush))
{
if (brush is ImmutableSolidColorBrush immutableBrush)
{
var border = this.GetControl<Border>("CardBorder");
border.BoxShadow = BoxShadows.Parse("2 5 5 black");
border.Background = immutableBrush;
border.RenderTransform = TransformOperations.Parse("scale(1)");
}
}
}
private void InputElement_OnPointerPressed(object? sender, PointerPressedEventArgs e)
{
var border = this.GetControl<Border>("CardBorder");
border.RenderTransform = TransformOperations.Parse("scale(0.98)");
}
private void InputElement_OnPointerReleased(object? sender, PointerReleasedEventArgs e)
{
var border = this.GetControl<Border>("CardBorder");
var pos = e.GetPosition(border);
if (border.Bounds.Contains(pos))
{
// pointer was released inside the control
border.RenderTransform = TransformOperations.Parse("scale(1.02)");
LoginCommand.Execute(ProfileInfo.Username);
return;
}
border.RenderTransform = TransformOperations.Parse("scale(1)");
}
}

View File

@ -0,0 +1,61 @@
<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:cvt="using:SPT.Launcher.Converters"
xmlns:helpers="using:SPT.Launcher.Helpers"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPT.Launcher.CustomControls.GameLaunchBar">
<UserControl.Resources>
<cvt:ImageSourceConverter x:Key="ImageSourceCvt" />
</UserControl.Resources>
<Border Classes="card">
<DockPanel Background="{DynamicResource BackgroundBrush}" Margin="2">
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Stretch"
Spacing="10"
IsVisible="{Binding $parent[UserControl].ProfileInfo.HasData}">
<Grid RowDefinitions="AUTO,AUTO" ColumnDefinitions="AUTO,AUTO">
<Image Source="{Binding $parent[UserControl].ProfileInfo.SideImage, Converter={StaticResource ImageSourceCvt}}"
Grid.RowSpan="2" Height="40" Margin="10 0" />
<Label Content="{Binding $parent[UserControl].ProfileInfo.Nickname}" Grid.Row="0" Grid.Column="2" Classes="acc"/>
<Label Content="{Binding $parent[UserControl].ProfileInfo.Side}" Grid.Row="1" Grid.Column="2" />
</Grid>
<Label Content="{Binding $parent[UserControl].ProfileInfo.Level}" VerticalAlignment="Center"
FontSize="22" />
<ProgressBar Value="{Binding $parent[UserControl].ProfileInfo.XPLevelProgress}" />
<StackPanel>
<Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=next_level_in}"
HorizontalAlignment="Center"
/>
<StackPanel Orientation="Horizontal">
<Label Content="{Binding $parent[UserControl].ProfileInfo.RemainingExp}"
HorizontalAlignment="Center"
Classes="acc"/>
<Label Content="xp"/>
</StackPanel>
</StackPanel>
</StackPanel>
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=start_game}"
HorizontalAlignment="Right"
VerticalContentAlignment="Center"
VerticalAlignment="Stretch"
DockPanel.Dock="Right"
Command="{Binding $parent[UserControl].StartGameCommand}"
IsEnabled="{Binding Source={x:Static helpers:LauncherSettingsProvider.Instance}, Path=!GameRunning}"
Classes="acc" />
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=logout}"
Command="{Binding $parent[UserControl].LogoutCommand}"
Margin="10 0"
Classes="ulink"
DockPanel.Dock="Right"
HorizontalAlignment="Right" />
</DockPanel>
</Border>
</UserControl>

View File

@ -0,0 +1,41 @@
using System.Windows.Input;
using Avalonia;
using Avalonia.Controls;
using SPT.Launcher.Models.Launcher;
namespace SPT.Launcher.CustomControls;
public partial class GameLaunchBar : UserControl
{
public GameLaunchBar()
{
InitializeComponent();
}
public static readonly StyledProperty<ProfileInfo> ProfileInfoProperty = AvaloniaProperty.Register<GameLaunchBar, ProfileInfo>(
"ProfileInfo");
public ProfileInfo ProfileInfo
{
get => GetValue(ProfileInfoProperty);
set => SetValue(ProfileInfoProperty, value);
}
public static readonly StyledProperty<ICommand> StartGameCommandProperty = AvaloniaProperty.Register<GameLaunchBar, ICommand>(
"StartGameCommand");
public ICommand StartGameCommand
{
get => GetValue(StartGameCommandProperty);
set => SetValue(StartGameCommandProperty, value);
}
public static readonly StyledProperty<ICommand> LogoutCommandProperty = AvaloniaProperty.Register<GameLaunchBar, ICommand>(
"LogoutCommand");
public ICommand LogoutCommand
{
get => GetValue(LogoutCommandProperty);
set => SetValue(LogoutCommandProperty, value);
}
}

View File

@ -10,7 +10,7 @@
>
<ComboBox.ItemTemplate>
<DataTemplate DataType="{x:Type model:LocalizedLauncherAction}">
<Label Content="{Binding Name}"/>
<TextBlock Text="{Binding Name}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>

View File

@ -61,7 +61,7 @@ namespace SPT.Launcher.CustomControls
}
}
comboBox.Items = actionsList;
comboBox.ItemsSource = actionsList;
foreach(var item in comboBox.Items)
{

View File

@ -0,0 +1,38 @@
<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:helpers="using:SPT.Launcher.Helpers"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPT.Launcher.CustomControls.LoginBox">
<Border Classes="card">
<Grid RowDefinitions="Auto, Auto" ColumnDefinitions="*, Auto" Margin="10">
<!-- Username box -->
<TextBox Watermark="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=username}"
VerticalAlignment="Center"
MinWidth="250"
Text="{Binding $parent[UserControl].Username}"
Margin="0 0 10 0"
/>
<!-- Login button -->
<Button Grid.Column="1" HorizontalContentAlignment="Center"
Command="{Binding $parent[UserControl].LoginCommand}"
IsEnabled="{Binding !$parent[UserControl].IsLoggingIn}"
IsDefault="True"
Classes="acc"
>
<TextBlock
Text="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=login_or_register}"
TextWrapping="Wrap" />
</Button>
<!-- Auto login checkbox -->
<CheckBox Grid.Row="1"
IsChecked="{Binding Source={x:Static helpers:LauncherSettingsProvider.Instance}, Path=UseAutoLogin}"
Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=login_automatically}"
/>
</Grid>
</Border>
</UserControl>

View File

@ -0,0 +1,40 @@
using System.Windows.Input;
using Avalonia;
using Avalonia.Controls;
namespace SPT.Launcher.CustomControls;
public partial class LoginBox : UserControl
{
public LoginBox()
{
InitializeComponent();
}
public static readonly StyledProperty<string> UsernameProperty = AvaloniaProperty.Register<LoginBox, string>(
"Username");
public string Username
{
get => GetValue(UsernameProperty);
set => SetValue(UsernameProperty, value);
}
public static readonly StyledProperty<ICommand> LoginCommandProperty = AvaloniaProperty.Register<LoginBox, ICommand>(
"LoginCommand");
public ICommand LoginCommand
{
get => GetValue(LoginCommandProperty);
set => SetValue(LoginCommandProperty, value);
}
public static readonly StyledProperty<bool> IsLoggedInProperty = AvaloniaProperty.Register<LoginBox, bool>(
"IsLoggedIn");
public bool IsLoggedIn
{
get => GetValue(IsLoggedInProperty);
set => SetValue(IsLoggedInProperty, value);
}
}

View File

@ -5,12 +5,10 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
xmlns:helpers="using:SPT.Launcher.Helpers"
x:Class="SPT.Launcher.CustomControls.ModInfoCard">
<Border CornerRadius="5" HorizontalAlignment="Stretch"
BorderBrush="{StaticResource SPT_Background_Dark}"
BorderThickness="5"
>
<Border Classes="card" HorizontalAlignment="Stretch">
<Grid RowDefinitions="10,AUTO,AUTO,AUTO,10" ColumnDefinitions="10,AUTO,*,AUTO,10"
Background="{StaticResource SPT_Background_Dark}"
Background="{DynamicResource BackgroundBrush}"
Margin="2"
>
<!-- Icon stack -->
@ -19,19 +17,19 @@
Orientation="Horizontal" Spacing="5"
>
<!-- Server Icon -->
<Path Data="{StaticResource Server}" Fill="{StaticResource SPT_Brush_DarkGrayBlue}"
<Path Data="{StaticResource Server}" Fill="{DynamicResource AltAccentBrush}"
IsVisible="{Binding IsInServer, RelativeSource={RelativeSource AncestorType=UserControl}}"
/>
<!-- Profile Icon -->
<Path Data="{StaticResource Profile}" Fill="{StaticResource SPT_Brush_DarkGrayBlue}"
<Path Data="{StaticResource Profile}" Fill="{DynamicResource AltAccentBrush}"
IsVisible="{Binding IsInProfile, RelativeSource={RelativeSource AncestorType=UserControl}}"
/>
<!-- Info Icon -->
<Canvas>
<Rectangle ToolTip.Tip="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=mod_not_in_server_warning}" Fill="Transparent" Height="20" Width="20"/>
<Path Data="{StaticResource Info}" Fill="DodgerBlue"
<Path Data="{StaticResource Info}" Fill="{DynamicResource AccentBrush}"
ToolTip.Tip="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=mod_not_in_server_warning}"
>
<Path.IsVisible>
@ -54,7 +52,7 @@
>
<StackPanel Orientation="Horizontal">
<Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=open_link}"/>
<Path Data="{StaticResource Open}" Fill="{StaticResource SPT_Brush_Yellow}"
<Path Data="{StaticResource Open}" Fill="{DynamicResource AccentBrush}"
IsVisible="{Binding IsInProfile, RelativeSource={RelativeSource AncestorType=UserControl}}"
/>
</StackPanel>
@ -66,7 +64,7 @@
/>
<!-- Author Text -->
<Label Grid.Row="3" Grid.Column="1" FontSize="12" Foreground="DimGray"
<Label Grid.Row="3" Grid.Column="1" FontSize="12" Foreground="{DynamicResource AltAccentBrush}"
Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=author}"
/>
@ -78,6 +76,7 @@
<!-- Mod Version -->
<Label Grid.Row="3" Grid.Column="3" FontSize="12"
Content="{Binding Version, RelativeSource={RelativeSource AncestorType=UserControl}}"
Classes="acc"
/>
</Grid>
</Border>

View File

@ -0,0 +1,61 @@
<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:helpers="using:SPT.Launcher.Helpers"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPT.Launcher.CustomControls.ProfileCard">
<Border Classes="card">
<Grid RowDefinitions="10,AUTO,AUTO,AUTO,AUTO,10" ColumnDefinitions="10,AUTO,*,10" Margin="2"
Background="{DynamicResource BackgroundBrush}">
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1">
<Label Content="{Binding $parent[UserControl].ProfileInfo.Username}" Margin="5 0" />
<!-- profile name and version -->
<Label x:Name="SPTVersion"
Background="Transparent"
ToolTip.Tip="{Binding $parent[UserControl].ProfileInfo.MismatchMessage}"
Classes.versionMismatch="{Binding $parent[UserControl].ProfileInfo.VersionMismatch}"
Classes.acc="{Binding !$parent[UserControl].ProfileInfo.VersionMismatch}"
>
<StackPanel Orientation="Horizontal" Background="Transparent">
<TextBlock Text="{Binding $parent[UserControl].ProfileInfo.SPT.version}" />
<Path Data="{StaticResource Info}"
Fill="{Binding ElementName=SPTVersion, Path=Foreground}"
Margin="10 0"
IsVisible="{Binding $parent[UserControl].ProfileInfo.VersionMismatch}" />
</StackPanel>
</Label>
</StackPanel>
<!-- delete profile button -->
<Button HorizontalAlignment="Right" Grid.Row="1" Grid.Column="2"
Classes="icon"
Command="{Binding $parent[UserControl].RemoveProfileCommand}"
IsEnabled="{Binding Source={x:Static helpers:LauncherSettingsProvider.Instance}, Path=!GameRunning}">
<Path Data="{StaticResource Delete}" Fill="IndianRed" />
</Button>
<!-- profile id button -->
<Button Content="{Binding $parent[UserControl].CurrentId}" Classes="ulink"
Grid.Row="2" Grid.Column="1"
Command="{Binding $parent[UserControl].CopyCommand}"
CommandParameter="{Binding $parent[UserControl].CurrentId}" />
<!-- profile edition button -->
<Button Content="{Binding $parent[UserControl].CurrentEdition}" Classes="ulink"
Grid.Row="3" Grid.Column="1"
Command="{Binding $parent[UserControl].ChangeEditionCommand}"
IsEnabled="{Binding Source={x:Static helpers:LauncherSettingsProvider.Instance}, Path=!GameRunning}" />
<!-- wipe profile checkbox -->
<CheckBox
Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=wipe_on_start}"
Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="2"
IsChecked="{Binding $parent[UserControl].WipeProfileOnStart}"
IsEnabled="{Binding Source={x:Static helpers:LauncherSettingsProvider.Instance}, Path=!GameRunning}"
IsVisible="{Binding !$parent[UserControl].ProfileWipePending}"
/>
</Grid>
</Border>
</UserControl>

View File

@ -0,0 +1,86 @@
using System.Windows.Input;
using Avalonia;
using Avalonia.Controls;
using SPT.Launcher.Models.Launcher;
namespace SPT.Launcher.CustomControls;
public partial class ProfileCard : UserControl
{
public ProfileCard()
{
InitializeComponent();
}
public static readonly StyledProperty<ProfileInfo> ProfileInfoProperty = AvaloniaProperty.Register<ProfileCard, ProfileInfo>(
"ProfileInfo");
public ProfileInfo ProfileInfo
{
get => GetValue(ProfileInfoProperty);
set => SetValue(ProfileInfoProperty, value);
}
public static readonly StyledProperty<string> CurrentIdProperty = AvaloniaProperty.Register<ProfileCard, string>(
"CurrentId");
public string CurrentId
{
get => GetValue(CurrentIdProperty);
set => SetValue(CurrentIdProperty, value);
}
public static readonly StyledProperty<string> CurrentEditionProperty = AvaloniaProperty.Register<ProfileCard, string>(
"CurrentEdition");
public string CurrentEdition
{
get => GetValue(CurrentEditionProperty);
set => SetValue(CurrentEditionProperty, value);
}
public static readonly StyledProperty<bool> WipeProfileOnStartProperty = AvaloniaProperty.Register<ProfileCard, bool>(
"WipeProfileOnStart");
public bool WipeProfileOnStart
{
get => GetValue(WipeProfileOnStartProperty);
set => SetValue(WipeProfileOnStartProperty, value);
}
public static readonly StyledProperty<bool> ProfileWipePendingProperty = AvaloniaProperty.Register<ProfileCard, bool>(
"ProfileWipePending");
public bool ProfileWipePending
{
get => GetValue(ProfileWipePendingProperty);
set => SetValue(ProfileWipePendingProperty, value);
}
public static readonly StyledProperty<ICommand> RemoveProfileCommandProperty = AvaloniaProperty.Register<ProfileCard, ICommand>(
"RemoveProfileCommand");
public ICommand RemoveProfileCommand
{
get => GetValue(RemoveProfileCommandProperty);
set => SetValue(RemoveProfileCommandProperty, value);
}
public static readonly StyledProperty<ICommand> CopyCommandProperty = AvaloniaProperty.Register<ProfileCard, ICommand>(
"CopyCommand");
public ICommand CopyCommand
{
get => GetValue(CopyCommandProperty);
set => SetValue(CopyCommandProperty, value);
}
public static readonly StyledProperty<ICommand> ChangeEditionCommandProperty = AvaloniaProperty.Register<ProfileCard, ICommand>(
"ChangeEditionCommand");
public ICommand ChangeEditionCommand
{
get => GetValue(ChangeEditionCommandProperty);
set => SetValue(ChangeEditionCommandProperty, value);
}
}

View File

@ -55,11 +55,11 @@
>
<Button.Styles>
<Style Selector="Button:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/>
<Setter Property="Background" Value="{DynamicResource AccentBrush2}"/>
<Setter Property="BorderThickness" Value="0"/>
</Style>
<Style Selector="Button:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="{StaticResource SPT_Background_Light}"/>
<Setter Property="Background" Value="{DynamicResource AccentBrush3}"/>
</Style>
</Button.Styles>
</Button>

View File

@ -0,0 +1,31 @@
<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:helpers="using:SPT.Launcher.Helpers"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPT.Launcher.CustomControls.TotalModsCard">
<Border Classes="card" IsVisible="{Binding ModInfoCollection.HasMods}">
<Grid RowDefinitions="10,AUTO,10" ColumnDefinitions="10,Auto,*,AUTO,10" Margin="2"
Background="{DynamicResource BackgroundBrush}">
<!-- server mods count text -->
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal">
<Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=active_server_mods}" VerticalAlignment="Center"/>
<Label Content="{Binding $parent[UserControl].ActiveModsCount}" Classes="acc" FontWeight="SemiBold" VerticalAlignment="Center"/>
</StackPanel>
<!-- Show mods info view button -->
<Button Grid.Row="0" Grid.RowSpan="3" Grid.Column="3" Grid.ColumnSpan="2"
VerticalAlignment="Stretch" FontSize="18" Margin="10 0 0 0"
Command="{Binding $parent[UserControl].OpenModsInfoCommand}"
Classes="icon">
<Button.Content>
<Path Data="{StaticResource Open}" Fill="{DynamicResource ForegroundBrush}"
VerticalAlignment="Center"
/>
</Button.Content>
</Button>
</Grid>
</Border>
</UserControl>

View File

@ -0,0 +1,33 @@
using System.Collections.ObjectModel;
using System.Windows.Input;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace SPT.Launcher.CustomControls;
public partial class TotalModsCard : UserControl
{
public TotalModsCard()
{
InitializeComponent();
}
public static readonly StyledProperty<int> ActiveModsCountProperty = AvaloniaProperty.Register<TotalModsCard, int>(
"ActiveModsCount");
public int ActiveModsCount
{
get => GetValue(ActiveModsCountProperty);
set => SetValue(ActiveModsCountProperty, value);
}
public static readonly StyledProperty<ICommand> OpenModsInfoCommandProperty = AvaloniaProperty.Register<TotalModsCard, ICommand>(
"OpenModsInfoCommand");
public ICommand OpenModsInfoCommand
{
get => GetValue(OpenModsInfoCommandProperty);
set => SetValue(OpenModsInfoCommandProperty, value);
}
}

View File

@ -7,6 +7,7 @@ using Avalonia.Controls.Notifications;
using Splat;
using System.Collections.Generic;
using System.Threading.Tasks;
using DialogHostAvalonia;
namespace SPT.Launcher.Models
{
@ -30,7 +31,7 @@ namespace SPT.Launcher.Models
var localeText = string.Format(LocalizationProvider.Instance.file_mismatch_dialog_message, serverVersion);
var result = await DialogHost.DialogHost.Show(new ConfirmationDialogViewModel(null, localeText, null, null, LauncherSettingsProvider.Instance.IsDevMode));
var result = await DialogHost.Show(new ConfirmationDialogViewModel(null, localeText, null, null, LauncherSettingsProvider.Instance.IsDevMode));
if(result != null && result is bool confirmation && !confirmation)
{

View File

@ -22,12 +22,13 @@
<Content Include="Assets\icon.ico" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.15" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.15" />
<PackageReference Include="Avalonia" Version="11.1.0-rc2" />
<PackageReference Include="Avalonia.Desktop" Version="11.1.0-rc2" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.12" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.15" />
<PackageReference Include="DialogHost.Avalonia" Version="0.5.0" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.1.0-rc2" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.1.0-rc2" />
<PackageReference Include="DialogHost.Avalonia" Version="0.8.0-avalonia11dot1-3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SPT.ByteBanger\SPT.ByteBanger.csproj" />

View File

@ -7,7 +7,7 @@ namespace SPT.Launcher
{
public class ViewLocator : IDataTemplate
{
public IControl Build(object data)
public Control Build(object data)
{
var name = data.GetType().FullName!.Replace("ViewModel", "View");
var type = Type.GetType(name);

View File

@ -146,8 +146,10 @@ namespace SPT.Launcher.ViewModels
});
}
public void GetExistingProfiles()
public async Task GetExistingProfiles()
{
await Task.Delay(200);
ServerProfileInfo[] existingProfiles = AccountManager.GetExistingProfiles();
if(existingProfiles != null)
@ -164,6 +166,8 @@ namespace SPT.Launcher.ViewModels
ImageHelper sideImage = new ImageHelper() { Path = profileInfo.SideImage };
sideImage.Touch();
await Task.Delay(100);
}
}
}

View File

@ -9,7 +9,7 @@ using SPT.Launcher.Models.SPT;
using SPT.Launcher.Helpers;
using SPT.Launcher.ViewModels.Dialogs;
using Avalonia.Threading;
using dialogHost = DialogHost.DialogHost;
using DialogHostAvalonia;
namespace SPT.Launcher.ViewModels
@ -48,7 +48,7 @@ namespace SPT.Launcher.ViewModels
LocalizationProvider.Instance.yes,
LocalizationProvider.Instance.no);
var confirmCopySettings = await dialogHost.Show(viewModel);
var confirmCopySettings = await DialogHost.Show(viewModel);
if (confirmCopySettings is bool and true)
{

View File

@ -10,6 +10,7 @@ using SPT.Launcher.ViewModels.Dialogs;
using Avalonia.Threading;
using System.Diagnostics;
using System.IO;
using Avalonia.Controls.ApplicationLifetimes;
using SPT.Launcher.Models.SPT;
namespace SPT.Launcher.ViewModels
@ -17,7 +18,7 @@ namespace SPT.Launcher.ViewModels
[RequireLoggedIn]
public class ProfileViewModel : ViewModelBase
{
public string CurrentUsername { get; set; }
// public string CurrentUsername { get; set; }
private string _CurrentEdition;
public string CurrentEdition
@ -40,7 +41,7 @@ namespace SPT.Launcher.ViewModels
set => this.RaiseAndSetIfChanged(ref _ProfileWipePending, value);
}
public string CurrentID { get; set; }
public string CurrentId { get; set; }
public ProfileInfo ProfileInfo { get; set; } = AccountManager.SelectedProfileInfo;
@ -48,9 +49,9 @@ namespace SPT.Launcher.ViewModels
public ModInfoCollection ModInfoCollection { get; set; } = new ModInfoCollection();
private GameStarter gameStarter = new GameStarter(new GameStarterFrontend());
private readonly GameStarter _gameStarter = new GameStarter(new GameStarterFrontend());
private ProcessMonitor monitor { get; set; }
private readonly ProcessMonitor _monitor;
public ProfileViewModel(IScreen Host) : base(Host)
{
@ -62,13 +63,13 @@ namespace SPT.Launcher.ViewModels
SideImage.Touch();
}
monitor = new ProcessMonitor("EscapeFromTarkov", 1000, aliveCallback: GameAliveCallBack, exitCallback: GameExitCallback);
_monitor = new ProcessMonitor("EscapeFromTarkov", 1000, aliveCallback: GameAliveCallBack, exitCallback: GameExitCallback);
CurrentUsername = AccountManager.SelectedAccount.username;
// CurrentUsername = AccountManager.SelectedAccount.username;
CurrentEdition = AccountManager.SelectedAccount.edition;
CurrentID = AccountManager.SelectedAccount.id;
CurrentId = AccountManager.SelectedAccount.id;
}
private async Task GameVersionCheck()
@ -154,11 +155,11 @@ namespace SPT.Launcher.ViewModels
WipeProfileOnStart = false;
}
GameStarterResult gameStartResult = await gameStarter.LaunchGame(ServerManager.SelectedServer, AccountManager.SelectedAccount, LauncherSettingsProvider.Instance.GamePath);
GameStarterResult gameStartResult = await _gameStarter.LaunchGame(ServerManager.SelectedServer, AccountManager.SelectedAccount, LauncherSettingsProvider.Instance.GamePath);
if (gameStartResult.Succeeded)
{
monitor.Start();
_monitor.Start();
switch (LauncherSettingsProvider.Instance.LauncherStartGameAction)
{
@ -221,9 +222,14 @@ namespace SPT.Launcher.ViewModels
public async Task CopyCommand(object parameter)
{
if (Application.Current.Clipboard != null && parameter != null && parameter is string text)
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop && parameter is string text)
{
await Application.Current.Clipboard.SetTextAsync(text);
if (desktop?.MainWindow?.Clipboard == null)
{
return;
}
await desktop.MainWindow.Clipboard.SetTextAsync(text);
SendNotification("", $"{text} {LocalizationProvider.Instance.copied}", Avalonia.Controls.Notifications.NotificationType.Success);
}
}

View File

@ -8,7 +8,7 @@ using ReactiveUI;
using Splat;
using System;
using System.Threading.Tasks;
using dialogHost = DialogHost.DialogHost;
using DialogHostAvalonia;
namespace SPT.Launcher.ViewModels
{
@ -162,7 +162,7 @@ namespace SPT.Launcher.ViewModels
/// <returns></returns>
public async Task<object?> ShowDialog(object ViewModel)
{
return await dialogHost.Show(ViewModel);
return await DialogHost.Show(ViewModel);
}
public ViewModelBase(IScreen Host)

View File

@ -24,6 +24,7 @@
HorizontalAlignment="Center"
IsVisible="{Binding connectModel.ConnectionFailed}"
Command="{Binding RetryCommand}"
Classes="alt"
/>
</Grid>

View File

@ -3,11 +3,12 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:helpers="using:SPT.Launcher.Helpers"
xmlns:dialogHost="clr-namespace:DialogHost;assembly=DialogHost.Avalonia"
xmlns:dialogHost="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
xmlns:s="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPT.Launcher.Views.Dialogs.ChangeEditionDialogView"
Background="{StaticResource SPT_Background_Dark}">
Background="{DynamicResource BackgroundBrush}"
>
<Grid RowDefinitions="10,AUTO,AUTO,AUTO,10" ColumnDefinitions="10,*,AUTO,10">
@ -16,13 +17,13 @@
Foreground="IndianRed"
/>
<ComboBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2"
Items="{Binding editions.AvailableEditions}"
ItemsSource="{Binding editions.AvailableEditions}"
SelectedItem="{Binding editions.SelectedEdition}"
PlaceholderText="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=select_edition}"
>
<ComboBox.ItemTemplate>
<DataTemplate>
<Label Background="Transparent" Content="{Binding Name}" ToolTip.Tip="{Binding Description}"/>
<TextBlock Background="Transparent" Text="{Binding Name}" ToolTip.Tip="{Binding Description}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
@ -31,7 +32,7 @@
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=update}"
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=dialogHost:DialogHost}, Path=CloseDialogCommand}"
CommandParameter="{Binding editions.SelectedEdition}"
Classes="yellow"
Classes="acc"
/>
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=cancel}"
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=dialogHost:DialogHost}, Path=CloseDialogCommand}"

View File

@ -2,23 +2,22 @@
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:dialogHost="clr-namespace:DialogHost;assembly=DialogHost.Avalonia"
xmlns:dialogHost="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
xmlns:s="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPT.Launcher.Views.Dialogs.ConfirmationDialogView"
Background="{StaticResource SPT_Background_Dark}"
MinWidth="300"
MinHeight="100"
Background="{DynamicResource BackgroundBrush}"
>
<Grid RowDefinitions="*,AUTO" ColumnDefinitions="*,AUTO" Margin="10">
<TextBlock Text="{Binding Question}" Grid.ColumnSpan="2" FontSize="15"
Foreground="{StaticResource SPT_Foreground_Light}"
/>
<StackPanel Grid.Row="1" Grid.Column="1"
Orientation="Horizontal" Spacing="10">
<Button Content="{Binding ConfirmButtonText}"
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=dialogHost:DialogHost}, Path=CloseDialogCommand}"
Classes="yellow"
Classes="acc"
IsEnabled="{Binding AllowConfirm}"
>
<Button.CommandParameter>

View File

@ -2,11 +2,11 @@
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:dialogHost="clr-namespace:DialogHost;assembly=DialogHost.Avalonia"
xmlns:dialogHost="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
xmlns:helpers="using:SPT.Launcher.Helpers"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPT.Launcher.Views.Dialogs.RegisterDialogView"
Background="{StaticResource SPT_Background_Dark}"
Background="{DynamicResource BackgroundBrush}"
MinWidth="300"
MinHeight="100"
>
@ -15,28 +15,26 @@
<!-- Question Text -->
<TextBlock Text="{Binding Question}" Grid.ColumnSpan="2" FontSize="15"
Foreground="{StaticResource SPT_Foreground_Light}"
/>
/>
<!-- Editions Combo Selection -->
<ComboBox Items="{Binding Editions.AvailableEditions}"
Margin="0 10"
Grid.Row="1" Grid.ColumnSpan="2"
HorizontalAlignment="Stretch"
SelectedItem="{Binding Editions.SelectedEdition}"
PlaceholderText="{Binding ComboBoxPlaceholderText}"
>
<ComboBox ItemsSource="{Binding Editions.AvailableEditions}"
Margin="0 10"
Grid.Row="1" Grid.ColumnSpan="2"
HorizontalAlignment="Stretch"
SelectedItem="{Binding Editions.SelectedEdition}"
PlaceholderText="{Binding ComboBoxPlaceholderText}"
>
<ComboBox.ItemTemplate>
<DataTemplate>
<Label Background="Transparent" Content="{Binding Name}" ToolTip.Tip="{Binding Description}"/>
<TextBlock Background="Transparent" Text="{Binding Name}" ToolTip.Tip="{Binding Description}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!-- Description Area -->
<Border Grid.Row="2" Grid.ColumnSpan="3" Margin="0 10"
Background="{StaticResource SPT_Background_Light}" CornerRadius="10"
Background="{DynamicResource BackgroundBrush2}" CornerRadius="10"
MaxWidth="500" MinHeight="50"
MinWidth="500"
HorizontalAlignment="Stretch"
@ -44,11 +42,9 @@
<StackPanel Spacing="10" Margin="10">
<TextBlock Text="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=description}"
FontSize="12"
Foreground="{StaticResource SPT_Foreground_Light}"
/>
/>
<TextBlock Text="{Binding Editions.SelectedEdition.Description}"
TextWrapping="Wrap"
Foreground="{StaticResource SPT_Foreground_Light}"
/>
</StackPanel>
</Border>
@ -62,7 +58,7 @@
CommandParameter="{Binding Editions.SelectedEdition}"
IsEnabled="{Binding Editions.HasSelection}"
IsDefault="True"
Classes="yellow"
Classes="acc"
/>
<Button Content="{Binding CancelButtonText}"
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=dialogHost:DialogHost}, Path=CloseDialogCommand}"

View File

@ -3,10 +3,10 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:helpers="using:SPT.Launcher.Helpers"
xmlns:dialogHost="clr-namespace:DialogHost;assembly=DialogHost.Avalonia"
xmlns:dialogHost="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPT.Launcher.Views.Dialogs.WarningDialogView"
Background="{StaticResource SPT_Background_Dark}"
Background="{DynamicResource BackgroundBrush}"
BorderBrush="IndianRed"
BorderThickness="1"
>
@ -20,7 +20,7 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=dialogHost:DialogHost}, Path=CloseDialogCommand}"
Classes="yellow"
Classes="acc"
/>
</Grid>
</UserControl>

View File

@ -2,140 +2,38 @@
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:helpers="using:SPT.Launcher.Helpers"
xmlns:launcher="using:SPT.Launcher.Models.Launcher"
xmlns:cvt="using:SPT.Launcher.Converters"
xmlns:cc="using:SPT.Launcher.CustomControls"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPT.Launcher.Views.LoginView">
<UserControl.Resources>
<cvt:ImageSourceConverter x:Key="imageSourceCvt"/>
</UserControl.Resources>
<Grid RowDefinitions="10,*,Auto,10" ColumnDefinitions="10,*,Auto,*,10">
<Grid RowDefinitions="20,*,AUTO,*,20" ColumnDefinitions="20,4*,2*,20">
<ScrollViewer Grid.Row="1" Grid.RowSpan="3" Grid.Column="1">
<ItemsControl Items="{Binding ExistingProfiles}"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
>
<ScrollViewer Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" >
<ItemsControl ItemsSource="{Binding ExistingProfiles}"
VerticalAlignment="Center"
>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="launcher:ProfileInfo">
<Button Classes="profileinfo" Margin="0 10 10 10" HorizontalAlignment="Stretch"
Command="{Binding $parent[ItemsControl].DataContext.LoginProfileCommand}"
CommandParameter="{Binding Username}"
>
<!-- profile info item grid -->
<Grid RowDefinitions="5,AUTO,AUTO,12,5" ColumnDefinitions="5,AUTO,AUTO,AUTO,*,5">
<Image Source="{Binding SideImage, Converter={StaticResource imageSourceCvt}}" Height="35"
Grid.Row="1" Grid.RowSpan="2" Grid.Column="1" Margin="0 0 5 0"
/>
<!-- username -->
<Label Content="{Binding Username}" Grid.Row="1" Grid.Column="2"
/>
<!-- SPT version -->
<Label x:Name="SPTVersion"
Grid.Row="1" Grid.Column="4"
Background="Transparent"
ToolTip.Tip="{Binding MismatchMessage}"
Classes.versionMismatch="{Binding VersionMismatch}"
>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding SPT.version}"/>
<Path Data="{StaticResource Alert}" Fill="{Binding ElementName=SPTVersion, Path=Foreground}"
Margin="10 0"
IsVisible="{Binding VersionMismatch}"
/>
</StackPanel>
</Label>
<!-- no data label -->
<Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance},
Path=no_profile_data}"
Grid.Row="1" Grid.RowSpan="2" Grid.Column="5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontWeight="SemiBold"
Foreground="{StaticResource SPT_Brush_DarkGrayBlue}"
IsVisible="{Binding !HasData}"
/>
<!-- nickname -->
<Label Content="{Binding Nickname}" Grid.Row="1" Grid.Column="3"
IsVisible="{Binding HasData}"
Foreground="{StaticResource SPT_Brush_DarkGrayBlue}"
/>
<!-- remaining exp -->
<Label Grid.Row="2" Grid.RowSpan="2" Grid.Column="4"
VerticalAlignment="Bottom" HorizontalAlignment="Center"
FontSize="12"
IsVisible="{Binding HasData}"
>
<Label.Content>
<MultiBinding StringFormat="{}{0} {1} xp">
<Binding Source="{x:Static helpers:LocalizationProvider.Instance}" Path="next_level_in"/>
<Binding Path="RemainingExp"/>
</MultiBinding>
</Label.Content>
</Label>
<!-- level text-->
<Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=level}"
Grid.Row="2" Grid.Column="2"
IsVisible="{Binding HasData}"
/>
<!-- level -->
<Label Content="{Binding Level}" Grid.Row="2" Grid.Column="3"
IsVisible="{Binding HasData}"
/>
<!-- exp level progress -->
<ProgressBar Value="{Binding XPLevelProgress}"
Grid.Row="2" Grid.Column="4" Grid.ColumnSpan="2"
IsVisible="{Binding HasData}"
/>
</Grid>
</Button>
<cc:DetailedProfileCard
ProfileInfo="{Binding }"
LoginCommand="{Binding $parent[ItemsControl].DataContext.LoginProfileCommand}"
/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<!-- Login Control backdrop -->
<Border CornerRadius="5"
Grid.Row="2" Grid.Column="2"
BorderBrush="{StaticResource SPT_Background_Dark}"
BorderThickness="2"
Background="{StaticResource SPT_Background_Dark}"
>
<Rectangle Fill="{StaticResource SPT_Background_Dark}" />
</Border>
<StackPanel Spacing="10" Margin="10" Grid.Row="2" Grid.Column="2" HorizontalAlignment="Stretch">
<!-- Username box -->
<TextBox Watermark="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=username}"
Text="{Binding Login.Username}"
/>
<!-- Login button -->
<Button HorizontalAlignment="Stretch" HorizontalContentAlignment="Center"
Command="{Binding LoginCommand}"
IsEnabled="{Binding !IsLoggingIn}"
IsDefault="True"
>
<TextBlock Text="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=login_or_register}"
TextWrapping="Wrap"
/>
</Button>
<CheckBox IsChecked="{Binding Source={x:Static helpers:LauncherSettingsProvider.Instance}, Path=UseAutoLogin}">
<TextBlock Text="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=login_automatically}"
TextWrapping="Wrap"
/>
</CheckBox>
</StackPanel>
<!-- Login box -->
<cc:LoginBox Grid.Row="2" Grid.Column="2"
Username="{Binding Login.Username, Mode=TwoWay}"
LoginCommand="{Binding LoginCommand}"
IsLoggedIn="{Binding IsLoggedIn}"
/>
</Grid>
</UserControl>

View File

@ -5,20 +5,19 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:cc="using:SPT.Launcher.CustomControls"
xmlns:rxui="using:Avalonia.ReactiveUI"
xmlns:helpers="using:SPT.Launcher.Helpers"
xmlns:cvt="using:SPT.Launcher.Converters"
xmlns:dialogHost="clr-namespace:DialogHost;assembly=DialogHost.Avalonia"
xmlns:dialogHost="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
mc:Ignorable="d" d:DesignWidth="750" d:DesignHeight="450"
x:Class="SPT.Launcher.Views.MainWindow"
Icon="/Assets/spt-logo.ico"
Title="SPT.Launcher"
MinHeight="450" MinWidth="800"
Height="450" Width="800"
MinHeight="450" MinWidth="760"
Height="450" Width="760"
WindowStartupLocation="CenterScreen"
ExtendClientAreaToDecorationsHint="True"
ExtendClientAreaChromeHints="NoChrome"
ExtendClientAreaTitleBarHeightHint="-1"
Background="{StaticResource SPT_Background_Light}">
Background="{DynamicResource AltBackgroundBrush}">
<Window.Resources>
<cvt:ImageSourceConverter x:Key="imageSourceCvt"/>
@ -39,7 +38,7 @@
MinButtonCommand="{Binding MinimizeCommand}"
SettingsButtonCommand="{Binding GoToSettingsCommand}"
Classes.versiontag="{Binding VersionInfo.HasTag}"
/>
/>
<Image Source="{Binding Background.Path, Converter={StaticResource imageSourceCvt}}"
Stretch="Fill" RenderOptions.BitmapInterpolationMode="HighQuality"
@ -50,17 +49,16 @@
<dialogHost:DialogHost Identifier="mainHost" Grid.Row="1" Grid.RowSpan="2"
CornerRadius="5"
DialogMargin="0"
OverlayBackground="{StaticResource SPT_Background_Light}"
OverlayBackground="Gray"
>
<rxui:RoutedViewHost Router="{Binding Router}"
/>
<rxui:RoutedViewHost Router="{Binding Router}" />
</dialogHost:DialogHost>
<Label Content="{Binding VersionInfo.Tag}" Grid.Row="1"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Background="{StaticResource SPT_Brush_Yellow}"
Foreground="{StaticResource SPT_Brush_DarkGrayBlue}"
Background="{DynamicResource AccentBrush}"
Foreground="DarkSlateGray"
FontWeight="SemiBold"
CornerRadius="0 0 5 5"
Margin="10 0"

View File

@ -19,32 +19,27 @@
<!-- Active Mods List Header -->
<Border Grid.Row="3" Grid.Column="1"
CornerRadius="5"
Background="{StaticResource SPT_Background_Dark}">
Classes="card"
>
<StackPanel Spacing="2" Margin="10">
<!-- Active mods count and text -->
<Label VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="16">
<Label.Content>
<MultiBinding StringFormat="{}{0}: {1}">
<Binding Source="{x:Static helpers:LocalizationProvider.Instance}" Path="active_server_mods"/>
<Binding Path="ModsCollection.ActiveMods.Count"/>
</MultiBinding>
</Label.Content>
</Label>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=active_server_mods}"/>
<Label Content="{Binding ModsCollection.ActiveMods.Count}" Classes="acc"/>
</StackPanel>
<!-- Active mods info text -->
<TextBlock Text="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=active_server_mods_info_text}"
VerticalAlignment="Center" HorizontalAlignment="Center"
FontSize="12"
TextWrapping="Wrap"
Foreground="{StaticResource SPT_Foreground_Light}"
/>
Classes="alt"/>
</StackPanel>
</Border>
<!-- Active Mods List -->
<ScrollViewer Grid.Row="5" Grid.Column="1">
<ItemsControl Items="{Binding ModsCollection.ActiveMods}">
<ItemsControl ItemsSource="{Binding ModsCollection.ActiveMods}">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type launcher:SPTMod}">
<cc:ModInfoCard ModName="{Binding Name}"
@ -62,31 +57,27 @@
<!-- Inactive Mods List Header -->
<Border Grid.Row="3" Grid.Column="3"
CornerRadius="5"
Background="{StaticResource SPT_Background_Dark}">
Classes="card"
>
<StackPanel Spacing="2" Margin="10">
<!-- Inactive mods count and text -->
<Label VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="16">
<Label.Content>
<MultiBinding StringFormat="{}{0}: {1}">
<Binding Source="{x:Static helpers:LocalizationProvider.Instance}" Path="inactive_server_mods"/>
<Binding Path="ModsCollection.InactiveMods.Count"/>
</MultiBinding>
</Label.Content>
</Label>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=inactive_server_mods}"/>
<Label Content="{Binding ModsCollection.InactiveMods.Count}" Classes="acc"/>
</StackPanel>
<!-- Inactive mods info text -->
<TextBlock Text="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=inactive_server_mods_info_text}"
VerticalAlignment="Center" HorizontalAlignment="Center"
FontSize="12"
TextWrapping="Wrap"
Foreground="{StaticResource SPT_Foreground_Light}"
Classes="alt"
/>
</StackPanel>
</Border>
<!-- Inactive Mods List -->
<ScrollViewer Grid.Row="5" Grid.Column="3" >
<ItemsControl Items="{Binding ModsCollection.InactiveMods}">
<ItemsControl ItemsSource="{Binding ModsCollection.InactiveMods}">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type launcher:SPTMod}">
<cc:ModInfoCard ModName="{Binding Name}"

View File

@ -6,7 +6,7 @@
x:Class="SPT.Launcher.Views.Notifications.SPTNotificationView"
>
<Border Padding="12" MinHeight="20" Background="{StaticResource SPT_Background_Dark}"
<Border Padding="12" MinHeight="20" Background="{DynamicResource BackgroundBrush}"
BorderBrush="{Binding BarColor}"
BorderThickness="3 0 0 0">
<Grid>

View File

@ -2,148 +2,36 @@
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:helpers="using:SPT.Launcher.Helpers"
xmlns:cvt="using:SPT.Launcher.Converters"
xmlns:cc="using:SPT.Launcher.CustomControls"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPT.Launcher.Views.ProfileView">
<UserControl.Resources>
<cvt:ImageSourceConverter x:Key="imageSourceCvt" />
</UserControl.Resources>
<Grid RowDefinitions="10,AUTO,10,AUTO,10,*,10,AUTO,10" ColumnDefinitions="10,AUTO,10,*,10">
<!-- profile info -->
<Border Grid.Row="1" Grid.Column="1" CornerRadius="5"
BorderBrush="{StaticResource SPT_Background_Dark}"
BorderThickness="5">
<Grid RowDefinitions="10,AUTO,AUTO,AUTO,AUTO,10" ColumnDefinitions="10,AUTO,*,10"
Background="{StaticResource SPT_Background_Dark}">
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1">
<Label Content="{Binding CurrentUsername}" Margin="5 0" />
<!-- profile name and version -->
<Label x:Name="SPTVersion"
Background="Transparent"
ToolTip.Tip="{Binding ProfileInfo.MismatchMessage}"
Classes.versionMismatch="{Binding ProfileInfo.VersionMismatch}">
<StackPanel Orientation="Horizontal" Background="Transparent">
<TextBlock Text="{Binding ProfileInfo.SPT.version}" />
<Path Data="{StaticResource Info}"
Fill="{Binding ElementName=SPTVersion, Path=Foreground}"
Margin="10 0"
IsVisible="{Binding ProfileInfo.VersionMismatch}" />
</StackPanel>
</Label>
</StackPanel>
<!-- delete profile button -->
<Button HorizontalAlignment="Right" Grid.Row="1" Grid.Column="2"
Classes="icon"
Command="{Binding RemoveProfileCommand}"
IsEnabled="{Binding Source={x:Static helpers:LauncherSettingsProvider.Instance}, Path=!GameRunning}">
<Path Data="{StaticResource Delete}" Fill="IndianRed" />
</Button>
<!-- profile id button -->
<Button Content="{Binding CurrentID}" Classes="link"
Grid.Row="2" Grid.Column="1"
Command="{Binding CopyCommand}"
CommandParameter="{Binding CurrentID}" />
<!-- profile edition button -->
<Button Content="{Binding CurrentEdition}" Classes="link"
Grid.Row="3" Grid.Column="1"
Command="{Binding ChangeEditionCommand}"
IsEnabled="{Binding Source={x:Static helpers:LauncherSettingsProvider.Instance}, Path=!GameRunning}" />
<!-- wipe profile checkbox -->
<CheckBox
Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=wipe_on_start}"
Grid.Row="4" Grid.Column="1"
IsChecked="{Binding WipeProfileOnStart}"
IsEnabled="{Binding Source={x:Static helpers:LauncherSettingsProvider.Instance}, Path=!GameRunning}"
IsVisible="{Binding !ProfileWipePending}" />
</Grid>
</Border>
<cc:ProfileCard Grid.Row="1" Grid.Column="1"
ProfileInfo="{Binding ProfileInfo}"
CurrentEdition="{Binding CurrentEdition}"
CurrentId="{Binding CurrentId}"
WipeProfileOnStart="{Binding WipeProfileOnStart}"
ProfileWipePending="{Binding ProfileWipePending}"
CopyCommand="{Binding CopyCommand}"
ChangeEditionCommand="{Binding ChangeEditionCommand}"
RemoveProfileCommand="{Binding RemoveProfileCommand}"
/>
<!-- Total Mods Info -->
<Border Grid.Row="3" Grid.Column="1" CornerRadius="5"
BorderBrush="{StaticResource SPT_Background_Dark}"
BorderThickness="5" IsVisible="{Binding ModInfoCollection.HasMods}">
<Grid RowDefinitions="10,AUTO,10" ColumnDefinitions="10,Auto,*,AUTO,10"
Background="{StaticResource SPT_Background_Dark}">
<cc:TotalModsCard Grid.Row="3" Grid.Column="1"
ActiveModsCount="{Binding ModInfoCollection.ActiveMods.Count}"
OpenModsInfoCommand="{Binding OpenModsInfoCommand}"
/>
<!-- server mods count text -->
<Label Grid.Row="1" Grid.Column="1">
<Label.Content>
<MultiBinding StringFormat="{}{0}: {1}">
<Binding Source="{x:Static helpers:LocalizationProvider.Instance}" Path="active_server_mods"/>
<Binding Path="ModInfoCollection.ActiveMods.Count"/>
</MultiBinding>
</Label.Content>
</Label>
<!-- Game bar -->
<cc:GameLaunchBar Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="3"
ProfileInfo="{Binding ProfileInfo}"
StartGameCommand="{Binding StartGameCommand}"
LogoutCommand="{Binding LogoutCommand}"
/>
<!-- Show mods info view button -->
<Button Grid.Row="0" Grid.RowSpan="3" Grid.Column="3" Grid.ColumnSpan="2"
VerticalAlignment="Stretch" FontSize="18" Margin="10 0 0 0"
Command="{Binding OpenModsInfoCommand}"
Classes="icon">
<Button.Content>
<Path Data="{StaticResource Open}" Fill="{StaticResource SPT_Foreground_Light}"
VerticalAlignment="Center"
/>
</Button.Content>
</Button>
</Grid>
</Border>
<!-- Bottom bar -->
<Border Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="3" CornerRadius="5"
BorderBrush="{StaticResource SPT_Background_Dark}"
BorderThickness="5">
<DockPanel Background="{StaticResource SPT_Background_Dark}">
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Stretch"
Spacing="10"
IsVisible="{Binding ProfileInfo.HasData}">
<Grid RowDefinitions="AUTO,AUTO" ColumnDefinitions="AUTO,AUTO">
<Image Source="{Binding SideImage.Path, Converter={StaticResource imageSourceCvt}}"
Grid.RowSpan="2" Height="40" Margin="10 0" />
<Label Content="{Binding ProfileInfo.Nickname}" Grid.Row="0" Grid.Column="2" />
<Label Content="{Binding ProfileInfo.Side}" Grid.Row="1" Grid.Column="2" />
</Grid>
<Label Content="{Binding ProfileInfo.Level}" VerticalAlignment="Center"
FontSize="22" />
<ProgressBar Value="{Binding ProfileInfo.XPLevelProgress}" />
<StackPanel>
<Label
Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=next_level_in}"
HorizontalAlignment="Center" />
<Label Content="{Binding ProfileInfo.RemainingExp, StringFormat={}{0} xp}"
HorizontalAlignment="Center" />
</StackPanel>
</StackPanel>
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=start_game}"
HorizontalAlignment="Right"
VerticalContentAlignment="Center"
VerticalAlignment="Stretch"
DockPanel.Dock="Right"
Command="{Binding StartGameCommand}"
IsEnabled="{Binding Source={x:Static helpers:LauncherSettingsProvider.Instance}, Path=!GameRunning}"
Classes="yellow" />
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=logout}"
Command="{Binding LogoutCommand}"
Margin="10 0"
Classes="link"
DockPanel.Dock="Right"
HorizontalAlignment="Right" />
</DockPanel>
</Border>
</Grid>
</UserControl>

View File

@ -11,29 +11,29 @@
<Grid RowDefinitions="10,AUTO,AUTO,*, AUTO, AUTO, AUTO,10" ColumnDefinitions="10,2*,2*,AUTO,10">
<!-- Backdrop -->
<Rectangle Fill="{StaticResource SPT_Background_Dark}"
<Rectangle Fill="{DynamicResource BackgroundBrush}"
Grid.RowSpan="7" Grid.ColumnSpan="5"
Opacity=".7"
/>
<WrapPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Orientation="Horizontal">
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=remove_registry_keys}"
Command="{Binding RemoveRegistryKeysCommand}"
Classes="borderedlink"
Classes="outlined"
Margin="0 0 10 5"
/>
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=load_live_settings}"
Command="{Binding ResetGameSettingsCommand}"
Classes="borderedlink"
Classes="outlined"
Margin="0 0 10 5"
/>
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=clear_game_settings}"
Command="{Binding ClearGameSettingsCommand}"
Classes="borderedlink"
Classes="outlined"
Margin="0 0 10 5"
/>
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=clean_temp_files}"
Command="{Binding CleanTempFilesCommand}"
Classes="borderedlink"
Classes="outlined"
Margin="0 0 10 5"
/>
</WrapPanel>
@ -50,9 +50,9 @@
<Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=default_language}"
/>
<!-- LocaleCollection reloads the locale from file when the selected loacle changes -->
<ComboBox Items="{Binding Locales.AvailableLocales}" MinWidth="200"
<ComboBox ItemsSource="{Binding Locales.AvailableLocales}" MinWidth="200"
SelectedItem="{Binding Locales.SelectedLocale, Mode=TwoWay}"
/>
/>
</StackPanel>
<!-- Game Start Action -->