1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-21 06:12:55 +08:00

More cleanup

This commit is contained in:
DrabWeb 2017-05-18 13:57:19 -03:00
parent b26c8dd1c7
commit 9f36a39c59
2 changed files with 34 additions and 30 deletions

View File

@ -23,27 +23,10 @@ namespace osu.Game.Overlays.Direct
{ {
private readonly Box tabStrip; private readonly Box tabStrip;
private readonly FillFlowContainer<ModeToggleButton> modeButtons; private readonly FillFlowContainer<ModeToggleButton> modeButtons;
private readonly OsuDropdown<RankStatus> rankStatusDropdown;
public readonly SearchTextBox Search; public readonly SearchTextBox Search;
public readonly SortTabControl SortTabs;
public enum RankStatus public readonly OsuEnumDropdown<RankStatus> RankStatusDropdown;
{
Any,
[Description("Ranked & Approved")]
RankedApproved,
Approved,
Loved,
Favourites,
[Description("Mod Requests")]
ModRequests,
Pending,
Graveyard,
[Description("My Maps")]
MyMaps,
}
protected override bool InternalContains(Vector2 screenSpacePos) => true;
public FilterControl() public FilterControl()
{ {
@ -83,13 +66,13 @@ namespace osu.Game.Overlays.Direct
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Spacing = new Vector2(10f, 0f), Spacing = new Vector2(10f, 0f),
}, },
new SortTabControl SortTabs = new SortTabControl
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
}, },
}, },
}, },
rankStatusDropdown = new SlimEnumDropdown<RankStatus> RankStatusDropdown = new SlimEnumDropdown<RankStatus>
{ {
Anchor = Anchor.BottomRight, Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight, Origin = Anchor.BottomRight,
@ -99,14 +82,18 @@ namespace osu.Game.Overlays.Direct
}, },
}; };
rankStatusDropdown.Current.Value = RankStatus.RankedApproved; RankStatusDropdown.Current.Value = RankStatus.RankedApproved;
//todo: possibly restore from config instead of always title
SortTabs.Current.Value = SortCriteria.Title;
SortTabs.Current.TriggerChange();
} }
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(OsuGame game, RulesetDatabase rulesets, OsuColour colours) private void load(OsuGame game, RulesetDatabase rulesets, OsuColour colours)
{ {
tabStrip.Colour = colours.Yellow; tabStrip.Colour = colours.Yellow;
rankStatusDropdown.AccentColour = colours.BlueDark; RankStatusDropdown.AccentColour = colours.BlueDark;
foreach (var r in rulesets.AllRulesets) foreach (var r in rulesets.AllRulesets)
{ {
@ -209,4 +196,20 @@ namespace osu.Game.Overlays.Direct
} }
} }
} }
public enum RankStatus
{
Any,
[Description("Ranked & Approved")]
RankedApproved,
Approved,
Loved,
Favourites,
[Description("Mod Requests")]
ModRequests,
Pending,
Graveyard,
[Description("My Maps")]
MyMaps,
}
} }

View File

@ -21,9 +21,8 @@ namespace osu.Game.Overlays.Direct
public class Header : Container public class Header : Container
{ {
private readonly Box tabStrip; private readonly Box tabStrip;
private readonly DirectTabControl tabs;
public Action<DirectTab> OnSelectTab; public readonly OsuTabControl<DirectTab> Tabs;
public Header() public Header()
{ {
@ -71,7 +70,7 @@ namespace osu.Game.Overlays.Direct
Width = 282, //todo: make this actually match the tab control's width instead of hardcoding Width = 282, //todo: make this actually match the tab control's width instead of hardcoding
Height = 1, Height = 1,
}, },
tabs = new DirectTabControl Tabs = new DirectTabControl
{ {
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
@ -81,7 +80,9 @@ namespace osu.Game.Overlays.Direct
}, },
}; };
tabs.Current.ValueChanged += (newValue) => OnSelectTab?.Invoke(newValue); //todo: possibly restore from config instead of always search
Tabs.Current.Value = DirectTab.Search;
Tabs.Current.TriggerChange();
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -114,10 +115,10 @@ namespace osu.Game.Overlays.Direct
{ {
Search, Search,
[Description("Newest Maps")] [Description("Newest Maps")]
New, NewestMaps,
[Description("Top Rated")] [Description("Top Rated")]
Top, TopRated,
[Description("Most Played")] [Description("Most Played")]
MostP MostPlayed
} }
} }