From fd6b3b6b36bd7d88e4aa7e16393f2cbf6f8343d8 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Tue, 17 Sep 2024 22:25:18 -0700 Subject: [PATCH] Fix searching by clicking title/artist in beatmap overlay not following original language setting --- osu.Game/Online/Chat/MessageFormatter.cs | 2 ++ osu.Game/OsuGame.cs | 15 +++++++++++---- .../BeatmapSet/BeatmapSetHeaderContent.cs | 4 ++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/osu.Game/Online/Chat/MessageFormatter.cs b/osu.Game/Online/Chat/MessageFormatter.cs index 77454c4775..0f444ccde9 100644 --- a/osu.Game/Online/Chat/MessageFormatter.cs +++ b/osu.Game/Online/Chat/MessageFormatter.cs @@ -340,6 +340,8 @@ namespace osu.Game.Online.Chat Spectate, OpenUserProfile, SearchBeatmapSet, + SearchBeatmapTitle, + SearchBeatmapArtist, OpenWiki, Custom, OpenChangelog, diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 0ef6a94679..ffb145d7de 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -445,10 +445,17 @@ namespace osu.Game break; case LinkAction.SearchBeatmapSet: - if (link.Argument is RomanisableString romanisable) - SearchBeatmapSet(romanisable.GetPreferred(Localisation.CurrentParameters.Value.PreferOriginalScript)); - else - SearchBeatmapSet(argString); + SearchBeatmapSet(argString); + break; + + case LinkAction.SearchBeatmapTitle: + string title = ((RomanisableString)link.Argument).GetPreferred(Localisation.CurrentParameters.Value.PreferOriginalScript); + SearchBeatmapSet($@"title=""""{title}"""""); + break; + + case LinkAction.SearchBeatmapArtist: + string artist = ((RomanisableString)link.Argument).GetPreferred(Localisation.CurrentParameters.Value.PreferOriginalScript); + SearchBeatmapSet($@"artist=""""{artist}"""""); break; case LinkAction.FilterBeatmapSetGenre: diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs b/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs index f9e0c6c380..6ea16a9997 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs @@ -242,7 +242,7 @@ namespace osu.Game.Overlays.BeatmapSet title.Clear(); artist.Clear(); - title.AddLink(titleText, LinkAction.SearchBeatmapSet, $@"title=""""{titleText}"""""); + title.AddLink(titleText, LinkAction.SearchBeatmapTitle, titleText); title.AddArbitraryDrawable(Empty().With(d => d.Width = 5)); title.AddArbitraryDrawable(externalLink = new ExternalLinkButton()); @@ -259,7 +259,7 @@ namespace osu.Game.Overlays.BeatmapSet title.AddArbitraryDrawable(new SpotlightBeatmapBadge()); } - artist.AddLink(artistText, LinkAction.SearchBeatmapSet, $@"artist=""""{artistText}"""""); + artist.AddLink(artistText, LinkAction.SearchBeatmapArtist, artistText); if (setInfo.NewValue.TrackId != null) {