From 3c7391a81981280113ca5cb999fc2cb75a03269d Mon Sep 17 00:00:00 2001 From: suchmememanyskill <38142618+suchmememanyskill@users.noreply.github.com> Date: Sun, 19 May 2024 21:37:31 +0200 Subject: [PATCH] Add hover label on game name --- Launcher/Views/GameViewSmall.axaml.cs | 1 + RemoteDownloaderPlugin/Plugin.cs | 18 ++++++++++++++++-- RemoteDownloaderPlugin/Store.cs | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Launcher/Views/GameViewSmall.axaml.cs b/Launcher/Views/GameViewSmall.axaml.cs index bf5ead9..2a5b6ad 100644 --- a/Launcher/Views/GameViewSmall.axaml.cs +++ b/Launcher/Views/GameViewSmall.axaml.cs @@ -46,6 +46,7 @@ public partial class GameViewSmall : UserControlExt public GameViewSmall() { InitializeComponent(); + OnUpdateView += () => ToolTip.SetTip(GameLabel, GameName); } public GameViewSmall(IGame game, Loader.App app) : this() diff --git a/RemoteDownloaderPlugin/Plugin.cs b/RemoteDownloaderPlugin/Plugin.cs index b48bb53..f38dc36 100644 --- a/RemoteDownloaderPlugin/Plugin.cs +++ b/RemoteDownloaderPlugin/Plugin.cs @@ -22,6 +22,7 @@ public class Plugin : IGameSource private Remote _cachedRemote = new(); private List _onlineGames = new(); + private List _platforms = new(); public async Task Initialize(IApp app) { @@ -78,7 +79,7 @@ public async Task> GetGames() List installedIds = installedGames.Select(x => x.Game.Id).ToList(); - return _onlineGames.Where(x => !installedIds.Contains(x.Entry.GameId)) + return _onlineGames.Where(x => !(installedIds.Contains(x.Entry.GameId) || Storage.Data.HiddenRemotePlatforms.Contains(x.Platform))) .Select(x => (IGame)x) .Concat(installedGames.Select(x => (IGame)x)) .ToList(); @@ -97,6 +98,8 @@ public async Task FetchRemote() _onlineGames = _cachedRemote.Emu.Select(x => new OnlineGame(x, this)) .Concat(_cachedRemote.Pc.Select(x => new OnlineGame(x, this))).ToList(); + + _platforms = _onlineGames.Select(x => x.Platform).Distinct().ToList(); return true; } @@ -129,7 +132,18 @@ public List GetGlobalCommands() App.ReloadGlobalCommands(); App.HideForm(); }, _ => App.HideForm()); - })).ToList()) + })).ToList()), + new Command("Hide Platforms", _platforms.Select(x => + new Command(Storage.Data.HiddenRemotePlatforms.Contains(x) ? $"Show {x}" : $"Hide {x}", () => + { + if (!Storage.Data.HiddenRemotePlatforms.Remove(x)) + { + Storage.Data.HiddenRemotePlatforms.Add(x); + } + + Storage.Save(); + App.ReloadGames(); + })).ToList()) }; return commands; diff --git a/RemoteDownloaderPlugin/Store.cs b/RemoteDownloaderPlugin/Store.cs index 8c1df66..9ac7dd8 100644 --- a/RemoteDownloaderPlugin/Store.cs +++ b/RemoteDownloaderPlugin/Store.cs @@ -50,5 +50,6 @@ public class Store public List EmuGames { get; set; } = new(); public List PcGames { get; set; } = new(); public List EmuProfiles { get; set; } = new(); + public List HiddenRemotePlatforms { get; set; } = new(); public string IndexUrl { get; set; } = ""; } \ No newline at end of file