mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Integrate beat snap divisor into editor seeking
This commit is contained in:
@ -16,6 +16,7 @@ using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Edit.Tools;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.Edit.Screens.Compose;
|
||||
using osu.Game.Screens.Edit.Screens.Compose.Layers;
|
||||
using osu.Game.Screens.Edit.Screens.Compose.RadioButtons;
|
||||
|
||||
@ -31,6 +32,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
private readonly List<Container> layerContainers = new List<Container>();
|
||||
|
||||
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||
private readonly Bindable<int> beatDivisor = new Bindable<int>();
|
||||
|
||||
private IAdjustableClock adjustableClock;
|
||||
|
||||
@ -42,9 +44,10 @@ namespace osu.Game.Rulesets.Edit
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGameBase osuGame, IAdjustableClock adjustableClock, IFrameBasedClock framedClock)
|
||||
private void load(OsuGameBase osuGame, IAdjustableClock adjustableClock, IFrameBasedClock framedClock, BindableBeatDivisor beatDivisor)
|
||||
{
|
||||
this.adjustableClock = adjustableClock;
|
||||
this.beatDivisor.BindTo(beatDivisor);
|
||||
|
||||
beatmap.BindTo(osuGame.Beatmap);
|
||||
|
||||
@ -167,9 +170,6 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
private void seek(int direction, bool snapped)
|
||||
{
|
||||
// Todo: This should not be a constant, but feels good for now
|
||||
const int beat_snap_divisor = 4;
|
||||
|
||||
var cpi = beatmap.Value.Beatmap.ControlPointInfo;
|
||||
|
||||
var timingPoint = cpi.TimingPointAt(adjustableClock.CurrentTime);
|
||||
@ -181,7 +181,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
timingPoint = cpi.TimingPoints[--activeIndex];
|
||||
}
|
||||
|
||||
double seekAmount = timingPoint.BeatLength / beat_snap_divisor;
|
||||
double seekAmount = timingPoint.BeatLength / beatDivisor;
|
||||
double seekTime = adjustableClock.CurrentTime + seekAmount * direction;
|
||||
|
||||
if (!snapped || cpi.TimingPoints.Count == 0)
|
||||
@ -222,9 +222,6 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
public void SeekTo(double seekTime, bool snapped = false)
|
||||
{
|
||||
// Todo: This should not be a constant, but feels good for now
|
||||
const int beat_snap_divisor = 4;
|
||||
|
||||
if (!snapped)
|
||||
{
|
||||
adjustableClock.Seek(seekTime);
|
||||
@ -232,7 +229,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
}
|
||||
|
||||
var timingPoint = beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(seekTime);
|
||||
double beatSnapLength = timingPoint.BeatLength / beat_snap_divisor;
|
||||
double beatSnapLength = timingPoint.BeatLength / beatDivisor;
|
||||
|
||||
// We will be snapping to beats within the timing point
|
||||
seekTime -= timingPoint.Time;
|
||||
|
Reference in New Issue
Block a user