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

Rename clock types to match across classes

This commit is contained in:
Dean Herbert 2018-02-27 16:10:12 +09:00
parent 3d52ead213
commit 37d2a2c3cc
3 changed files with 21 additions and 18 deletions

View File

@ -44,13 +44,13 @@ namespace osu.Game.Screens.Play
public Action OnResume;
public Action OnPause;
public readonly IAdjustableClock SeekableClock;
public readonly IAdjustableClock AdjustableClock;
public readonly FramedClock FramedClock;
public PauseContainer(FramedClock framedClock, IAdjustableClock seekableClock)
public PauseContainer(FramedClock framedClock, IAdjustableClock adjustableClock)
{
FramedClock = framedClock;
SeekableClock = seekableClock;
AdjustableClock = adjustableClock;
RelativeSizeAxes = Axes.Both;
@ -79,7 +79,7 @@ namespace osu.Game.Screens.Play
if (IsPaused) return;
// stop the seekable clock (stops the audio eventually)
SeekableClock.Stop();
AdjustableClock.Stop();
IsPaused = true;
OnPause?.Invoke();
@ -98,8 +98,8 @@ namespace osu.Game.Screens.Play
// seek back to the time of the framed clock.
// this accounts for the audio clock potentially taking time to enter a completely stopped state.
SeekableClock.Seek(FramedClock.CurrentTime);
SeekableClock.Start();
AdjustableClock.Seek(FramedClock.CurrentTime);
AdjustableClock.Start();
OnResume?.Invoke();
pauseOverlay.Hide();

View File

@ -61,7 +61,10 @@ namespace osu.Game.Screens.Play
/// </summary>
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;
@ -144,16 +147,16 @@ namespace osu.Game.Screens.Play
}
sourceClock = (IAdjustableClock)working.Track ?? new StopwatchClock();
decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
adjustableClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
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))
: firstObjectTime);
decoupledClock.ProcessFrame();
adjustableClock.ProcessFrame();
offsetClock = new FramedOffsetClock(decoupledClock);
offsetClock = new FramedOffsetClock(adjustableClock);
userAudioOffset = config.GetBindable<double>(OsuSetting.AudioOffset);
userAudioOffset.ValueChanged += v => offsetClock.Offset = v;
@ -163,7 +166,7 @@ namespace osu.Game.Screens.Play
Children = new Drawable[]
{
pauseContainer = new PauseContainer(offsetClock, decoupledClock)
pauseContainer = new PauseContainer(offsetClock, adjustableClock)
{
OnRetry = Restart,
OnQuit = Exit,
@ -192,7 +195,7 @@ namespace osu.Game.Screens.Play
},
new SkipButton(firstObjectTime)
{
SeekableClock = decoupledClock,
AdjustableClock = adjustableClock,
FramedClock = offsetClock,
},
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))
return false;
decoupledClock.Stop();
adjustableClock.Stop();
HasFailed = true;
failOverlay.Retries = RestartCount;
@ -337,14 +340,14 @@ namespace osu.Game.Screens.Play
Schedule(() =>
{
decoupledClock.ChangeSource(sourceClock);
adjustableClock.ChangeSource(sourceClock);
applyRateFromMods();
this.Delay(750).Schedule(() =>
{
if (!pauseContainer.IsPaused)
{
decoupledClock.Start();
adjustableClock.Start();
}
});
});

View File

@ -25,7 +25,7 @@ namespace osu.Game.Screens.Play
{
private readonly double startTime;
public IAdjustableClock SeekableClock;
public IAdjustableClock AdjustableClock;
public IFrameBasedClock FramedClock;
private Button button;
@ -111,7 +111,7 @@ namespace osu.Game.Screens.Play
using (BeginAbsoluteSequence(beginFadeTime))
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;