mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 01:02:56 +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>
|
||||
/// Encapsulates gameplay timing logic and provides a <see cref="GameplayClock"/> via DI for gameplay components to use.
|
||||
/// </summary>
|
||||
[Cached]
|
||||
public abstract class GameplayClockContainer : Container, IAdjustableClock
|
||||
{
|
||||
/// <summary>
|
||||
@ -35,6 +36,11 @@ namespace osu.Game.Screens.Play
|
||||
/// </summary>
|
||||
protected IClock SourceClock { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when a seek has been performed via <see cref="Seek"/>
|
||||
/// </summary>
|
||||
public event Action OnSeek;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="GameplayClockContainer"/>.
|
||||
/// </summary>
|
||||
@ -88,6 +94,8 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
// Manually process to make sure the gameplay clock is correctly updated after a seek.
|
||||
GameplayClock.UnderlyingClock.ProcessFrame();
|
||||
|
||||
OnSeek?.Invoke();
|
||||
}
|
||||
|
||||
/// <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.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
@ -23,7 +23,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private Player player { get; set; }
|
||||
private GameplayClockContainer gameplayClockContainer { get; set; }
|
||||
|
||||
public bool UsesFixedAnchor { get; set; }
|
||||
|
||||
@ -37,8 +37,8 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
if (player != null)
|
||||
player.OnSeek += Clear;
|
||||
if (gameplayClockContainer != null)
|
||||
gameplayClockContainer.OnSeek += Clear;
|
||||
|
||||
processor.NewJudgement += OnNewJudgement;
|
||||
}
|
||||
@ -74,7 +74,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
||||
}
|
||||
|
||||
/// <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.
|
||||
/// </summary>
|
||||
public abstract void Clear();
|
||||
@ -86,8 +86,8 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
||||
if (processor != null)
|
||||
processor.NewJudgement -= OnNewJudgement;
|
||||
|
||||
if (player != null)
|
||||
player.OnSeek -= Clear;
|
||||
if (gameplayClockContainer != null)
|
||||
gameplayClockContainer.OnSeek -= Clear;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -69,11 +69,6 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
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; }
|
||||
|
||||
private Bindable<bool> mouseWheelDisabled;
|
||||
@ -592,7 +587,6 @@ namespace osu.Game.Screens.Play
|
||||
public void Seek(double time)
|
||||
{
|
||||
GameplayClockContainer.Seek(time);
|
||||
OnSeek?.Invoke();
|
||||
}
|
||||
|
||||
private ScheduledDelegate frameStablePlaybackResetDelegate;
|
||||
|
Loading…
Reference in New Issue
Block a user