Explorar o código

UI: Show what each value is in the Game Info dialog, add game icon

Evan Husted hai 1 ano
pai
achega
bd08a111a8

+ 3 - 3
src/Ryujinx/Assets/locales.json

@@ -2578,7 +2578,7 @@
         "ar_SA": "",
         "ar_SA": "",
         "de_DE": "",
         "de_DE": "",
         "el_GR": "",
         "el_GR": "",
-        "en_US": "Show Game Stats",
+        "en_US": "Show Game Info",
         "es_ES": "",
         "es_ES": "",
         "fr_FR": "",
         "fr_FR": "",
         "he_IL": "",
         "he_IL": "",
@@ -2603,7 +2603,7 @@
         "ar_SA": "",
         "ar_SA": "",
         "de_DE": "",
         "de_DE": "",
         "el_GR": "",
         "el_GR": "",
-        "en_US": "Show the other various information about the currently selected game that is missing from the Grid view layout.",
+        "en_US": "Show stats & details about the currently selected game.",
         "es_ES": "",
         "es_ES": "",
         "fr_FR": "",
         "fr_FR": "",
         "he_IL": "",
         "he_IL": "",
@@ -23298,4 +23298,4 @@
       }
       }
     }
     }
   ]
   ]
-}
+}

+ 0 - 1
src/Ryujinx/UI/Controls/ApplicationContextMenu.axaml

@@ -26,7 +26,6 @@
         Icon="{ext:Icon mdi-gamepad}"
         Icon="{ext:Icon mdi-gamepad}"
         ToolTip.Tip="{ext:Locale GameListContextMenuShowCompatEntryToolTip}"/>
         ToolTip.Tip="{ext:Locale GameListContextMenuShowCompatEntryToolTip}"/>
     <MenuItem
     <MenuItem
-        IsVisible="{Binding IsGrid}"
         Click="OpenApplicationData_Click"
         Click="OpenApplicationData_Click"
         Header="{ext:Locale GameListContextMenuShowGameData}"
         Header="{ext:Locale GameListContextMenuShowGameData}"
         Icon="{ext:Icon mdi-chart-line}"
         Icon="{ext:Icon mdi-chart-line}"

+ 107 - 99
src/Ryujinx/UI/Controls/ApplicationDataView.axaml

@@ -2,115 +2,123 @@
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
              xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
              xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
-             xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
              xmlns:appLibrary="using:Ryujinx.Ava.Utilities.AppLibrary"
              xmlns:appLibrary="using:Ryujinx.Ava.Utilities.AppLibrary"
+             xmlns:viewModels="using:Ryujinx.Ava.UI.ViewModels"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
              mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
              mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
              x:Class="Ryujinx.Ava.UI.Controls.ApplicationDataView"
              x:Class="Ryujinx.Ava.UI.Controls.ApplicationDataView"
