From c185acdbae367902f84e803b12d62ebd95c0566d Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Wed, 18 Sep 2024 11:16:25 -0700 Subject: [PATCH] Use `GetLocalisedBindableString()` instead --- osu.Game/Online/Chat/MessageFormatter.cs | 2 -- osu.Game/OsuGame.cs | 18 ++++++++---------- .../BeatmapSet/BeatmapSetHeaderContent.cs | 4 ++-- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/osu.Game/Online/Chat/MessageFormatter.cs b/osu.Game/Online/Chat/MessageFormatter.cs index 0f444ccde9..77454c4775 100644 --- a/osu.Game/Online/Chat/MessageFormatter.cs +++ b/osu.Game/Online/Chat/MessageFormatter.cs @@ -340,8 +340,6 @@ public enum LinkAction Spectate, OpenUserProfile, SearchBeatmapSet, - SearchBeatmapTitle, - SearchBeatmapArtist, OpenWiki, Custom, OpenChangelog, diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index ffb145d7de..1af86b2d83 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -445,17 +445,15 @@ public void HandleLink(LinkDetails link) => Schedule(() => break; case LinkAction.SearchBeatmapSet: - SearchBeatmapSet(argString); - break; + if (link.Argument is LocalisableString localisable) + { + var localised = Localisation.GetLocalisedBindableString(localisable); + SearchBeatmapSet(localised.Value); + localised.UnbindAll(); + } + else + SearchBeatmapSet(argString); - 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 6ea16a9997..a50043f0f0 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs @@ -242,7 +242,7 @@ private void load(OverlayColourProvider colourProvider) title.Clear(); artist.Clear(); - title.AddLink(titleText, LinkAction.SearchBeatmapTitle, titleText); + title.AddLink(titleText, LinkAction.SearchBeatmapSet, LocalisableString.Interpolate($@"title=""""{titleText}""""")); title.AddArbitraryDrawable(Empty().With(d => d.Width = 5)); title.AddArbitraryDrawable(externalLink = new ExternalLinkButton()); @@ -259,7 +259,7 @@ private void load(OverlayColourProvider colourProvider) title.AddArbitraryDrawable(new SpotlightBeatmapBadge()); } - artist.AddLink(artistText, LinkAction.SearchBeatmapArtist, artistText); + artist.AddLink(artistText, LinkAction.SearchBeatmapSet, LocalisableString.Interpolate($@"artist=""""{artistText}""""")); if (setInfo.NewValue.TrackId != null) {