mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 16:43:52 +09:00
Link beatmap set genre and language to listing filters
This commit is contained in:
@ -341,6 +341,8 @@ namespace osu.Game.Online.Chat
|
|||||||
OpenWiki,
|
OpenWiki,
|
||||||
Custom,
|
Custom,
|
||||||
OpenChangelog,
|
OpenChangelog,
|
||||||
|
FilterBeatmapSetGenre,
|
||||||
|
FilterBeatmapSetLanguage,
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Link : IComparable<Link>
|
public class Link : IComparable<Link>
|
||||||
|
@ -356,6 +356,14 @@ namespace osu.Game
|
|||||||
SearchBeatmapSet(argString);
|
SearchBeatmapSet(argString);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LinkAction.FilterBeatmapSetGenre:
|
||||||
|
FilterBeatmapSetGenre(argString);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LinkAction.FilterBeatmapSetLanguage:
|
||||||
|
FilterBeatmapSetLanguage(argString);
|
||||||
|
break;
|
||||||
|
|
||||||
case LinkAction.OpenEditorTimestamp:
|
case LinkAction.OpenEditorTimestamp:
|
||||||
case LinkAction.JoinMultiplayerMatch:
|
case LinkAction.JoinMultiplayerMatch:
|
||||||
case LinkAction.Spectate:
|
case LinkAction.Spectate:
|
||||||
@ -460,6 +468,10 @@ namespace osu.Game
|
|||||||
/// <param name="query">The query to search for.</param>
|
/// <param name="query">The query to search for.</param>
|
||||||
public void SearchBeatmapSet(string query) => waitForReady(() => beatmapListing, _ => beatmapListing.ShowWithSearch(query));
|
public void SearchBeatmapSet(string query) => waitForReady(() => beatmapListing, _ => beatmapListing.ShowWithSearch(query));
|
||||||
|
|
||||||
|
public void FilterBeatmapSetGenre(string genre) => waitForReady(() => beatmapListing, _ => beatmapListing.ShowWithGenreFilter(genre));
|
||||||
|
|
||||||
|
public void FilterBeatmapSetLanguage(string language) => waitForReady(() => beatmapListing, _ => beatmapListing.ShowWithLanguageFilter(language));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Show a wiki's page as an overlay
|
/// Show a wiki's page as an overlay
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Humanizer;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
@ -145,6 +146,12 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
public void Search(string query)
|
public void Search(string query)
|
||||||
=> Schedule(() => searchControl.Query.Value = query);
|
=> Schedule(() => searchControl.Query.Value = query);
|
||||||
|
|
||||||
|
public void FilterGenre(string genre)
|
||||||
|
=> Schedule(() => searchControl.Genre.Value = genre.DehumanizeTo<SearchGenre>());
|
||||||
|
|
||||||
|
public void FilterLanguage(string language)
|
||||||
|
=> Schedule(() => searchControl.Language.Value = language.DehumanizeTo<SearchLanguage>());
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
@ -110,6 +110,18 @@ namespace osu.Game.Overlays
|
|||||||
ScrollFlow.ScrollToStart();
|
ScrollFlow.ScrollToStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ShowWithGenreFilter(string genre)
|
||||||
|
{
|
||||||
|
ShowWithSearch(string.Empty);
|
||||||
|
filterControl.FilterGenre(genre);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowWithLanguageFilter(string language)
|
||||||
|
{
|
||||||
|
ShowWithSearch(string.Empty);
|
||||||
|
filterControl.FilterLanguage(language);
|
||||||
|
}
|
||||||
|
|
||||||
protected override BeatmapListingHeader CreateHeader() => new BeatmapListingHeader();
|
protected override BeatmapListingHeader CreateHeader() => new BeatmapListingHeader();
|
||||||
|
|
||||||
protected override Color4 BackgroundColour => ColourProvider.Background6;
|
protected override Color4 BackgroundColour => ColourProvider.Background6;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using Humanizer;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -12,6 +13,7 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Online.Chat;
|
using osu.Game.Online.Chat;
|
||||||
|
using osu.Game.Overlays.BeatmapListing;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -116,6 +118,14 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MetadataType.Genre:
|
||||||
|
loaded.AddLink(text.DehumanizeTo<SearchGenre>().GetLocalisableDescription(), LinkAction.FilterBeatmapSetGenre, text);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataType.Language:
|
||||||
|
loaded.AddLink(text.DehumanizeTo<SearchLanguage>().GetLocalisableDescription(), LinkAction.FilterBeatmapSetLanguage, text);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
loaded.AddText(text);
|
loaded.AddText(text);
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user