-             x:DataType="appLibrary:ApplicationData">
-    <StackPanel Orientation="Vertical">
-        <Grid
-            RowDefinitions="Auto, Auto, Auto, Auto"
-            ColumnDefinitions="*">
-            <TextBlock Grid.Row="0"
-                       HorizontalAlignment="Center"
-                       Padding="0, -2, 0, 5" 
-                       Classes="h1" 
-                       Text="{Binding Name}" />
-            <TextBlock Grid.Row="1"
-                       HorizontalAlignment="Center"
-                       Text="{Binding Version}"
-                       TextAlignment="Start"
-                       TextWrapping="Wrap" />
-            <TextBlock Grid.Row="2"
-                       HorizontalAlignment="Center"
-                       Text="{Binding Developer}"
-                       TextAlignment="Start"
-                       TextWrapping="Wrap" />
-            <StackPanel Grid.ColumnSpan="2" Grid.Row="3" 
-                        HorizontalAlignment="Center" 
-                        Orientation="Horizontal" Margin="0 10, 0, 0" 
-                        Spacing="5">
-                <Button
-                    Click="PlayabilityStatus_OnClick"
-                    HorizontalContentAlignment="Left"
-                    VerticalAlignment="Center"
-                    IsVisible="{Binding HasPlayabilityInfo}"
-                    Background="{DynamicResource AppListBackgroundColor}"
-                    Padding="0">
+             x:DataType="viewModels:ApplicationDataViewModel">
+    <StackPanel Orientation="Horizontal">
+        <Image Margin="0"
+               MaxWidth="256"
+               MinWidth="256"
+               Source="{Binding AppData.Icon, Converter={x:Static helpers:BitmapArrayValueConverter.Instance}}" />
+        <Border Margin="5, 0" Width="2" Height="256" BorderBrush="Gray" Background="Gray" />
+        <StackPanel Orientation="Vertical">
+            <Grid
+                RowDefinitions="Auto, Auto, Auto, Auto"
+                ColumnDefinitions="*">
+                <TextBlock Grid.Row="0"
+                           HorizontalAlignment="Center"
+                           Padding="0, -2, 0, 5"
+                           Classes="h1"
+                           Text="{Binding AppData.Name}" />
+                <TextBlock Grid.Row="1"
+                           HorizontalAlignment="Center"
+                           Text="{Binding FormattedVersion}"
+                           TextAlignment="Start"
+                           TextWrapping="Wrap" />
+                <TextBlock Grid.Row="2"
+                           HorizontalAlignment="Center"
+                           Text="{Binding FormattedDeveloper}"
+                           TextAlignment="Start"
+                           TextWrapping="Wrap" />
+                <StackPanel Grid.ColumnSpan="2" Grid.Row="3"
+                            HorizontalAlignment="Center"
+                            Orientation="Horizontal" Margin="0 10, 0, 0"
+                            Spacing="5">
+                    <Button
+                        Click="PlayabilityStatus_OnClick"
+                        HorizontalContentAlignment="Left"
+                        VerticalAlignment="Center"
+                        IsVisible="{Binding AppData.HasPlayabilityInfo}"
+                        Background="{DynamicResource AppListBackgroundColor}"
+                        Padding="0">
+                        <TextBlock
+                            Margin="1.5"
+                            Tag="{Binding AppData.IdString}"
+                            Text="{Binding AppData.LocalizedStatus}"
+                            Foreground="{Binding AppData.PlayabilityStatus, Converter={x:Static helpers:PlayabilityStatusConverter.Shared}}"
+                            TextAlignment="Start"
+                            TextWrapping="Wrap" />
+                        <Button.Styles>
+                            <Style Selector="Button">
+                                <Setter Property="MinWidth"
+                                        Value="0" />
+                                <!-- avoids very wide buttons from the overall project avalonia style -->
+                            </Style>
+                        </Button.Styles>
+                    </Button>
+                    <Button
+                        Click="IdString_OnClick"
+                        HorizontalContentAlignment="Left"
+                        VerticalAlignment="Center"
+                        Background="{DynamicResource AppListBackgroundColor}"
+                        Padding="0">
+                        <TextBlock
+                            Margin="1.5"
+                            HorizontalAlignment="Stretch"
+                            Text="{Binding AppData.IdString}"
+                            TextAlignment="Start"
+                            TextWrapping="Wrap" />
+                    </Button>
+                </StackPanel>
+            </Grid>
+            <Separator Margin="0, 10, 0, 10" Height="2" BorderBrush="Gray" Background="Gray" />
+            <Grid ColumnDefinitions="Auto,*,Auto">
+                <StackPanel Grid.Column="0"
+                            Margin="10,0,0,0"
+                            HorizontalAlignment="Left"
+                            VerticalAlignment="Top"
+                            Orientation="Vertical"
+                            Spacing="5">
                     <TextBlock
                     <TextBlock
-                        Margin="1.5"
-                        Tag="{Binding IdString}"
-                        Text="{Binding LocalizedStatus}"
-                        Foreground="{Binding PlayabilityStatus, Converter={x:Static helpers:PlayabilityStatusConverter.Shared}}"
+                        HorizontalAlignment="Stretch"
+                        Text="{Binding FormattedFileExtension}"
                         TextAlignment="Start"
                         TextAlignment="Start"
                         TextWrapping="Wrap" />
                         TextWrapping="Wrap" />
