mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 02:02:53 +08:00
Remove caching of GameplayClockContainer
in favour of GameplayClock
Also fixes `SongProgress` being displayed in skin editor on non-gameplay screens, due to `GameplayClock` not marked as a required dependency.
This commit is contained in:
parent
3f72e76348
commit
905bbdc8ee
@ -30,8 +30,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
Add(gameplayClockContainer = new MasterGameplayClockContainer(Beatmap.Value, skip_target_time));
|
||||
|
||||
Dependencies.CacheAs(gameplayClockContainer); // required for StartTime
|
||||
Dependencies.CacheAs(gameplayClockContainer.GameplayClock); // required for everything else
|
||||
Dependencies.CacheAs(gameplayClockContainer.GameplayClock);
|
||||
}
|
||||
|
||||
[SetUpSteps]
|
||||
|
@ -16,7 +16,6 @@ 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>
|
||||
|
@ -42,9 +42,6 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
protected override bool BlockScrollInput => false;
|
||||
|
||||
[Resolved]
|
||||
private GameplayClock? gameplayClock { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private Player? player { get; set; }
|
||||
|
||||
@ -172,7 +169,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
protected override void UpdateProgress(double progress, bool isIntro)
|
||||
{
|
||||
bar.CurrentTime = gameplayClock?.CurrentTime ?? Time.Current;
|
||||
bar.CurrentTime = GameplayClock.CurrentTime;
|
||||
|
||||
if (isIntro)
|
||||
graph.Progress = 0;
|
||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
public bool UsesFixedAnchor { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private GameplayClockContainer? gameplayClockContainer { get; set; }
|
||||
protected GameplayClock GameplayClock { get; private set; } = null!;
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private DrawableRuleset? drawableRuleset { get; set; }
|
||||
@ -69,14 +69,14 @@ namespace osu.Game.Screens.Play.HUD
|
||||
return;
|
||||
|
||||
// The reference clock is used to accurately tell the playfield's time. This is obtained from the drawable ruleset.
|
||||
// However, if no drawable ruleset is available (i.e. used in tests), we fall back to either the gameplay clock container or this drawable's own clock.
|
||||
double currentTime = referenceClock?.CurrentTime ?? gameplayClockContainer?.GameplayClock.CurrentTime ?? Time.Current;
|
||||
// However, if no drawable ruleset is available (i.e. used in tests), we fall back to the gameplay clock.
|
||||
double currentTime = referenceClock?.CurrentTime ?? GameplayClock.CurrentTime;
|
||||
|
||||
bool isInIntro = currentTime < FirstHitTime;
|
||||
|
||||
if (isInIntro)
|
||||
{
|
||||
double introStartTime = gameplayClockContainer?.StartTime ?? 0;
|
||||
double introStartTime = GameplayClock.StartTime ?? 0;
|
||||
|
||||
double introOffsetCurrent = currentTime - introStartTime;
|
||||
double introDuration = FirstHitTime - introStartTime;
|
||||
|
Loading…
Reference in New Issue
Block a user