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:
commit
4392c57889
@ -1 +1 @@
|
||||
Subproject commit eb076a3301231eb73917073499051e49a9b12978
|
||||
Subproject commit a191c104b8e254e81a1a7bb1c200ccdf02628796
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user