-                    <Button.Styles>
-                        <Style Selector="Button">
-                            <Setter Property="MinWidth"
-                                    Value="0" />
-                            <!-- avoids very wide buttons from the overall project avalonia style -->
-                        </Style>
-                    </Button.Styles>
-                </Button>
-                <Button
-                    Click="IdString_OnClick"
-                    HorizontalContentAlignment="Left"
-                    VerticalAlignment="Center"
-                    Background="{DynamicResource AppListBackgroundColor}"
-                    Padding="0">
                     <TextBlock
                     <TextBlock
-                        Margin="1.5"
                         HorizontalAlignment="Stretch"
                         HorizontalAlignment="Stretch"
-                        Text="{Binding IdString}"
+                        IsVisible="{Binding AppData.HasLdnGames}"
+                        Text="{Binding FormattedLdnInfo}"
                         TextAlignment="Start"
                         TextAlignment="Start"
                         TextWrapping="Wrap" />
                         TextWrapping="Wrap" />
-                </Button>
-            </StackPanel>
-        </Grid>
-        <Separator Margin="0, 10, 0, 10" />
-        <Grid ColumnDefinitions="Auto,*,Auto">
-            <StackPanel Grid.Column="0"
-                        Margin="10,0,0,0"
-                        HorizontalAlignment="Left"
-                        VerticalAlignment="Top"
-                        Orientation="Vertical"
-                        Spacing="5">
-                <TextBlock
-                    HorizontalAlignment="Stretch"
-                    Text="{Binding FileExtension}"
-                    TextAlignment="Start"
-                    TextWrapping="Wrap" />
-                <TextBlock
-                    HorizontalAlignment="Stretch"
-                    Text="{Binding Converter={helpers:MultiplayerInfoConverter}}"
-                    TextAlignment="Start"
-                    TextWrapping="Wrap" />
-            </StackPanel>
-            <StackPanel
-                Grid.Column="2"
-                Margin="0,0,10,0"
-                HorizontalAlignment="Right"
-                VerticalAlignment="Top"
-                Orientation="Vertical"
-                Spacing="5">
-                <TextBlock
-                    HorizontalAlignment="Stretch"
-                    Text="{Binding LastPlayedString}"
-                    TextAlignment="End"
-                    TextWrapping="Wrap" />
-                <TextBlock
-                    HorizontalAlignment="Stretch"
-                    Text="{Binding TimePlayedString}"
-                    IsVisible="{Binding HasPlayedPreviously}"
-                    TextAlignment="End"
-                    TextWrapping="Wrap" />
-                <TextBlock
-                    HorizontalAlignment="Stretch"
-                    Text="{Binding FileSizeString}"
-                    TextAlignment="End"
-                    TextWrapping="Wrap" />
-            </StackPanel>
-        </Grid>
+                </StackPanel>
+                <StackPanel
+                    Grid.Column="2"
+                    Margin="0,0,10,0"
+                    HorizontalAlignment="Right"
+                    VerticalAlignment="Top"
+                    Orientation="Vertical"
+                    Spacing="5">
+                    <TextBlock
+                        HorizontalAlignment="Stretch"
+                        Text="{Binding FormattedLastPlayed}"
+                        TextAlignment="End"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        HorizontalAlignment="Stretch"
+                        Text="{Binding FormattedPlayTime}"
+                        IsVisible="{Binding AppData.HasPlayedPreviously}"
+                        TextAlignment="End"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        HorizontalAlignment="Stretch"
+                        Text="{Binding FormattedFileSize}"
+                        TextAlignment="End"
+                        TextWrapping="Wrap" />
+                </StackPanel>
+            </Grid>
+        </StackPanel>
     </StackPanel>
     </StackPanel>
 </UserControl>
 </UserControl>

+ 2 - 1
src/Ryujinx/UI/Controls/ApplicationDataView.axaml.cs

@@ -26,7 +26,8 @@ namespace Ryujinx.Ava.UI.Controls
                 PrimaryButtonText = string.Empty,
                 PrimaryButtonText = string.Empty,
                 SecondaryButtonText = string.Empty,
                 SecondaryButtonText = string.Empty,
                 CloseButtonText = LocaleManager.Instance[LocaleKeys.SettingsButtonClose],
                 CloseButtonText = LocaleManager.Instance[LocaleKeys.SettingsButtonClose],
