Add basic game icon + title to modlist tile

This commit is contained in:
trawzified 2023-12-29 12:09:49 +01:00
parent ddef1dcb3b
commit f919e14d2e
5 changed files with 24 additions and 1 deletions

View File

@ -9,6 +9,7 @@
xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:ic="clr-namespace:FluentIcons.WPF;assembly=FluentIcons.WPF"
xmlns:math="http://hexinnovation.com/math"
mc:Ignorable="d">
<FontFamily x:Key="PrimaryFont">pack://application:,,,/Resources/Fonts/#Gabarito</FontFamily>
@ -23,6 +24,7 @@
<local:AbsolutePathToStringConverter x:Key="AbsolutePathToStringConverter" />
<local:FileSizeConverter x:Key="FileSizeConverter"/>
<local:WidthHeightRectConverter x:Key="WidthHeightRectConverter" />
<math:MathConverter x:Key="MathConverter"/>
<!-- Colors -->
<Color x:Key="WindowBackgroundColor">#222531</Color>

View File

@ -24,6 +24,7 @@ using Wabbajack.Paths;
using Wabbajack.Paths.IO;
using Wabbajack.RateLimiter;
using Wabbajack.Services.OSIntegrated.Services;
using System.Windows.Media;
namespace Wabbajack
{
@ -85,6 +86,9 @@ namespace Wabbajack
[Reactive]
public bool ImageContainsTitle { get; private set; }
[Reactive]
public GameMetaData GameMetaData { get; private set; }
[Reactive]
public bool DisplayVersionOnlyInInstallerView { get; private set; }
@ -113,6 +117,8 @@ namespace Wabbajack
Metadata = metadata;
_wjClient = wjClient;
_cancellationToken = cancellationToken;
GameMetaData = Metadata.Game.MetaData();
Location = LauncherUpdater.CommonFolder.Value.Combine("downloaded_mod_lists", Metadata.NamespacedName).WithExtension(Ext.Wabbajack);
ModListTagList = new List<ModListTag>();
@ -122,7 +128,7 @@ namespace Wabbajack
{
ModListTagList.Add(new ModListTag(tag));
});
ModListTagList.Add(new ModListTag(metadata.Game.MetaData().HumanFriendlyGameName));
ModListTagList.Add(new ModListTag(GameMetaData.HumanFriendlyGameName));
DownloadSizeText = "Download size : " + UIUtils.FormatBytes(Metadata.DownloadMetadata.SizeOfArchives);
InstallSizeText = "Installation size : " + UIUtils.FormatBytes(Metadata.DownloadMetadata.SizeOfInstalledFiles);

View File

@ -79,6 +79,18 @@
<Grid ClipToBounds="True">
<mahapps:ProgressRing x:Name="LoadingProgress" />
<TextBlock Text="{Binding Metadata.Title}" VerticalAlignment="Bottom" FontSize="14" Margin="10, 0, 0, 10" Panel.ZIndex="1"/>
<StackPanel Orientation="Horizontal" Margin="5, 5, 0, 0" VerticalAlignment="Top" HorizontalAlignment="Left" Panel.ZIndex="1">
<Border x:Name="GameIcon" Width="24" Height="24" CornerRadius="6">
<Border.Background>
<ImageBrush Stretch="Fill" ImageSource="{Binding GameMetaData.IconSource}"/>
</Border.Background>
</Border>
<Grid Margin="5, 0, 0, 0">
<TextBlock x:Name="GameName" HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding GameMetaData.HumanFriendlyGameName}" Panel.ZIndex="2"/>
<Border Background="{StaticResource WindowBackgroundBrush}" Opacity="0.5" Width="{Binding ElementName=GameName, Path=ActualWidth,Converter={StaticResource MathConverter}, ConverterParameter=x+10}" Height="{Binding ElementName=GameIcon, Path=ActualHeight}" CornerRadius="6">
</Border>
</Grid>
</StackPanel>
<Border
BorderThickness="0"
HorizontalAlignment="Stretch"

View File

@ -7,6 +7,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Media.Media3D;
using MahApps.Metro.IconPacks;
using ReactiveUI;
using Wabbajack.DTOs;
namespace Wabbajack
{
@ -23,6 +24,7 @@ namespace Wabbajack
ViewModel.WhenAnyValue(vm => vm.Image)
.BindToStrict(this, v => v.ModlistImage.ImageSource)
.DisposeWith(disposables);
/*
this.WhenAny(x => x.ViewModel.Metadata.Links.ImageUri)
.Select(x => new BitmapImage() { UriSource = new Uri(x) })

View File

@ -104,6 +104,7 @@
</PackageReference>
<PackageReference Include="MahApps.Metro" Version="2.4.10" />
<PackageReference Include="MahApps.Metro.IconPacks" Version="4.11.0" />
<PackageReference Include="MathConverter" Version="2.2.1" />
<PackageReference Include="Microsoft-WindowsAPICodePack-Shell" Version="1.1.5" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2151.40" />