2019-10-04 14:35:41 +00: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.
|
|
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2019-10-15 20:33:50 +00:00
|
|
|
|
using osu.Framework.Bindables;
|
2019-10-04 14:35:41 +00:00
|
|
|
|
using osu.Framework.Graphics.UserInterface;
|
|
|
|
|
using osu.Game.Rulesets;
|
|
|
|
|
using System.Linq;
|
2021-10-29 08:58:46 +00:00
|
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
2019-10-04 14:35:41 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.BeatmapSet
|
|
|
|
|
{
|
2020-02-03 11:16:26 +00:00
|
|
|
|
public class BeatmapRulesetSelector : OverlayRulesetSelector
|
2019-10-04 14:35:41 +00:00
|
|
|
|
{
|
2021-10-29 08:58:46 +00:00
|
|
|
|
private readonly Bindable<APIBeatmapSet> beatmapSet = new Bindable<APIBeatmapSet>();
|
2019-10-04 14:35:41 +00:00
|
|
|
|
|
2021-10-29 08:58:46 +00:00
|
|
|
|
public APIBeatmapSet BeatmapSet
|
2019-10-04 14:35:41 +00:00
|
|
|
|
{
|
2019-10-15 20:33:50 +00:00
|
|
|
|
get => beatmapSet.Value;
|
2019-10-04 14:35:41 +00:00
|
|
|
|
set
|
|
|
|
|
{
|
2019-10-15 20:33:50 +00:00
|
|
|
|
// propagate value to tab items first to enable only available rulesets.
|
|
|
|
|
beatmapSet.Value = value;
|
2019-10-04 14:35:41 +00:00
|
|
|
|
|
2019-10-15 20:33:50 +00:00
|
|
|
|
SelectTab(TabContainer.TabItems.FirstOrDefault(t => t.Enabled.Value));
|
2019-10-04 14:35:41 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-15 20:33:50 +00:00
|
|
|
|
protected override TabItem<RulesetInfo> CreateTabItem(RulesetInfo value) => new BeatmapRulesetTabItem(value)
|
|
|
|
|
{
|
|
|
|
|
BeatmapSet = { BindTarget = beatmapSet }
|
|
|
|
|
};
|
2019-10-04 14:35:41 +00:00
|
|
|
|
}
|
|
|
|
|
}
|