GameGridView.axaml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <UserControl
  2. x:Class="Ryujinx.Ava.Ui.Controls.GameGridView"
  3. xmlns="https://github.com/avaloniaui"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:controls="clr-namespace:Ryujinx.Ava.Ui.Controls"
  6. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  7. xmlns:flex="clr-namespace:Avalonia.Flexbox;assembly=Avalonia.Flexbox"
  8. xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
  9. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  10. xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
  11. d:DesignHeight="450"
  12. d:DesignWidth="800"
  13. mc:Ignorable="d"
  14. Focusable="True">
  15. <UserControl.Resources>
  16. <controls:BitmapArrayValueConverter x:Key="ByteImage" />
  17. <MenuFlyout x:Key="GameContextMenu" Opened="MenuBase_OnMenuOpened">
  18. <MenuItem
  19. Command="{Binding ToggleFavorite}"
  20. Header="{locale:Locale GameListContextMenuToggleFavorite}"
  21. ToolTip.Tip="{locale:Locale GameListContextMenuToggleFavoriteToolTip}" />
  22. <Separator />
  23. <MenuItem
  24. Command="{Binding OpenUserSaveDirectory}"
  25. Header="{locale:Locale GameListContextMenuOpenUserSaveDirectory}"
  26. ToolTip.Tip="{locale:Locale GameListContextMenuOpenUserSaveDirectoryToolTip}" />
  27. <MenuItem
  28. Command="{Binding OpenDeviceSaveDirectory}"
  29. Header="{locale:Locale GameListContextMenuOpenUserDeviceDirectory}"
  30. ToolTip.Tip="{locale:Locale GameListContextMenuOpenUserDeviceDirectoryToolTip}" />
  31. <MenuItem
  32. Command="{Binding OpenBcatSaveDirectory}"
  33. Header="{locale:Locale GameListContextMenuOpenUserBcatDirectory}"
  34. ToolTip.Tip="{locale:Locale GameListContextMenuOpenUserBcatDirectoryToolTip}" />
  35. <Separator />
  36. <MenuItem
  37. Command="{Binding OpenTitleUpdateManager}"
  38. Header="{locale:Locale GameListContextMenuManageTitleUpdates}"
  39. ToolTip.Tip="{locale:Locale GameListContextMenuManageTitleUpdatesToolTip}" />
  40. <MenuItem
  41. Command="{Binding OpenDownloadableContentManager}"
  42. Header="{locale:Locale GameListContextMenuManageDlc}"
  43. ToolTip.Tip="{locale:Locale GameListContextMenuManageDlcToolTip}" />
  44. <MenuItem
  45. Command="{Binding OpenCheatManager}"
  46. Header="{locale:Locale GameListContextMenuManageCheat}"
  47. ToolTip.Tip="{locale:Locale GameListContextMenuManageCheatToolTip}" />
  48. <MenuItem
  49. Command="{Binding OpenModsDirectory}"
  50. Header="{locale:Locale GameListContextMenuOpenModsDirectory}"
  51. ToolTip.Tip="{locale:Locale GameListContextMenuOpenModsDirectoryToolTip}" />
  52. <MenuItem
  53. Command="{Binding OpenSdModsDirectory}"
  54. Header="{locale:Locale GameListContextMenuOpenSdModsDirectory}"
  55. ToolTip.Tip="{locale:Locale GameListContextMenuOpenSdModsDirectoryToolTip}" />
  56. <Separator />
  57. <MenuItem Header="{locale:Locale GameListContextMenuCacheManagement}">
  58. <MenuItem
  59. Command="{Binding PurgePtcCache}"
  60. Header="{locale:Locale GameListContextMenuCacheManagementPurgePptc}"
  61. ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementPurgePptcToolTip}" />
  62. <MenuItem
  63. Command="{Binding PurgeShaderCache}"
  64. Header="{locale:Locale GameListContextMenuCacheManagementPurgeShaderCache}"
  65. ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementPurgeShaderCacheToolTip}" />
  66. <MenuItem
  67. Command="{Binding OpenPtcDirectory}"
  68. Header="{locale:Locale GameListContextMenuCacheManagementOpenPptcDirectory}"
  69. ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementOpenPptcDirectoryToolTip}" />
  70. <MenuItem
  71. Command="{Binding OpenShaderCacheDirectory}"
  72. Header="{locale:Locale GameListContextMenuCacheManagementOpenShaderCacheDirectory}"
  73. ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementOpenShaderCacheDirectoryToolTip}" />
  74. </MenuItem>
  75. <MenuItem Header="{locale:Locale GameListContextMenuExtractData}">
  76. <MenuItem
  77. Command="{Binding ExtractExeFs}"
  78. Header="{locale:Locale GameListContextMenuExtractDataExeFS}"
  79. ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataExeFSToolTip}" />
  80. <MenuItem
  81. Command="{Binding ExtractRomFs}"
  82. Header="{locale:Locale GameListContextMenuExtractDataRomFS}"
  83. ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataRomFSToolTip}" />
  84. <MenuItem
  85. Command="{Binding ExtractLogo}"
  86. Header="{locale:Locale GameListContextMenuExtractDataLogo}"
  87. ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataLogoToolTip}" />
  88. </MenuItem>
  89. </MenuFlyout>
  90. </UserControl.Resources>
  91. <Grid>
  92. <Grid.RowDefinitions>
  93. <RowDefinition Height="*" />
  94. </Grid.RowDefinitions>
  95. <ListBox
  96. Grid.Row="0"
  97. Padding="8"
  98. HorizontalAlignment="Stretch"
  99. VerticalAlignment="Stretch"
  100. ContextFlyout="{StaticResource GameContextMenu}"
  101. DoubleTapped="GameList_DoubleTapped"
  102. Items="{Binding AppsObservableList}"
  103. SelectionChanged="GameList_SelectionChanged">
  104. <ListBox.ItemsPanel>
  105. <ItemsPanelTemplate>
  106. <flex:FlexPanel
  107. HorizontalAlignment="Stretch"
  108. VerticalAlignment="Stretch"
  109. AlignContent="FlexStart"
  110. JustifyContent="Center" />
  111. </ItemsPanelTemplate>
  112. </ListBox.ItemsPanel>
  113. <ListBox.Styles>
  114. <Style Selector="ListBoxItem">
  115. <Setter Property="Padding" Value="0" />
  116. <Setter Property="Margin" Value="5" />
  117. <Setter Property="CornerRadius" Value="4" />
  118. <Setter Property="Background" Value="{DynamicResource AppListBackgroundColor}" />
  119. <Style.Animations>
  120. <Animation Duration="0:0:0.7">
  121. <KeyFrame Cue="0%">
  122. <Setter Property="MaxWidth" Value="0" />
  123. <Setter Property="Opacity" Value="0.0" />
  124. </KeyFrame>
  125. <KeyFrame Cue="50%">
  126. <Setter Property="MaxWidth" Value="1000" />
  127. <Setter Property="Opacity" Value="0.3" />
  128. </KeyFrame>
  129. <KeyFrame Cue="100%">
  130. <Setter Property="MaxWidth" Value="1000" />
  131. <Setter Property="Opacity" Value="1.0" />
  132. </KeyFrame>
  133. </Animation>
  134. </Style.Animations>
  135. </Style>
  136. <Style Selector="ListBoxItem:selected /template/ ContentPresenter">
  137. <Setter Property="Background" Value="{DynamicResource AppListBackgroundColor}" />
  138. </Style>
  139. <Style Selector="ListBoxItem:pointerover /template/ ContentPresenter">
  140. <Setter Property="Background" Value="{DynamicResource AppListHoverBackgroundColor}" />
  141. </Style>
  142. </ListBox.Styles>
  143. <ListBox.ItemTemplate>
  144. <DataTemplate>
  145. <Grid>
  146. <Border
  147. Margin="10"
  148. HorizontalAlignment="Stretch"
  149. VerticalAlignment="Stretch"
  150. Classes.huge="{Binding $parent[UserControl].DataContext.IsGridHuge}"
  151. Classes.large="{Binding $parent[UserControl].DataContext.IsGridLarge}"
  152. Classes.normal="{Binding $parent[UserControl].DataContext.IsGridMedium}"
  153. Classes.small="{Binding $parent[UserControl].DataContext.IsGridSmall}"
  154. ClipToBounds="True"
  155. CornerRadius="4">
  156. <Grid>
  157. <Grid.RowDefinitions>
  158. <RowDefinition Height="Auto" />
  159. <RowDefinition Height="Auto" />
  160. </Grid.RowDefinitions>
  161. <Image
  162. Grid.Row="0"
  163. HorizontalAlignment="Stretch"
  164. VerticalAlignment="Top"
  165. Source="{Binding Icon, Converter={StaticResource ByteImage}}" />
  166. <Panel
  167. Grid.Row="1"
  168. Height="50"
  169. Margin="0 10 0 0"
  170. HorizontalAlignment="Stretch"
  171. VerticalAlignment="Stretch"
  172. IsVisible="{Binding $parent[UserControl].DataContext.ShowNames}">
  173. <TextBlock
  174. HorizontalAlignment="Stretch"
  175. VerticalAlignment="Center"
  176. Text="{Binding TitleName}"
  177. TextAlignment="Center"
  178. TextWrapping="Wrap" />
  179. </Panel>
  180. </Grid>
  181. </Border>
  182. <ui:SymbolIcon
  183. Margin="5,5,0,0"
  184. HorizontalAlignment="Left"
  185. VerticalAlignment="Top"
  186. FontSize="16"
  187. Foreground="{DynamicResource SystemAccentColor}"
  188. IsVisible="{Binding Favorite}"
  189. Symbol="StarFilled" />
  190. </Grid>
  191. </DataTemplate>
  192. </ListBox.ItemTemplate>
  193. </ListBox>
  194. </Grid>
  195. </UserControl>