1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-21 09:52:55 +08:00
osu-lazer/osu.Game/Overlays/Rankings/RankingsRulesetSelector.cs

57 lines
1.6 KiB
C#
Raw Normal View History

2019-09-12 10:06:51 +08:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets;
using osuTK;
using System.Linq;
namespace osu.Game.Overlays.Rankings
{
public class RankingsRulesetSelector : PageTabControl<RulesetInfo>
{
protected override TabItem<RulesetInfo> CreateTabItem(RulesetInfo value) => new RankingsTabItem(value);
protected override Dropdown<RulesetInfo> CreateDropdown() => null;
public RankingsRulesetSelector()
{
AutoSizeAxes = Axes.X;
}
[BackgroundDependencyLoader]
2019-09-12 10:16:56 +08:00
private void load(OsuColour colours, RulesetStore rulesets)
2019-09-12 10:06:51 +08:00
{
2019-09-12 10:16:56 +08:00
foreach (var r in rulesets.AvailableRulesets)
2019-09-12 10:06:51 +08:00
AddItem(r);
AccentColour = colours.Lime;
SelectTab(TabContainer.FirstOrDefault());
}
protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
{
AutoSizeAxes = Axes.X,
RelativeSizeAxes = Axes.Y,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(20, 0),
};
private class RankingsTabItem : PageTabItem
{
public RankingsTabItem(RulesetInfo value)
: base(value)
{
}
protected override string CreateText() => $"{Value.Name}";
}
}
}