mirror of
https://github.com/ppy/osu.git
synced 2025-03-01 00:53:29 +08:00
Add very basic lead-in support.
This commit is contained in:
parent
9d14b6e1e9
commit
4656a7170a
@ -70,6 +70,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private SkipButton skipButton;
|
private SkipButton skipButton;
|
||||||
|
|
||||||
|
private Container hitRendererContainer;
|
||||||
|
|
||||||
private HudOverlay hudOverlay;
|
private HudOverlay hudOverlay;
|
||||||
private PauseOverlay pauseOverlay;
|
private PauseOverlay pauseOverlay;
|
||||||
private FailOverlay failOverlay;
|
private FailOverlay failOverlay;
|
||||||
@ -129,9 +131,12 @@ namespace osu.Game.Screens.Play
|
|||||||
adjustableSourceClock = (IAdjustableClock)track ?? new StopwatchClock();
|
adjustableSourceClock = (IAdjustableClock)track ?? new StopwatchClock();
|
||||||
|
|
||||||
decoupledClock = new DecoupleableInterpolatingFramedClock();
|
decoupledClock = new DecoupleableInterpolatingFramedClock();
|
||||||
decoupledClock.ChangeSource(adjustableSourceClock);
|
|
||||||
decoupledClock.IsCoupled = false;
|
decoupledClock.IsCoupled = false;
|
||||||
|
|
||||||
|
var firstObjectTime = HitRenderer.Objects.First().StartTime;
|
||||||
|
decoupledClock.Seek(Math.Min(0, firstObjectTime - Math.Max(Beatmap.Beatmap.TimingInfo.BeatLengthAt(firstObjectTime) * 4, Beatmap.BeatmapInfo.AudioLeadIn)));
|
||||||
|
decoupledClock.ProcessFrame();
|
||||||
|
|
||||||
offsetClock = new FramedOffsetClock(decoupledClock);
|
offsetClock = new FramedOffsetClock(decoupledClock);
|
||||||
|
|
||||||
userAudioOffset = config.GetBindable<double>(OsuConfig.AudioOffset);
|
userAudioOffset = config.GetBindable<double>(OsuConfig.AudioOffset);
|
||||||
@ -142,12 +147,10 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
adjustableSourceClock.Reset();
|
adjustableSourceClock.Reset();
|
||||||
|
|
||||||
var firstObjectTime = HitRenderer.Objects.First().StartTime;
|
|
||||||
|
|
||||||
decoupledClock.Seek(Math.Min(0, firstObjectTime - Math.Max(Beatmap.Beatmap.TimingInfo.BeatLengthAt(firstObjectTime) * 2, Beatmap.BeatmapInfo.AudioLeadIn)));
|
|
||||||
|
|
||||||
foreach (var mod in Beatmap.Mods.Value.OfType<IApplicableToClock>())
|
foreach (var mod in Beatmap.Mods.Value.OfType<IApplicableToClock>())
|
||||||
mod.ApplyToClock(adjustableSourceClock);
|
mod.ApplyToClock(adjustableSourceClock);
|
||||||
|
|
||||||
|
decoupledClock.ChangeSource(adjustableSourceClock);
|
||||||
});
|
});
|
||||||
|
|
||||||
scoreProcessor = HitRenderer.CreateScoreProcessor();
|
scoreProcessor = HitRenderer.CreateScoreProcessor();
|
||||||
@ -176,6 +179,11 @@ namespace osu.Game.Screens.Play
|
|||||||
//bind ScoreProcessor to ourselves (for a fail situation)
|
//bind ScoreProcessor to ourselves (for a fail situation)
|
||||||
scoreProcessor.Failed += onFail;
|
scoreProcessor.Failed += onFail;
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
hitRendererContainer = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
@ -185,9 +193,8 @@ namespace osu.Game.Screens.Play
|
|||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
HitRenderer,
|
HitRenderer,
|
||||||
skipButton = new SkipButton
|
skipButton = new SkipButton { Alpha = 0 },
|
||||||
{
|
}
|
||||||
Alpha = 0
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -350,8 +357,8 @@ namespace osu.Game.Screens.Play
|
|||||||
});
|
});
|
||||||
|
|
||||||
//keep in mind this is using the interpolatedSourceClock so won't be run as early as we may expect.
|
//keep in mind this is using the interpolatedSourceClock so won't be run as early as we may expect.
|
||||||
HitRenderer.Alpha = 0;
|
hitRendererContainer.Alpha = 0;
|
||||||
HitRenderer.FadeIn(750, EasingTypes.OutQuint);
|
hitRendererContainer.FadeIn(750, EasingTypes.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSuspending(Screen next)
|
protected override void OnSuspending(Screen next)
|
||||||
|
Loading…
Reference in New Issue
Block a user