Use DirectSortCriteria for BeatmapListingSortTabControl

This commit is contained in:
Andrei Zavatski 2020-02-19 17:30:26 +03:00
parent 98654586de
commit 1442f5e0db
2 changed files with 8 additions and 19 deletions

View File

@ -8,16 +8,17 @@
using osuTK.Graphics;
using osuTK;
using osu.Framework.Input.Events;
using osu.Game.Overlays.Direct;
namespace osu.Game.Overlays.BeatmapListing
{
public class BeatmapListingSortTabControl : OverlaySortTabControl<BeatmapSortCriteria>
public class BeatmapListingSortTabControl : OverlaySortTabControl<DirectSortCriteria>
{
public readonly Bindable<SortDirection> SortDirection = new Bindable<SortDirection>(Overlays.SortDirection.Descending);
public BeatmapListingSortTabControl()
{
Current.Value = BeatmapSortCriteria.Ranked;
Current.Value = DirectSortCriteria.Ranked;
}
protected override SortTabControl CreateControl() => new BeatmapSortTabControl
@ -29,7 +30,7 @@ private class BeatmapSortTabControl : SortTabControl
{
public readonly Bindable<SortDirection> SortDirection = new Bindable<SortDirection>();
protected override TabItem<BeatmapSortCriteria> CreateTabItem(BeatmapSortCriteria value) => new BeatmapSortTabItem(value)
protected override TabItem<DirectSortCriteria> CreateTabItem(DirectSortCriteria value) => new BeatmapSortTabItem(value)
{
SortDirection = { BindTarget = SortDirection }
};
@ -39,12 +40,12 @@ private class BeatmapSortTabItem : SortTabItem
{
public readonly Bindable<SortDirection> SortDirection = new Bindable<SortDirection>();
public BeatmapSortTabItem(BeatmapSortCriteria value)
public BeatmapSortTabItem(DirectSortCriteria value)
: base(value)
{
}
protected override TabButton CreateTabButton(BeatmapSortCriteria value) => new BeatmapTabButton(value)
protected override TabButton CreateTabButton(DirectSortCriteria value) => new BeatmapTabButton(value)
{
Active = { BindTarget = Active },
SortDirection = { BindTarget = SortDirection }
@ -66,7 +67,7 @@ protected override Color4 ContentColour
private readonly SpriteIcon icon;
public BeatmapTabButton(BeatmapSortCriteria value)
public BeatmapTabButton(DirectSortCriteria value)
: base(value)
{
Add(icon = new SpriteIcon
@ -104,15 +105,4 @@ protected override bool OnClick(ClickEvent e)
}
}
}
public enum BeatmapSortCriteria
{
Title,
Artist,
Difficulty,
Ranked,
Rating,
Plays,
Favourites,
}
}

View File

@ -34,14 +34,13 @@ private void load(OsuColour colours, Bindable<RulesetInfo> ruleset)
public enum DirectSortCriteria
{
Relevance,
Title,
Artist,
Creator,
Difficulty,
Ranked,
Rating,
Plays,
Favourites,
Relevance,
}
}