1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-18 22:52:57 +08:00

Merge branch 'master' into catch-droplet-fix

This commit is contained in:
ekrctb 2018-05-25 19:34:59 +09:00 committed by GitHub
commit 4392c57889
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 7 deletions

@ -1 +1 @@
Subproject commit eb076a3301231eb73917073499051e49a9b12978
Subproject commit a191c104b8e254e81a1a7bb1c200ccdf02628796

View File

@ -44,13 +44,13 @@ namespace osu.Game.Tests.Visual
{
exitAction = false;
InputManager.MoveMouseTo(quitButton);
InputManager.ButtonDown(MouseButton.Left);
InputManager.PressButton(MouseButton.Left);
});
AddStep("Early release", () => InputManager.ButtonUp(MouseButton.Left));
AddStep("Early release", () => InputManager.ReleaseButton(MouseButton.Left));
AddAssert("action not triggered", () => !exitAction);
AddStep("Trigger exit action", () => InputManager.ButtonDown(MouseButton.Left));
AddStep("Trigger exit action", () => InputManager.PressButton(MouseButton.Left));
AddUntilStep(() => exitAction, $"{nameof(quitButton.Action)} was triggered");
}
}

View File

@ -48,7 +48,7 @@ namespace osu.Game.Screens.Edit
{
// TODO: should probably be done at a RulesetContainer level to share logic with Player.
var sourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock();
clock = new EditorClock(Beatmap.Value.Beatmap.ControlPointInfo, beatDivisor) { IsCoupled = false };
clock = new EditorClock(Beatmap, beatDivisor) { IsCoupled = false };
clock.ChangeSource(sourceClock);
dependencies.CacheAs<IFrameBasedClock>(clock);

View File

@ -3,10 +3,13 @@
using System;
using System.Linq;
using osu.Framework.Configuration;
using osu.Framework.MathUtils;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Screens.Edit.Screens.Compose;
using OpenTK;
namespace osu.Game.Screens.Edit
{
@ -15,15 +18,26 @@ namespace osu.Game.Screens.Edit
/// </summary>
public class EditorClock : DecoupleableInterpolatingFramedClock
{
public readonly double TrackLength;
public ControlPointInfo ControlPointInfo;
private readonly BindableBeatDivisor beatDivisor;
public EditorClock(ControlPointInfo controlPointInfo, BindableBeatDivisor beatDivisor)
public EditorClock(Bindable<WorkingBeatmap> beatmap, BindableBeatDivisor beatDivisor)
{
this.beatDivisor = beatDivisor;
ControlPointInfo = beatmap.Value.Beatmap.ControlPointInfo;
TrackLength = beatmap.Value.Track.Length;
}
public EditorClock(ControlPointInfo controlPointInfo, double trackLength, BindableBeatDivisor beatDivisor)
{
this.beatDivisor = beatDivisor;
ControlPointInfo = controlPointInfo;
TrackLength = trackLength;
}
/// <summary>
@ -111,6 +125,8 @@ namespace osu.Game.Screens.Edit
if (seekTime > nextTimingPoint?.Time)
seekTime = nextTimingPoint.Time;
// Ensure the sought point is within the boundaries
seekTime = MathHelper.Clamp(seekTime, 0, TrackLength);
Seek(seekTime);
}
}

View File

@ -29,7 +29,7 @@ namespace osu.Game.Tests.Visual
protected EditorClockTestCase()
{
Clock = new EditorClock(new ControlPointInfo(), BeatDivisor) { IsCoupled = false };
Clock = new EditorClock(new ControlPointInfo(), 5000, BeatDivisor) { IsCoupled = false };
}
[BackgroundDependencyLoader]