Files
quiver-launcher/ViewModels/BrowseGame.cs
T
Thomas Georgiadis f1b3d035b1 Show the games a search matched, and a page for each game
Searching the App Catalog now lists the original games it matched above the
apps, as the website does, each with its box art and how many ways there are
to play it. A game's page shows the game over its artwork with its original
systems, then every app that plays it, best first by player feedback; an app's
Based on chips open it too, and Back returns to the page before.
2026-10-07 22:13:37 +11:00

27 lines
1.1 KiB
C#

using QuiverLauncher.Services;
namespace QuiverLauncher.ViewModels;
/// <summary>A card the controller can highlight in the App Catalog: an app, or a game a search matched.</summary>
public interface IBrowseCard
{
bool IsGamepadFocused { get; set; }
}
/// <summary>An original game a search matched, as on the website: its art, title and how many apps play it.</summary>
public sealed class BrowseGame(string slug, string title, string? art, int ways) : ObservableViewModel, IBrowseCard
{
private bool _isGamepadFocused;
public string Slug { get; } = slug;
public string Title { get; } = title;
public string? Art { get; } = art;
public int Ways { get; } = ways;
public string WaysText => Ways == 1 ? "1 way to play \u2192" : $"{Ways} ways to play \u2192";
public bool IsGamepadFocused { get => _isGamepadFocused; set => Set(ref _isGamepadFocused, value); }
/// <summary>The game's box art, else its other artwork.</summary>
public static string? ArtFor(QuiverCatalogGameInfo game) =>
new[] { game.LibraryArt?.Capsule, game.Artwork, game.LibraryArt?.Header }.FirstOrDefault(a => !string.IsNullOrWhiteSpace(a));
}