mirror of
https://github.com/ppy/osu.git
synced 2025-01-29 13:42:54 +08:00
Resolve GameplayClockContainer
instead of Player
This commit is contained in:
parent
36a20ab0b3
commit
9a1db04920
@ -13,6 +13,7 @@ namespace osu.Game.Screens.Play
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Encapsulates gameplay timing logic and provides a <see cref="GameplayClock"/> via DI for gameplay components to use.
|
/// Encapsulates gameplay timing logic and provides a <see cref="GameplayClock"/> via DI for gameplay components to use.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Cached]
|
||||||
public abstract class GameplayClockContainer : Container, IAdjustableClock
|
public abstract class GameplayClockContainer : Container, IAdjustableClock
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -35,6 +36,11 @@ namespace osu.Game.Screens.Play
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected IClock SourceClock { get; private set; }
|
protected IClock SourceClock { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoked when a seek has been performed via <see cref="Seek"/>
|
||||||
|
/// </summary>
|
||||||
|
public event Action OnSeek;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new <see cref="GameplayClockContainer"/>.
|
/// Creates a new <see cref="GameplayClockContainer"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -88,6 +94,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
// Manually process to make sure the gameplay clock is correctly updated after a seek.
|
// Manually process to make sure the gameplay clock is correctly updated after a seek.
|
||||||
GameplayClock.UnderlyingClock.ProcessFrame();
|
GameplayClock.UnderlyingClock.ProcessFrame();
|
||||||
|
|
||||||
|
OnSeek?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -23,7 +23,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
|||||||
private OsuColour colours { get; set; }
|
private OsuColour colours { get; set; }
|
||||||
|
|
||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
private Player player { get; set; }
|
private GameplayClockContainer gameplayClockContainer { get; set; }
|
||||||
|
|
||||||
public bool UsesFixedAnchor { get; set; }
|
public bool UsesFixedAnchor { get; set; }
|
||||||
|
|
||||||
@ -37,8 +37,8 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
if (player != null)
|
if (gameplayClockContainer != null)
|
||||||
player.OnSeek += Clear;
|
gameplayClockContainer.OnSeek += Clear;
|
||||||
|
|
||||||
processor.NewJudgement += OnNewJudgement;
|
processor.NewJudgement += OnNewJudgement;
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked by <see cref="Player.OnSeek"/> when the active <see cref="Player"/> seeks through the current beatmap.
|
/// Invoked by <see cref="GameplayClockContainer.OnSeek"/>.
|
||||||
/// Any inheritors of <see cref="HitErrorMeter"/> should have this method clear their container that displays the hit error results.
|
/// Any inheritors of <see cref="HitErrorMeter"/> should have this method clear their container that displays the hit error results.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract void Clear();
|
public abstract void Clear();
|
||||||
@ -86,8 +86,8 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
|||||||
if (processor != null)
|
if (processor != null)
|
||||||
processor.NewJudgement -= OnNewJudgement;
|
processor.NewJudgement -= OnNewJudgement;
|
||||||
|
|
||||||
if (player != null)
|
if (gameplayClockContainer != null)
|
||||||
player.OnSeek -= Clear;
|
gameplayClockContainer.OnSeek -= Clear;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,11 +69,6 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public Action RestartRequested;
|
public Action RestartRequested;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Invoked when a seek has been performed via <see cref="Seek"/>
|
|
||||||
/// </summary>
|
|
||||||
public event Action OnSeek;
|
|
||||||
|
|
||||||
public bool HasFailed { get; private set; }
|
public bool HasFailed { get; private set; }
|
||||||
|
|
||||||
private Bindable<bool> mouseWheelDisabled;
|
private Bindable<bool> mouseWheelDisabled;
|
||||||
@ -592,7 +587,6 @@ namespace osu.Game.Screens.Play
|
|||||||
public void Seek(double time)
|
public void Seek(double time)
|
||||||
{
|
{
|
||||||
GameplayClockContainer.Seek(time);
|
GameplayClockContainer.Seek(time);
|
||||||
OnSeek?.Invoke();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ScheduledDelegate frameStablePlaybackResetDelegate;
|
private ScheduledDelegate frameStablePlaybackResetDelegate;
|
||||||
|
Loading…
Reference in New Issue
Block a user