2018-06-11 12:28:50 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Game.Rulesets;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Settings
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// A <see cref="SettingsSubsection"/> which provides subclasses with the <see cref="IRulesetConfigManager"/>
|
|
|
|
|
/// from the <see cref="Ruleset"/>'s <see cref="Ruleset.CreateConfig()"/>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public abstract class RulesetSettingsSubsection : SettingsSubsection
|
|
|
|
|
{
|
|
|
|
|
private readonly Ruleset ruleset;
|
|
|
|
|
|
|
|
|
|
protected RulesetSettingsSubsection(Ruleset ruleset)
|
|
|
|
|
{
|
|
|
|
|
this.ruleset = ruleset;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private DependencyContainer dependencies;
|
|
|
|
|
|
|
|
|
|
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent)
|
|
|
|
|
{
|
|
|
|
|
dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
|
|
|
|
|
|
2018-06-11 14:07:42 +08:00
|
|
|
|
var config = dependencies.Get<RulesetConfigCache>().GetConfigFor(ruleset);
|
2018-06-11 12:28:50 +08:00
|
|
|
|
if (config != null)
|
|
|
|
|
dependencies.Cache(config);
|
|
|
|
|
|
|
|
|
|
return dependencies;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|