1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 09:47:52 +08:00

Keep the placement hitobject time up-to-date

This commit is contained in:
smoogipoo 2018-10-03 16:44:37 +09:00
parent 3420e0c7eb
commit 34ed60830c

View File

@ -6,6 +6,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using osu.Framework.Input.Events;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Objects;
using OpenTK;
@ -24,14 +25,18 @@ namespace osu.Game.Rulesets.Edit
/// </summary>
protected readonly HitObject HitObject;
private IAdjustableClock clock;
public PlacementMask(HitObject hitObject)
{
HitObject = hitObject;
}
[BackgroundDependencyLoader]
private void load(IBindableBeatmap workingBeatmap)
private void load(IBindableBeatmap workingBeatmap, IAdjustableClock clock)
{
this.clock = clock;
HitObject.ApplyDefaults(workingBeatmap.Value.Beatmap.ControlPointInfo, workingBeatmap.Value.Beatmap.BeatmapInfo.BaseDifficulty);
}
@ -40,6 +45,13 @@ namespace osu.Game.Rulesets.Edit
/// </summary>
public void Finish() => PlacementFinished?.Invoke(HitObject);
protected override void Update()
{
base.Update();
HitObject.StartTime = clock.CurrentTime;
}
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent?.ReceivePositionalInputAt(screenSpacePos) ?? false;
protected override bool Handle(UIEvent e)