mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 03:02:54 +08:00
Merge pull request #21405 from LumpBloom7/Editor-DrawableRuleset-Dependencies
Provide DrawableRulesetDependencies from HitObjectComposer
This commit is contained in:
commit
a39bd634c4
@ -90,6 +90,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
|
||||
public override bool CursorInPlacementArea => false;
|
||||
|
||||
public TestHitObjectComposer(Playfield playfield)
|
||||
: base(new ManiaRuleset())
|
||||
{
|
||||
Playfield = playfield;
|
||||
}
|
||||
|
@ -45,8 +45,6 @@ namespace osu.Game.Rulesets.Edit
|
||||
{
|
||||
protected IRulesetConfigManager Config { get; private set; }
|
||||
|
||||
protected readonly Ruleset Ruleset;
|
||||
|
||||
// Provides `Playfield`
|
||||
private DependencyContainer dependencies;
|
||||
|
||||
@ -74,8 +72,8 @@ namespace osu.Game.Rulesets.Edit
|
||||
private IBindable<bool> hasTiming;
|
||||
|
||||
protected HitObjectComposer(Ruleset ruleset)
|
||||
: base(ruleset)
|
||||
{
|
||||
Ruleset = ruleset;
|
||||
}
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
|
||||
@ -419,8 +417,11 @@ namespace osu.Game.Rulesets.Edit
|
||||
[Cached]
|
||||
public abstract partial class HitObjectComposer : CompositeDrawable, IPositionSnapProvider
|
||||
{
|
||||
protected HitObjectComposer()
|
||||
public readonly Ruleset Ruleset;
|
||||
|
||||
protected HitObjectComposer(Ruleset ruleset)
|
||||
{
|
||||
Ruleset = ruleset;
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,36 @@
|
||||
// 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;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Rulesets.UI
|
||||
{
|
||||
public partial class DrawableRulesetDependenciesProvidingContainer : Container
|
||||
{
|
||||
private readonly Ruleset ruleset;
|
||||
|
||||
private DrawableRulesetDependencies rulesetDependencies = null!;
|
||||
|
||||
public DrawableRulesetDependenciesProvidingContainer(Ruleset ruleset)
|
||||
{
|
||||
this.ruleset = ruleset;
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
{
|
||||
return rulesetDependencies = new DrawableRulesetDependencies(ruleset, base.CreateChildDependencies(parent));
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
if (rulesetDependencies.IsNotNull())
|
||||
rulesetDependencies.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
@ -20,6 +20,7 @@ using osu.Game.Rulesets.Edit.Tools;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.Edit.Components.TernaryButtons;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
@ -57,7 +58,10 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
{
|
||||
TernaryStates = CreateTernaryButtons().ToArray();
|
||||
|
||||
AddInternal(placementBlueprintContainer);
|
||||
AddInternal(new DrawableRulesetDependenciesProvidingContainer(Composer.Ruleset)
|
||||
{
|
||||
Child = placementBlueprintContainer
|
||||
});
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
|
Loading…
Reference in New Issue
Block a user