mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Merge pull request #21405 from LumpBloom7/Editor-DrawableRuleset-Dependencies
Provide DrawableRulesetDependencies from HitObjectComposer
This commit is contained in:
@ -90,6 +90,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
|
|||||||
public override bool CursorInPlacementArea => false;
|
public override bool CursorInPlacementArea => false;
|
||||||
|
|
||||||
public TestHitObjectComposer(Playfield playfield)
|
public TestHitObjectComposer(Playfield playfield)
|
||||||
|
: base(new ManiaRuleset())
|
||||||
{
|
{
|
||||||
Playfield = playfield;
|
Playfield = playfield;
|
||||||
}
|
}
|
||||||
|
@ -45,8 +45,6 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
{
|
{
|
||||||
protected IRulesetConfigManager Config { get; private set; }
|
protected IRulesetConfigManager Config { get; private set; }
|
||||||
|
|
||||||
protected readonly Ruleset Ruleset;
|
|
||||||
|
|
||||||
// Provides `Playfield`
|
// Provides `Playfield`
|
||||||
private DependencyContainer dependencies;
|
private DependencyContainer dependencies;
|
||||||
|
|
||||||
@ -74,8 +72,8 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
private IBindable<bool> hasTiming;
|
private IBindable<bool> hasTiming;
|
||||||
|
|
||||||
protected HitObjectComposer(Ruleset ruleset)
|
protected HitObjectComposer(Ruleset ruleset)
|
||||||
|
: base(ruleset)
|
||||||
{
|
{
|
||||||
Ruleset = ruleset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
|
||||||
@ -419,8 +417,11 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
[Cached]
|
[Cached]
|
||||||
public abstract partial class HitObjectComposer : CompositeDrawable, IPositionSnapProvider
|
public abstract partial class HitObjectComposer : CompositeDrawable, IPositionSnapProvider
|
||||||
{
|
{
|
||||||
protected HitObjectComposer()
|
public readonly Ruleset Ruleset;
|
||||||
|
|
||||||
|
protected HitObjectComposer(Ruleset ruleset)
|
||||||
{
|
{
|
||||||
|
Ruleset = ruleset;
|
||||||
RelativeSizeAxes = Axes.Both;
|
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;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Screens.Edit.Components.TernaryButtons;
|
using osu.Game.Screens.Edit.Components.TernaryButtons;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
@ -57,7 +58,10 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
{
|
{
|
||||||
TernaryStates = CreateTernaryButtons().ToArray();
|
TernaryStates = CreateTernaryButtons().ToArray();
|
||||||
|
|
||||||
AddInternal(placementBlueprintContainer);
|
AddInternal(new DrawableRulesetDependenciesProvidingContainer(Composer.Ruleset)
|
||||||
|
{
|
||||||
|
Child = placementBlueprintContainer
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
|
Reference in New Issue
Block a user