2020-01-02 03:49:04 +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.
|
|
|
|
|
|
2021-08-23 13:41:14 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2020-01-02 03:49:04 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.UserInterface;
|
2021-08-23 13:41:14 +08:00
|
|
|
|
using osu.Game.Online.API;
|
2020-01-02 03:49:04 +08:00
|
|
|
|
using osu.Game.Rulesets;
|
|
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays
|
|
|
|
|
{
|
|
|
|
|
public class OverlayRulesetSelector : RulesetSelector
|
|
|
|
|
{
|
2020-01-26 22:07:17 +08:00
|
|
|
|
public OverlayRulesetSelector()
|
2020-01-02 03:49:04 +08:00
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-23 13:41:14 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(RulesetStore store, IAPIProvider api)
|
|
|
|
|
{
|
2021-08-23 14:56:00 +08:00
|
|
|
|
if (SelectInitialRuleset)
|
|
|
|
|
{
|
|
|
|
|
var preferredRuleset = store.GetRuleset(api.LocalUser.Value.PlayMode);
|
2021-08-23 13:41:14 +08:00
|
|
|
|
|
2021-08-23 14:56:00 +08:00
|
|
|
|
if (preferredRuleset != null)
|
2021-08-23 17:38:24 +08:00
|
|
|
|
Current.Value = preferredRuleset;
|
2021-08-23 14:56:00 +08:00
|
|
|
|
}
|
2021-08-23 13:41:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-01-02 03:49:04 +08:00
|
|
|
|
protected override TabItem<RulesetInfo> CreateTabItem(RulesetInfo value) => new OverlayRulesetTabItem(value);
|
|
|
|
|
|
|
|
|
|
protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
2020-03-25 05:14:15 +08:00
|
|
|
|
Spacing = new Vector2(20, 0),
|
2020-01-02 03:49:04 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|