mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 20:47:51 +08:00
Move EditorBeatmap to Editor itself (#7399)
Move EditorBeatmap to Editor itself Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
commit
beb8e72e15
@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
typeof(CircularDistanceSnapGrid)
|
typeof(CircularDistanceSnapGrid)
|
||||||
};
|
};
|
||||||
|
|
||||||
[Cached(typeof(IEditorBeatmap))]
|
[Cached(typeof(EditorBeatmap))]
|
||||||
private readonly EditorBeatmap editorBeatmap;
|
private readonly EditorBeatmap editorBeatmap;
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
|
@ -2,9 +2,11 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Rulesets.Osu.Beatmaps;
|
||||||
using osu.Game.Rulesets.Osu.Edit;
|
using osu.Game.Rulesets.Osu.Edit;
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
@ -16,6 +18,9 @@ namespace osu.Game.Tests.Editor
|
|||||||
{
|
{
|
||||||
private TestHitObjectComposer composer;
|
private TestHitObjectComposer composer;
|
||||||
|
|
||||||
|
[Cached(typeof(EditorBeatmap))]
|
||||||
|
private readonly EditorBeatmap editorBeatmap = new EditorBeatmap(new OsuBeatmap());
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup() => Schedule(() =>
|
public void Setup() => Schedule(() =>
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Rulesets.Osu.Beatmaps;
|
||||||
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.Edit.Compose;
|
using osu.Game.Screens.Edit.Compose;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Editor
|
namespace osu.Game.Tests.Visual.Editor
|
||||||
@ -11,10 +13,21 @@ namespace osu.Game.Tests.Visual.Editor
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestSceneComposeScreen : EditorClockTestScene
|
public class TestSceneComposeScreen : EditorClockTestScene
|
||||||
{
|
{
|
||||||
|
[Cached(typeof(EditorBeatmap))]
|
||||||
|
private readonly EditorBeatmap editorBeatmap =
|
||||||
|
new EditorBeatmap(new OsuBeatmap
|
||||||
|
{
|
||||||
|
BeatmapInfo =
|
||||||
|
{
|
||||||
|
Ruleset = new OsuRuleset().RulesetInfo
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap);
|
||||||
|
|
||||||
Child = new ComposeScreen();
|
Child = new ComposeScreen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Tests.Visual.Editor
|
|||||||
private const double beat_length = 100;
|
private const double beat_length = 100;
|
||||||
private static readonly Vector2 grid_position = new Vector2(512, 384);
|
private static readonly Vector2 grid_position = new Vector2(512, 384);
|
||||||
|
|
||||||
[Cached(typeof(IEditorBeatmap))]
|
[Cached(typeof(EditorBeatmap))]
|
||||||
private readonly EditorBeatmap editorBeatmap;
|
private readonly EditorBeatmap editorBeatmap;
|
||||||
|
|
||||||
[Cached(typeof(IDistanceSnapProvider))]
|
[Cached(typeof(IDistanceSnapProvider))]
|
||||||
|
@ -16,6 +16,7 @@ using osu.Game.Rulesets.Osu.Edit;
|
|||||||
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
|
||||||
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.Edit.Compose.Components;
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -59,9 +60,12 @@ namespace osu.Game.Tests.Visual.Editor
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var editorBeatmap = new EditorBeatmap(Beatmap.Value.GetPlayableBeatmap(new OsuRuleset().RulesetInfo));
|
||||||
|
|
||||||
var clock = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
|
var clock = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
|
||||||
Dependencies.CacheAs<IAdjustableClock>(clock);
|
Dependencies.CacheAs<IAdjustableClock>(clock);
|
||||||
Dependencies.CacheAs<IFrameBasedClock>(clock);
|
Dependencies.CacheAs<IFrameBasedClock>(clock);
|
||||||
|
Dependencies.CacheAs(editorBeatmap);
|
||||||
|
|
||||||
Child = new OsuHitObjectComposer(new OsuRuleset());
|
Child = new OsuHitObjectComposer(new OsuRuleset());
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,8 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu.Beatmaps;
|
||||||
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.Edit.Timing;
|
using osu.Game.Screens.Edit.Timing;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Editor
|
namespace osu.Game.Tests.Visual.Editor
|
||||||
@ -25,10 +26,13 @@ namespace osu.Game.Tests.Visual.Editor
|
|||||||
typeof(RowAttribute)
|
typeof(RowAttribute)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Cached(typeof(EditorBeatmap))]
|
||||||
|
private readonly EditorBeatmap editorBeatmap = new EditorBeatmap(new OsuBeatmap());
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap);
|
||||||
Child = new TimingScreen();
|
Child = new TimingScreen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
private readonly DrawableRuleset<TObject> drawableRuleset;
|
private readonly DrawableRuleset<TObject> drawableRuleset;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IEditorBeatmap beatmap { get; set; }
|
private EditorBeatmap beatmap { get; set; }
|
||||||
|
|
||||||
public DrawableEditRulesetWrapper(DrawableRuleset<TObject> drawableRuleset)
|
public DrawableEditRulesetWrapper(DrawableRuleset<TObject> drawableRuleset)
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,6 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
@ -35,20 +34,20 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
{
|
{
|
||||||
protected IRulesetConfigManager Config { get; private set; }
|
protected IRulesetConfigManager Config { get; private set; }
|
||||||
|
|
||||||
protected new EditorBeatmap EditorBeatmap { get; private set; }
|
|
||||||
|
|
||||||
protected readonly Ruleset Ruleset;
|
protected readonly Ruleset Ruleset;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
protected IFrameBasedClock EditorClock { get; private set; }
|
protected IFrameBasedClock EditorClock { get; private set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
protected EditorBeatmap EditorBeatmap { get; private set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IAdjustableClock adjustableClock { get; set; }
|
private IAdjustableClock adjustableClock { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BindableBeatDivisor beatDivisor { get; set; }
|
private BindableBeatDivisor beatDivisor { get; set; }
|
||||||
|
|
||||||
private Beatmap<TObject> playableBeatmap;
|
|
||||||
private IBeatmapProcessor beatmapProcessor;
|
private IBeatmapProcessor beatmapProcessor;
|
||||||
|
|
||||||
private DrawableEditRulesetWrapper<TObject> drawableRulesetWrapper;
|
private DrawableEditRulesetWrapper<TObject> drawableRulesetWrapper;
|
||||||
@ -68,9 +67,17 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(IFrameBasedClock framedClock)
|
private void load(IFrameBasedClock framedClock)
|
||||||
{
|
{
|
||||||
|
beatmapProcessor = Ruleset.CreateBeatmapProcessor(EditorBeatmap.PlayableBeatmap);
|
||||||
|
|
||||||
|
EditorBeatmap.HitObjectAdded += addHitObject;
|
||||||
|
EditorBeatmap.HitObjectRemoved += removeHitObject;
|
||||||
|
EditorBeatmap.StartTimeChanged += UpdateHitObject;
|
||||||
|
|
||||||
|
Config = Dependencies.Get<RulesetConfigCache>().GetConfigFor(Ruleset);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
drawableRulesetWrapper = new DrawableEditRulesetWrapper<TObject>(CreateDrawableRuleset(Ruleset, playableBeatmap))
|
drawableRulesetWrapper = new DrawableEditRulesetWrapper<TObject>(CreateDrawableRuleset(Ruleset, EditorBeatmap.PlayableBeatmap))
|
||||||
{
|
{
|
||||||
Clock = framedClock,
|
Clock = framedClock,
|
||||||
ProcessCustomClock = false
|
ProcessCustomClock = false
|
||||||
@ -140,27 +147,6 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
blueprintContainer.SelectionChanged += selectionChanged;
|
blueprintContainer.SelectionChanged += selectionChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
|
||||||
{
|
|
||||||
var parentWorkingBeatmap = parent.Get<IBindable<WorkingBeatmap>>().Value;
|
|
||||||
|
|
||||||
playableBeatmap = (Beatmap<TObject>)parentWorkingBeatmap.GetPlayableBeatmap(Ruleset.RulesetInfo);
|
|
||||||
|
|
||||||
beatmapProcessor = Ruleset.CreateBeatmapProcessor(playableBeatmap);
|
|
||||||
|
|
||||||
base.EditorBeatmap = EditorBeatmap = new EditorBeatmap(playableBeatmap);
|
|
||||||
EditorBeatmap.HitObjectAdded += addHitObject;
|
|
||||||
EditorBeatmap.HitObjectRemoved += removeHitObject;
|
|
||||||
EditorBeatmap.StartTimeChanged += UpdateHitObject;
|
|
||||||
|
|
||||||
var dependencies = new DependencyContainer(parent);
|
|
||||||
dependencies.CacheAs<IEditorBeatmap>(EditorBeatmap);
|
|
||||||
|
|
||||||
Config = dependencies.Get<RulesetConfigCache>().GetConfigFor(Ruleset);
|
|
||||||
|
|
||||||
return base.CreateChildDependencies(dependencies);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
@ -233,7 +219,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
scheduledUpdate = Schedule(() =>
|
scheduledUpdate = Schedule(() =>
|
||||||
{
|
{
|
||||||
beatmapProcessor?.PreProcess();
|
beatmapProcessor?.PreProcess();
|
||||||
hitObject?.ApplyDefaults(playableBeatmap.ControlPointInfo, playableBeatmap.BeatmapInfo.BaseDifficulty);
|
hitObject?.ApplyDefaults(EditorBeatmap.ControlPointInfo, EditorBeatmap.BeatmapInfo.BaseDifficulty);
|
||||||
beatmapProcessor?.PostProcess();
|
beatmapProcessor?.PostProcess();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -332,11 +318,6 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract IEnumerable<DrawableHitObject> HitObjects { get; }
|
public abstract IEnumerable<DrawableHitObject> HitObjects { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// An editor-specific beatmap, exposing mutation events.
|
|
||||||
/// </summary>
|
|
||||||
public IEditorBeatmap EditorBeatmap { get; protected set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the user's cursor is currently in an area of the <see cref="HitObjectComposer"/> that is valid for placement.
|
/// Whether the user's cursor is currently in an area of the <see cref="HitObjectComposer"/> that is valid for placement.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -40,7 +40,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
private HitObjectComposer composer { get; set; }
|
private HitObjectComposer composer { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IEditorBeatmap beatmap { get; set; }
|
private EditorBeatmap beatmap { get; set; }
|
||||||
|
|
||||||
public BlueprintContainer()
|
public BlueprintContainer()
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
protected IDistanceSnapProvider SnapProvider { get; private set; }
|
protected IDistanceSnapProvider SnapProvider { get; private set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IEditorBeatmap beatmap { get; set; }
|
private EditorBeatmap beatmap { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BindableBeatDivisor beatDivisor { get; set; }
|
private BindableBeatDivisor beatDivisor { get; set; }
|
||||||
|
@ -16,9 +16,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
{
|
{
|
||||||
internal class TimelineHitObjectDisplay : TimelinePart
|
internal class TimelineHitObjectDisplay : TimelinePart
|
||||||
{
|
{
|
||||||
private IEditorBeatmap beatmap { get; }
|
private EditorBeatmap beatmap { get; }
|
||||||
|
|
||||||
public TimelineHitObjectDisplay(IEditorBeatmap beatmap)
|
public TimelineHitObjectDisplay(EditorBeatmap beatmap)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
@ -32,6 +32,6 @@ namespace osu.Game.Screens.Edit.Compose
|
|||||||
return beatmapSkinProvider.WithChild(rulesetSkinProvider.WithChild(composer));
|
return beatmapSkinProvider.WithChild(rulesetSkinProvider.WithChild(composer));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Drawable CreateTimelineContent() => composer == null ? base.CreateTimelineContent() : new TimelineHitObjectDisplay(composer.EditorBeatmap);
|
protected override Drawable CreateTimelineContent() => composer == null ? base.CreateTimelineContent() : new TimelineHitObjectDisplay(EditorBeatmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ using osuTK.Input;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.Screens.Edit.Compose;
|
using osu.Game.Screens.Edit.Compose;
|
||||||
@ -49,9 +50,11 @@ namespace osu.Game.Screens.Edit
|
|||||||
private EditorScreen currentScreen;
|
private EditorScreen currentScreen;
|
||||||
|
|
||||||
private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor();
|
private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor();
|
||||||
|
|
||||||
private EditorClock clock;
|
private EditorClock clock;
|
||||||
|
|
||||||
|
private IBeatmap playableBeatmap;
|
||||||
|
private EditorBeatmap editorBeatmap;
|
||||||
|
|
||||||
private DependencyContainer dependencies;
|
private DependencyContainer dependencies;
|
||||||
private GameHost host;
|
private GameHost host;
|
||||||
|
|
||||||
@ -73,9 +76,13 @@ namespace osu.Game.Screens.Edit
|
|||||||
clock = new EditorClock(Beatmap.Value, beatDivisor) { IsCoupled = false };
|
clock = new EditorClock(Beatmap.Value, beatDivisor) { IsCoupled = false };
|
||||||
clock.ChangeSource(sourceClock);
|
clock.ChangeSource(sourceClock);
|
||||||
|
|
||||||
|
playableBeatmap = Beatmap.Value.GetPlayableBeatmap(Beatmap.Value.BeatmapInfo.Ruleset);
|
||||||
|
editorBeatmap = new EditorBeatmap(playableBeatmap);
|
||||||
|
|
||||||
dependencies.CacheAs<IFrameBasedClock>(clock);
|
dependencies.CacheAs<IFrameBasedClock>(clock);
|
||||||
dependencies.CacheAs<IAdjustableClock>(clock);
|
dependencies.CacheAs<IAdjustableClock>(clock);
|
||||||
dependencies.Cache(beatDivisor);
|
dependencies.Cache(beatDivisor);
|
||||||
|
dependencies.CacheAs(editorBeatmap);
|
||||||
|
|
||||||
EditorMenuBar menuBar;
|
EditorMenuBar menuBar;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ using osu.Game.Rulesets.Objects;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Edit
|
namespace osu.Game.Screens.Edit
|
||||||
{
|
{
|
||||||
public class EditorBeatmap : IEditorBeatmap
|
public class EditorBeatmap : IBeatmap
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when a <see cref="HitObject"/> is added to this <see cref="EditorBeatmap"/>.
|
/// Invoked when a <see cref="HitObject"/> is added to this <see cref="EditorBeatmap"/>.
|
||||||
@ -29,12 +29,13 @@ namespace osu.Game.Screens.Edit
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<HitObject> StartTimeChanged;
|
public event Action<HitObject> StartTimeChanged;
|
||||||
|
|
||||||
private readonly Dictionary<HitObject, Bindable<double>> startTimeBindables = new Dictionary<HitObject, Bindable<double>>();
|
public readonly IBeatmap PlayableBeatmap;
|
||||||
private readonly IBeatmap beatmap;
|
|
||||||
|
|
||||||
public EditorBeatmap(IBeatmap beatmap)
|
private readonly Dictionary<HitObject, Bindable<double>> startTimeBindables = new Dictionary<HitObject, Bindable<double>>();
|
||||||
|
|
||||||
|
public EditorBeatmap(IBeatmap playableBeatmap)
|
||||||
{
|
{
|
||||||
this.beatmap = beatmap;
|
PlayableBeatmap = playableBeatmap;
|
||||||
|
|
||||||
foreach (var obj in HitObjects)
|
foreach (var obj in HitObjects)
|
||||||
trackStartTime(obj);
|
trackStartTime(obj);
|
||||||
@ -42,27 +43,25 @@ namespace osu.Game.Screens.Edit
|
|||||||
|
|
||||||
public BeatmapInfo BeatmapInfo
|
public BeatmapInfo BeatmapInfo
|
||||||
{
|
{
|
||||||
get => beatmap.BeatmapInfo;
|
get => PlayableBeatmap.BeatmapInfo;
|
||||||
set => beatmap.BeatmapInfo = value;
|
set => PlayableBeatmap.BeatmapInfo = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BeatmapMetadata Metadata => beatmap.Metadata;
|
public BeatmapMetadata Metadata => PlayableBeatmap.Metadata;
|
||||||
|
|
||||||
public ControlPointInfo ControlPointInfo => beatmap.ControlPointInfo;
|
public ControlPointInfo ControlPointInfo => PlayableBeatmap.ControlPointInfo;
|
||||||
|
|
||||||
public List<BreakPeriod> Breaks => beatmap.Breaks;
|
public List<BreakPeriod> Breaks => PlayableBeatmap.Breaks;
|
||||||
|
|
||||||
public double TotalBreakTime => beatmap.TotalBreakTime;
|
public double TotalBreakTime => PlayableBeatmap.TotalBreakTime;
|
||||||
|
|
||||||
public IReadOnlyList<HitObject> HitObjects => beatmap.HitObjects;
|
public IReadOnlyList<HitObject> HitObjects => PlayableBeatmap.HitObjects;
|
||||||
|
|
||||||
IReadOnlyList<HitObject> IBeatmap.HitObjects => beatmap.HitObjects;
|
public IEnumerable<BeatmapStatistic> GetStatistics() => PlayableBeatmap.GetStatistics();
|
||||||
|
|
||||||
public IEnumerable<BeatmapStatistic> GetStatistics() => beatmap.GetStatistics();
|
|
||||||
|
|
||||||
public IBeatmap Clone() => (EditorBeatmap)MemberwiseClone();
|
public IBeatmap Clone() => (EditorBeatmap)MemberwiseClone();
|
||||||
|
|
||||||
private IList mutableHitObjects => (IList)beatmap.HitObjects;
|
private IList mutableHitObjects => (IList)PlayableBeatmap.HitObjects;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a <see cref="HitObject"/> to this <see cref="EditorBeatmap"/>.
|
/// Adds a <see cref="HitObject"/> to this <see cref="EditorBeatmap"/>.
|
||||||
@ -73,7 +72,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
trackStartTime(hitObject);
|
trackStartTime(hitObject);
|
||||||
|
|
||||||
// Preserve existing sorting order in the beatmap
|
// Preserve existing sorting order in the beatmap
|
||||||
var insertionIndex = findInsertionIndex(beatmap.HitObjects, hitObject.StartTime);
|
var insertionIndex = findInsertionIndex(PlayableBeatmap.HitObjects, hitObject.StartTime);
|
||||||
mutableHitObjects.Insert(insertionIndex + 1, hitObject);
|
mutableHitObjects.Insert(insertionIndex + 1, hitObject);
|
||||||
|
|
||||||
HitObjectAdded?.Invoke(hitObject);
|
HitObjectAdded?.Invoke(hitObject);
|
||||||
@ -105,7 +104,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
// For now we'll remove and re-add the hitobject. This is not optimal and can be improved if required.
|
// For now we'll remove and re-add the hitobject. This is not optimal and can be improved if required.
|
||||||
mutableHitObjects.Remove(hitObject);
|
mutableHitObjects.Remove(hitObject);
|
||||||
|
|
||||||
var insertionIndex = findInsertionIndex(beatmap.HitObjects, hitObject.StartTime);
|
var insertionIndex = findInsertionIndex(PlayableBeatmap.HitObjects, hitObject.StartTime);
|
||||||
mutableHitObjects.Insert(insertionIndex + 1, hitObject);
|
mutableHitObjects.Insert(insertionIndex + 1, hitObject);
|
||||||
|
|
||||||
StartTimeChanged?.Invoke(hitObject);
|
StartTimeChanged?.Invoke(hitObject);
|
||||||
|
@ -17,6 +17,9 @@ namespace osu.Game.Screens.Edit
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
protected IBindable<WorkingBeatmap> Beatmap { get; private set; }
|
protected IBindable<WorkingBeatmap> Beatmap { get; private set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
protected EditorBeatmap EditorBeatmap { get; private set; }
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
private readonly Container content;
|
private readonly Container content;
|
||||||
|
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
// 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 System;
|
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Rulesets.Edit;
|
|
||||||
using osu.Game.Rulesets.Objects;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Interface for the <see cref="IBeatmap"/> contained by the see <see cref="HitObjectComposer"/>.
|
|
||||||
/// Children of <see cref="HitObjectComposer"/> may resolve the beatmap via <see cref="IEditorBeatmap"/>.
|
|
||||||
/// </summary>
|
|
||||||
public interface IEditorBeatmap : IBeatmap
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Invoked when a <see cref="HitObject"/> is added to this <see cref="IEditorBeatmap"/>.
|
|
||||||
/// </summary>
|
|
||||||
event Action<HitObject> HitObjectAdded;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Invoked when a <see cref="HitObject"/> is removed from this <see cref="IEditorBeatmap"/>.
|
|
||||||
/// </summary>
|
|
||||||
event Action<HitObject> HitObjectRemoved;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Invoked when the start time of a <see cref="HitObject"/> in this <see cref="EditorBeatmap"/> was changed.
|
|
||||||
/// </summary>
|
|
||||||
event Action<HitObject> StartTimeChanged;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user