-                Content = new ApplicationDataView { DataContext = appData }
+                MinWidth = 256,
+                Content = new ApplicationDataView { DataContext = new ApplicationDataViewModel(appData) }
             };
             };
 
 
             Style closeButton = new(x => x.Name("CloseButton"));
             Style closeButton = new(x => x.Name("CloseButton"));

+ 1 - 0
src/Ryujinx/UI/Controls/ApplicationListView.axaml

@@ -140,6 +140,7 @@
                                         TextWrapping="Wrap" />
                                         TextWrapping="Wrap" />
                                     <TextBlock
                                     <TextBlock
                                         HorizontalAlignment="Stretch"
                                         HorizontalAlignment="Stretch"
+                                        IsVisible="{Binding HasLdnGames}"
                                         Text="{Binding Converter={helpers:MultiplayerInfoConverter}}"
                                         Text="{Binding Converter={helpers:MultiplayerInfoConverter}}"
                                         TextAlignment="Start"
                                         TextAlignment="Start"
                                         TextWrapping="Wrap"/>
                                         TextWrapping="Wrap"/>

+ 2 - 5
src/Ryujinx/UI/Helpers/Converters/MultiplayerInfoConverter.cs

@@ -12,12 +12,9 @@ namespace Ryujinx.Ava.UI.Helpers
 
 
         public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
         public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
         {
         {
-            if (value is ApplicationData applicationData)
+            if (value is ApplicationData { HasLdnGames: true } applicationData)
             {
             {
-                if (applicationData.PlayerCount != 0 && applicationData.GameCount != 0)
-                {
-                    return $"Hosted Games: {applicationData.GameCount}\nOnline Players: {applicationData.PlayerCount}";
-                }
+                return $"Hosted Games: {applicationData.GameCount}\nOnline Players: {applicationData.PlayerCount}";
             }
             }
             
             
             return "";
             return "";

+ 34 - 0
src/Ryujinx/UI/ViewModels/ApplicationDataViewModel.cs

@@ -0,0 +1,34 @@
+using Gommon;
+using Ryujinx.Ava.Utilities.AppLibrary;
+
+namespace Ryujinx.Ava.UI.ViewModels
+{
+    public class ApplicationDataViewModel : BaseModel
+    {
+        private const string FormatVersion = "Current Version: {0}";
+        private const string FormatDeveloper = "Developed by {0}";
+        
+        private const string FormatExtension = "Game type: {0}";
+        private const string FormatLastPlayed = "Last played: {0}";
+        private const string FormatPlayTime = "Play time: {0}";
+        private const string FormatSize = "Size: {0}";
+
+        private const string FormatHostedGames = "Hosted Games: {0}";
+        private const string FormatPlayerCount = "Online Players: {0}";
+        
+        public ApplicationData AppData { get; }
+
+        public ApplicationDataViewModel(ApplicationData appData) => AppData = appData;
+
+        public string FormattedVersion => FormatVersion.Format(AppData.Version);
+        public string FormattedDeveloper => FormatDeveloper.Format(AppData.Developer);
+        
+        public string FormattedFileExtension => FormatExtension.Format(AppData.FileExtension);
+        public string FormattedLastPlayed => FormatLastPlayed.Format(AppData.LastPlayedString);
+        public string FormattedPlayTime => FormatPlayTime.Format(AppData.TimePlayedString);
+        public string FormattedFileSize => FormatSize.Format(AppData.FileSizeString);
+        
+        public string FormattedLdnInfo => 
+            $"{FormatHostedGames.Format(AppData.GameCount)}\n{FormatPlayerCount.Format(AppData.PlayerCount)}";
+    }
+}

+ 3 - 0
src/Ryujinx/Utilities/AppLibrary/ApplicationData.cs

@@ -49,6 +49,9 @@ namespace Ryujinx.Ava.Utilities.AppLibrary
         
         
         public int PlayerCount { get; set; }
         public int PlayerCount { get; set; }
         public int GameCount { get; set; }
         public int GameCount { get; set; }
+
+        public bool HasLdnGames => PlayerCount != 0 && GameCount != 0;
+        
         public TimeSpan TimePlayed { get; set; }
         public TimeSpan TimePlayed { get; set; }
         public DateTime? LastPlayed { get; set; }
         public DateTime? LastPlayed { get; set; }
         public string FileExtension { get; set; }
         public string FileExtension { get; set; }