1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-12 21:02:59 +08:00

account for gameplay start time

This commit is contained in:
Nitrous 2022-07-28 08:01:38 +08:00
parent a222278710
commit 45c11f2b7b
No known key found for this signature in database
GPG Key ID: 85EC4A6AE8F69D64

View File

@ -3,6 +3,7 @@
#nullable disable
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
@ -20,9 +21,12 @@ namespace osu.Game.Screens.Play.HUD
{
public bool UsesFixedAnchor { get; set; }
[Resolved]
[Resolved(canBeNull: true)]
private GameplayClock gameplayClock { get; set; }
[Resolved(canBeNull: true)]
private GameplayClockContainer gameplayClockContainer { get; set; }
[Resolved(canBeNull: true)]
private DrawableRuleset drawableRuleset { get; set; }
@ -69,12 +73,13 @@ namespace osu.Game.Screens.Play.HUD
if (objects == null)
return;
double gameplayTime = gameplayClock?.CurrentTime ?? Time.Current;
double gameplayTime = gameplayClockContainer?.GameplayClock.CurrentTime ?? gameplayClock?.CurrentTime ?? Time.Current;
double frameStableTime = referenceClock?.CurrentTime ?? gameplayTime;
if (frameStableTime < FirstHitTime)
{
UpdateProgress((frameStableTime - FirstEventTime) / (FirstHitTime - FirstEventTime), gameplayTime, true);
double earliest = Math.Min(FirstEventTime, gameplayClockContainer?.StartTime ?? 0);
UpdateProgress((frameStableTime - earliest) / (FirstHitTime - earliest), gameplayTime, true);
}
else
{