osu/osu.Game/Rulesets/RulesetSelector.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

42 lines
1.2 KiB
C#
Raw Normal View History

// 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
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Allocation;
using osu.Framework.Logging;
2023-01-12 20:21:33 +00:00
using osu.Game.Extensions;
namespace osu.Game.Rulesets
{
public abstract partial class RulesetSelector : TabControl<RulesetInfo>
{
2019-06-26 08:52:25 +00:00
[Resolved]
protected RulesetStore Rulesets { get; private set; }
protected override Dropdown<RulesetInfo> CreateDropdown() => null;
2023-01-12 20:26:29 +00:00
protected virtual bool LegacyOnly => false;
[BackgroundDependencyLoader]
2019-06-26 08:52:25 +00:00
private void load()
{
2022-06-29 09:56:15 +00:00
foreach (var ruleset in Rulesets.AvailableRulesets)
{
2023-01-12 20:26:29 +00:00
if (!ruleset.IsLegacyRuleset() && LegacyOnly)
continue;
try
{
2022-06-29 09:56:15 +00:00
AddItem(ruleset);
}
catch
{
2022-06-29 09:56:15 +00:00
Logger.Log($"Could not create ruleset icon for {ruleset.Name}. Please check for an update from the developer.", level: LogLevel.Error);
}
}
}
}
}