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

add mod info page

This commit is contained in:
IsWaffle 2024-01-26 12:35:57 -05:00
parent 9a57b67766
commit fa8284da52
6 changed files with 199 additions and 171 deletions

View File

@ -14,9 +14,9 @@
>
<StackPanel Grid.Row="1" Grid.ColumnSpan="3" Grid.Column="1"
VerticalAlignment="Center"
Orientation="Horizontal" Spacing="5"
>
VerticalAlignment="Center"
Orientation="Horizontal" Spacing="5"
>
<Path Data="{StaticResource Server}" Fill="{StaticResource AKI_Brush_DarkGrayBlue}"
IsVisible="{Binding IsInServer, RelativeSource={RelativeSource AncestorType=UserControl}}"
/>

View File

@ -0,0 +1,10 @@
using ReactiveUI;
namespace Aki.Launcher.ViewModels;
public class ModInfoViewModel : ViewModelBase
{
public ModInfoViewModel(IScreen Host) : base(Host)
{
}
}

View File

@ -104,7 +104,8 @@ namespace Aki.Launcher.ViewModels
}
}
public void ToggleModsListCommand() => ModsListIsVisible = !ModsListIsVisible;
public void OpenModsInfoCommand() =>
NavigateTo(new ModInfoViewModel(HostScreen));
public void LogoutCommand()
{

View File

@ -0,0 +1,14 @@
<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"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Aki.Launcher.Views.ModInfoView">
<Grid RowDefinitions="10, Auto, *, 10" ColumnDefinitions="10, *, 10">
<Button Grid.Row="1" Grid.Column="1" Content="Back"
Command="{Binding NavigateBack}"
/>
<Label Grid.Row="2" Grid.Column="1" Content="Welcome to Avalonia!"
/>
</Grid>
</UserControl>

View File

@ -0,0 +1,20 @@
using Aki.Launcher.ViewModels;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
namespace Aki.Launcher.Views;
public partial class ModInfoView : ReactiveUserControl<ModInfoViewModel>
{
public ModInfoView()
{
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}

View File

@ -4,183 +4,166 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:helpers="using:Aki.Launcher.Helpers"
xmlns:cvt="using:Aki.Launcher.Converters"
xmlns:cc="using:Aki.Launcher.CustomControls"
xmlns:launcher="using:Aki.Launcher.Models.Aki"
xmlns:cc="using:Aki.Launcher.CustomControls"
xmlns:launcher="using:Aki.Launcher.Models.Aki"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Aki.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">
<UserControl.Resources>
<cvt:ImageSourceConverter x:Key="imageSourceCvt" />
</UserControl.Resources>
<!-- profile info -->
<Border Grid.Row="1" Grid.Column="1" CornerRadius="5"
BorderBrush="{StaticResource AKI_Background_Dark}"
BorderThickness="5">
<Grid RowDefinitions="10,AUTO,AUTO,AUTO,AUTO,10" ColumnDefinitions="10,AUTO,*,10"
Background="{StaticResource AKI_Background_Dark}"
>
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1">
<Label Content="{Binding CurrentUsername}" Margin="5 0"/>
<Grid RowDefinitions="10,AUTO,10,AUTO,10,*,10,AUTO,10" ColumnDefinitions="10,AUTO,10,*,10">
<!-- profile name and version -->
<Label x:Name="akiVersion"
Background="Transparent"
ToolTip.Tip="{Binding ProfileInfo.MismatchMessage}"
Classes.versionMismatch="{Binding ProfileInfo.VersionMismatch}"
>
<StackPanel Orientation="Horizontal" Background="Transparent">
<TextBlock Text="{Binding ProfileInfo.Aki.version}"/>
<Path Data="{StaticResource Alert}" Fill="{Binding ElementName=akiVersion, Path=Foreground}"
Margin="10 0"
IsVisible="{Binding ProfileInfo.VersionMismatch}"
/>
</StackPanel>
</Label>
</StackPanel>
<!-- profile info -->
<Border Grid.Row="1" Grid.Column="1" CornerRadius="5"
BorderBrush="{StaticResource AKI_Background_Dark}"
BorderThickness="5">
<Grid RowDefinitions="10,AUTO,AUTO,AUTO,AUTO,10" ColumnDefinitions="10,AUTO,*,10"
Background="{StaticResource AKI_Background_Dark}">
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1">
<Label Content="{Binding CurrentUsername}" Margin="5 0" />
<!-- 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 name and version -->
<Label x:Name="akiVersion"
Background="Transparent"
ToolTip.Tip="{Binding ProfileInfo.MismatchMessage}"
Classes.versionMismatch="{Binding ProfileInfo.VersionMismatch}">
<StackPanel Orientation="Horizontal" Background="Transparent">
<TextBlock Text="{Binding ProfileInfo.Aki.version}" />
<Path Data="{StaticResource Alert}"
Fill="{Binding ElementName=akiVersion, Path=Foreground}"
Margin="10 0"
IsVisible="{Binding ProfileInfo.VersionMismatch}" />
</StackPanel>
</Label>
</StackPanel>
<!-- profile id button -->
<Button Content="{Binding CurrentID}" Classes="link"
Grid.Row="2" Grid.Column="1"
Command="{Binding CopyCommand}"
CommandParameter="{Binding CurrentID}"
/>
<!-- 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 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}"
/>
<!-- profile id button -->
<Button Content="{Binding CurrentID}" Classes="link"
Grid.Row="2" Grid.Column="1"
Command="{Binding CopyCommand}"
CommandParameter="{Binding CurrentID}" />
<!-- 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>
<!-- Total Mods Info -->
<Border Grid.Row="3" Grid.Column="1" CornerRadius="5"
BorderBrush="{StaticResource AKI_Background_Dark}"
BorderThickness="5" IsVisible="{Binding ModInfoCollection.HasMods}"
>
<Grid RowDefinitions="10,AUTO,AUTO,10" ColumnDefinitions="10,AUTO,*,AUTO,AUTO,AUTO,10"
Background="{StaticResource AKI_Background_Dark}">
<Label Grid.Row="1" Grid.Column="1" Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=server_mods}"
/>
<Label Grid.Row="2" Grid.Column="1" Content="{Binding ModInfoCollection.ServerModsCount}"
/>
<Label Grid.Row="1" Grid.Column="3" Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=profile_mods}"
/>
<Path Grid.Row="1" Grid.Column="4" Margin="10 4 0 0" IsVisible="{Binding ModInfoCollection.HasProfileOnlyMods}"
Data="{StaticResource Alert}" Fill="{StaticResource AKI_Brush_Yellow}"
/>
<Label Grid.Row="2" Grid.Column="3" Content="{Binding ModInfoCollection.ProfileModsCount}"
/>
<Button Grid.Row="0" Grid.RowSpan="4" Grid.Column="5" Grid.ColumnSpan="2"
VerticalAlignment="Stretch" FontSize="18" Margin="10 0 0 0"
Command="{Binding ToggleModsListCommand}"
Classes="icon"
>
<Button.Content>
<DockPanel LastChildFill="True">
<Path Data="{StaticResource Visible}" Fill="{StaticResource AKI_Foreground_Light}"
VerticalAlignment="Center"
IsVisible="{Binding !ModsListIsVisible}"
/>
<Path Data="{StaticResource Hide}" Fill="{StaticResource AKI_Foreground_Light}"
VerticalAlignment="Center"
IsVisible="{Binding ModsListIsVisible}"
/>
</DockPanel>
</Button.Content>
</Button>
</Grid>
</Border>
<!-- 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}" />
<!-- Mods List -->
<ScrollViewer Grid.Row="1" Grid.RowSpan="5" Grid.Column="3" IsVisible="{Binding ModsListIsVisible}">
<ItemsControl Items="{Binding ModInfoCollection.Mods}">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type launcher:AkiMod}">
<cc:ModInfoCard ModName="{Binding Name}"
Author="{Binding Author}"
Version="{Binding Version}"
IsInServer="{Binding InServer}"
IsInProfile="{Binding InProfile}"
Margin="0 0 0 10"
/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<!-- Bottom bar -->
<Border Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="3" CornerRadius="5"
BorderBrush="{StaticResource AKI_Background_Dark}"
BorderThickness="5"
>
<DockPanel Background="{StaticResource AKI_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"/>
<!-- 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>
<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>
</Border>
<!-- Total Mods Info -->
<Border Grid.Row="3" Grid.Column="1" CornerRadius="5"
BorderBrush="{StaticResource AKI_Background_Dark}"
BorderThickness="5" IsVisible="{Binding ModInfoCollection.HasMods}">
<Grid RowDefinitions="10,AUTO,AUTO,10" ColumnDefinitions="10,AUTO,*,AUTO,AUTO,AUTO,10"
Background="{StaticResource AKI_Background_Dark}">
<Label Grid.Row="1" Grid.Column="1"
Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=server_mods}" />
<Label Grid.Row="2" Grid.Column="1" Content="{Binding ModInfoCollection.ServerModsCount}" />
<Label Grid.Row="1" Grid.Column="3"
Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=profile_mods}" />
<Path Grid.Row="1" Grid.Column="4" Margin="10 4 0 0"
IsVisible="{Binding ModInfoCollection.HasProfileOnlyMods}"
Data="{StaticResource Alert}" Fill="{StaticResource AKI_Brush_Yellow}" />
<Label Grid.Row="2" Grid.Column="3" Content="{Binding ModInfoCollection.ProfileModsCount}" />
<Button Grid.Row="0" Grid.RowSpan="4" Grid.Column="5" Grid.ColumnSpan="2"
VerticalAlignment="Stretch" FontSize="18" Margin="10 0 0 0"
Command="{Binding OpenModsInfoCommand}"
Classes="icon">
<Button.Content>
<DockPanel LastChildFill="True">
<Path Data="{StaticResource Visible}" Fill="{StaticResource AKI_Foreground_Light}"
VerticalAlignment="Center"
IsVisible="{Binding !ModsListIsVisible}" />
<Path Data="{StaticResource Hide}" Fill="{StaticResource AKI_Foreground_Light}"
VerticalAlignment="Center"
IsVisible="{Binding ModsListIsVisible}" />
</DockPanel>
</Button.Content>
</Button>
</Grid>
</Border>
<!-- Mods List -->
<!-- <ScrollViewer Grid.Row="1" Grid.RowSpan="5" Grid.Column="3" IsVisible="{Binding ModsListIsVisible}"> -->
<!-- <ItemsControl Items="{Binding ModInfoCollection.Mods}"> -->
<!-- <ItemsControl.ItemTemplate> -->
<!-- <DataTemplate DataType="{x:Type launcher:AkiMod}"> -->
<!-- <cc:ModInfoCard ModName="{Binding Name}" -->
<!-- Author="{Binding Author}" -->
<!-- Version="{Binding Version}" -->
<!-- IsInServer="{Binding InServer}" -->
<!-- IsInProfile="{Binding InProfile}" -->
<!-- Margin="0 0 0 10" /> -->
<!-- </DataTemplate> -->
<!-- </ItemsControl.ItemTemplate> -->
<!-- </ItemsControl> -->
<!-- </ScrollViewer> -->
<!-- Bottom bar -->
<Border Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="3" CornerRadius="5"
BorderBrush="{StaticResource AKI_Background_Dark}"
BorderThickness="5">
<DockPanel Background="{StaticResource AKI_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>
<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>