mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 09:07:25 +08:00
Rename clock types to match across classes
This commit is contained in:
parent
3d52ead213
commit
37d2a2c3cc
@ -44,13 +44,13 @@ namespace osu.Game.Screens.Play
|
|||||||
public Action OnResume;
|
public Action OnResume;
|
||||||
public Action OnPause;
|
public Action OnPause;
|
||||||
|
|
||||||
public readonly IAdjustableClock SeekableClock;
|
public readonly IAdjustableClock AdjustableClock;
|
||||||
public readonly FramedClock FramedClock;
|
public readonly FramedClock FramedClock;
|
||||||
|
|
||||||
public PauseContainer(FramedClock framedClock, IAdjustableClock seekableClock)
|
public PauseContainer(FramedClock framedClock, IAdjustableClock adjustableClock)
|
||||||
{
|
{
|
||||||
FramedClock = framedClock;
|
FramedClock = framedClock;
|
||||||
SeekableClock = seekableClock;
|
AdjustableClock = adjustableClock;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ namespace osu.Game.Screens.Play
|
|||||||
if (IsPaused) return;
|
if (IsPaused) return;
|
||||||
|
|
||||||
// stop the seekable clock (stops the audio eventually)
|
// stop the seekable clock (stops the audio eventually)
|
||||||
SeekableClock.Stop();
|
AdjustableClock.Stop();
|
||||||
IsPaused = true;
|
IsPaused = true;
|
||||||
|
|
||||||
OnPause?.Invoke();
|
OnPause?.Invoke();
|
||||||
@ -98,8 +98,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
// seek back to the time of the framed clock.
|
// seek back to the time of the framed clock.
|
||||||
// this accounts for the audio clock potentially taking time to enter a completely stopped state.
|
// this accounts for the audio clock potentially taking time to enter a completely stopped state.
|
||||||
SeekableClock.Seek(FramedClock.CurrentTime);
|
AdjustableClock.Seek(FramedClock.CurrentTime);
|
||||||
SeekableClock.Start();
|
AdjustableClock.Start();
|
||||||
|
|
||||||
OnResume?.Invoke();
|
OnResume?.Invoke();
|
||||||
pauseOverlay.Hide();
|
pauseOverlay.Hide();
|
||||||
|
@ -61,7 +61,10 @@ namespace osu.Game.Screens.Play
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private FramedOffsetClock offsetClock;
|
private FramedOffsetClock offsetClock;
|
||||||
|
|
||||||
private DecoupleableInterpolatingFramedClock decoupledClock;
|
/// <summary>
|
||||||
|
/// The decoupled clock used for gameplay. Should be used for seeks and clock control.
|
||||||
|
/// </summary>
|
||||||
|
private DecoupleableInterpolatingFramedClock adjustableClock;
|
||||||
|
|
||||||
private PauseContainer pauseContainer;
|
private PauseContainer pauseContainer;
|
||||||
|
|
||||||
@ -144,16 +147,16 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
|
|
||||||
sourceClock = (IAdjustableClock)working.Track ?? new StopwatchClock();
|
sourceClock = (IAdjustableClock)working.Track ?? new StopwatchClock();
|
||||||
decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
|
adjustableClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
|
||||||
|
|
||||||
var firstObjectTime = RulesetContainer.Objects.First().StartTime;
|
var firstObjectTime = RulesetContainer.Objects.First().StartTime;
|
||||||
decoupledClock.Seek(AllowLeadIn
|
adjustableClock.Seek(AllowLeadIn
|
||||||
? Math.Min(0, firstObjectTime - Math.Max(beatmap.ControlPointInfo.TimingPointAt(firstObjectTime).BeatLength * 4, beatmap.BeatmapInfo.AudioLeadIn))
|
? Math.Min(0, firstObjectTime - Math.Max(beatmap.ControlPointInfo.TimingPointAt(firstObjectTime).BeatLength * 4, beatmap.BeatmapInfo.AudioLeadIn))
|
||||||
: firstObjectTime);
|
: firstObjectTime);
|
||||||
|
|
||||||
decoupledClock.ProcessFrame();
|
adjustableClock.ProcessFrame();
|
||||||
|
|
||||||
offsetClock = new FramedOffsetClock(decoupledClock);
|
offsetClock = new FramedOffsetClock(adjustableClock);
|
||||||
|
|
||||||
userAudioOffset = config.GetBindable<double>(OsuSetting.AudioOffset);
|
userAudioOffset = config.GetBindable<double>(OsuSetting.AudioOffset);
|
||||||
userAudioOffset.ValueChanged += v => offsetClock.Offset = v;
|
userAudioOffset.ValueChanged += v => offsetClock.Offset = v;
|
||||||
@ -163,7 +166,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
pauseContainer = new PauseContainer(offsetClock, decoupledClock)
|
pauseContainer = new PauseContainer(offsetClock, adjustableClock)
|
||||||
{
|
{
|
||||||
OnRetry = Restart,
|
OnRetry = Restart,
|
||||||
OnQuit = Exit,
|
OnQuit = Exit,
|
||||||
@ -192,7 +195,7 @@ namespace osu.Game.Screens.Play
|
|||||||
},
|
},
|
||||||
new SkipButton(firstObjectTime)
|
new SkipButton(firstObjectTime)
|
||||||
{
|
{
|
||||||
SeekableClock = decoupledClock,
|
AdjustableClock = adjustableClock,
|
||||||
FramedClock = offsetClock,
|
FramedClock = offsetClock,
|
||||||
},
|
},
|
||||||
hudOverlay = new HUDOverlay(scoreProcessor, RulesetContainer, decoupledClock, working)
|
hudOverlay = new HUDOverlay(scoreProcessor, RulesetContainer, decoupledClock, working)
|
||||||
@ -304,7 +307,7 @@ namespace osu.Game.Screens.Play
|
|||||||
if (Beatmap.Value.Mods.Value.OfType<IApplicableFailOverride>().Any(m => !m.AllowFail))
|
if (Beatmap.Value.Mods.Value.OfType<IApplicableFailOverride>().Any(m => !m.AllowFail))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
decoupledClock.Stop();
|
adjustableClock.Stop();
|
||||||
|
|
||||||
HasFailed = true;
|
HasFailed = true;
|
||||||
failOverlay.Retries = RestartCount;
|
failOverlay.Retries = RestartCount;
|
||||||
@ -337,14 +340,14 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
{
|
{
|
||||||
decoupledClock.ChangeSource(sourceClock);
|
adjustableClock.ChangeSource(sourceClock);
|
||||||
applyRateFromMods();
|
applyRateFromMods();
|
||||||
|
|
||||||
this.Delay(750).Schedule(() =>
|
this.Delay(750).Schedule(() =>
|
||||||
{
|
{
|
||||||
if (!pauseContainer.IsPaused)
|
if (!pauseContainer.IsPaused)
|
||||||
{
|
{
|
||||||
decoupledClock.Start();
|
adjustableClock.Start();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -25,7 +25,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
private readonly double startTime;
|
private readonly double startTime;
|
||||||
|
|
||||||
public IAdjustableClock SeekableClock;
|
public IAdjustableClock AdjustableClock;
|
||||||
public IFrameBasedClock FramedClock;
|
public IFrameBasedClock FramedClock;
|
||||||
|
|
||||||
private Button button;
|
private Button button;
|
||||||
@ -111,7 +111,7 @@ namespace osu.Game.Screens.Play
|
|||||||
using (BeginAbsoluteSequence(beginFadeTime))
|
using (BeginAbsoluteSequence(beginFadeTime))
|
||||||
this.FadeOut(fade_time);
|
this.FadeOut(fade_time);
|
||||||
|
|
||||||
button.Action = () => SeekableClock?.Seek(startTime - skip_required_cutoff - fade_time);
|
button.Action = () => AdjustableClock?.Seek(startTime - skip_required_cutoff - fade_time);
|
||||||
|
|
||||||
displayTime = Time.Current;
|
displayTime = Time.Current;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user