1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-09 09:37:42 +08:00
osu-lazer/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs

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

40 lines
1.3 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.
using osu.Framework.Allocation;
2019-04-25 16:36:17 +08:00
using osu.Game.Configuration;
using osu.Game.Rulesets;
2018-07-11 16:25:57 +08:00
using osu.Game.Rulesets.Configuration;
namespace osu.Game.Overlays.Settings
{
/// <summary>
/// A <see cref="SettingsSubsection"/> which provides subclasses with the <see cref="IRulesetConfigManager"/>
2019-04-25 16:36:17 +08:00
/// from the <see cref="Ruleset"/>'s <see cref="Ruleset.CreateConfig(SettingsStore)"/>.
/// </summary>
public abstract class RulesetSettingsSubsection : SettingsSubsection
{
private readonly Ruleset ruleset;
2018-07-11 16:25:57 +08:00
protected IRulesetConfigManager Config;
protected RulesetSettingsSubsection(Ruleset ruleset)
{
this.ruleset = ruleset;
}
private DependencyContainer dependencies;
2018-07-11 16:07:14 +08:00
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{
2018-07-11 16:07:14 +08:00
dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
Config = dependencies.Get<IRulesetConfigCache>().GetConfigFor(ruleset);
2018-07-11 16:25:57 +08:00
if (Config != null)
dependencies.Cache(Config);
return dependencies;
}
}
}