mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 08:49:59 +09:00
Use FrameStabilityClock to denote current position on song progress
This commit is contained in:
@ -59,6 +59,8 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Container Overlays { get; private set; }
|
public Container Overlays { get; private set; }
|
||||||
|
|
||||||
|
public override GameplayClock FrameStableClock => frameStabilityContainer.GameplayClock;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when a <see cref="JudgementResult"/> has been applied by a <see cref="DrawableHitObject"/>.
|
/// Invoked when a <see cref="JudgementResult"/> has been applied by a <see cref="DrawableHitObject"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -334,6 +336,11 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly BindableBool IsPaused = new BindableBool();
|
public readonly BindableBool IsPaused = new BindableBool();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The frame-stable clock which is being used for playfield display.
|
||||||
|
/// </summary>
|
||||||
|
public abstract GameplayClock FrameStableClock { get; }
|
||||||
|
|
||||||
/// <summary>~
|
/// <summary>~
|
||||||
/// The associated ruleset.
|
/// The associated ruleset.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -20,7 +20,8 @@ namespace osu.Game.Rulesets.UI
|
|||||||
public FrameStabilityContainer()
|
public FrameStabilityContainer()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
gameplayClock = new GameplayClock(framedClock = new FramedClock(manualClock = new ManualClock()));
|
|
||||||
|
GameplayClock = new GameplayClock(framedClock = new FramedClock(manualClock = new ManualClock()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly ManualClock manualClock;
|
private readonly ManualClock manualClock;
|
||||||
@ -28,7 +29,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
private readonly FramedClock framedClock;
|
private readonly FramedClock framedClock;
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
private GameplayClock gameplayClock;
|
public GameplayClock GameplayClock { get; }
|
||||||
|
|
||||||
private IFrameBasedClock parentGameplayClock;
|
private IFrameBasedClock parentGameplayClock;
|
||||||
|
|
||||||
@ -38,7 +39,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
if (clock != null)
|
if (clock != null)
|
||||||
{
|
{
|
||||||
parentGameplayClock = clock;
|
parentGameplayClock = clock;
|
||||||
gameplayClock.IsPaused.BindTo(clock.IsPaused);
|
GameplayClock.IsPaused.BindTo(clock.IsPaused);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +74,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
public override bool UpdateSubTree()
|
public override bool UpdateSubTree()
|
||||||
{
|
{
|
||||||
requireMoreUpdateLoops = true;
|
requireMoreUpdateLoops = true;
|
||||||
validState = !gameplayClock.IsPaused.Value;
|
validState = !GameplayClock.IsPaused.Value;
|
||||||
|
|
||||||
int loops = 0;
|
int loops = 0;
|
||||||
|
|
||||||
@ -160,7 +161,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
if (parentGameplayClock == null)
|
if (parentGameplayClock == null)
|
||||||
parentGameplayClock = Clock;
|
parentGameplayClock = Clock;
|
||||||
|
|
||||||
Clock = gameplayClock;
|
Clock = GameplayClock;
|
||||||
ProcessCustomClock = false;
|
ProcessCustomClock = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,10 @@ namespace osu.Game.Screens.Play
|
|||||||
public readonly HoldForMenuButton HoldToQuit;
|
public readonly HoldForMenuButton HoldToQuit;
|
||||||
public readonly PlayerSettingsOverlay PlayerSettingsOverlay;
|
public readonly PlayerSettingsOverlay PlayerSettingsOverlay;
|
||||||
|
|
||||||
|
private readonly ScoreProcessor scoreProcessor;
|
||||||
|
private readonly DrawableRuleset drawableRuleset;
|
||||||
|
private readonly IReadOnlyList<Mod> mods;
|
||||||
|
|
||||||
private Bindable<bool> showHud;
|
private Bindable<bool> showHud;
|
||||||
private readonly Container visibilityContainer;
|
private readonly Container visibilityContainer;
|
||||||
private readonly BindableBool replayLoaded = new BindableBool();
|
private readonly BindableBool replayLoaded = new BindableBool();
|
||||||
@ -45,6 +49,10 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public HUDOverlay(ScoreProcessor scoreProcessor, DrawableRuleset drawableRuleset, IReadOnlyList<Mod> mods)
|
public HUDOverlay(ScoreProcessor scoreProcessor, DrawableRuleset drawableRuleset, IReadOnlyList<Mod> mods)
|
||||||
{
|
{
|
||||||
|
this.scoreProcessor = scoreProcessor;
|
||||||
|
this.drawableRuleset = drawableRuleset;
|
||||||
|
this.mods = mods;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
@ -89,20 +97,21 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader(true)]
|
||||||
|
private void load(OsuConfigManager config, NotificationOverlay notificationOverlay)
|
||||||
|
{
|
||||||
BindProcessor(scoreProcessor);
|
BindProcessor(scoreProcessor);
|
||||||
BindDrawableRuleset(drawableRuleset);
|
BindDrawableRuleset(drawableRuleset);
|
||||||
|
|
||||||
Progress.Objects = drawableRuleset.Objects;
|
Progress.Objects = drawableRuleset.Objects;
|
||||||
Progress.AllowSeeking = drawableRuleset.HasReplayLoaded.Value;
|
Progress.AllowSeeking = drawableRuleset.HasReplayLoaded.Value;
|
||||||
Progress.RequestSeek = time => RequestSeek(time);
|
Progress.RequestSeek = time => RequestSeek(time);
|
||||||
|
Progress.ReferenceClock = drawableRuleset.FrameStableClock;
|
||||||
|
|
||||||
ModDisplay.Current.Value = mods;
|
ModDisplay.Current.Value = mods;
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
|
||||||
private void load(OsuConfigManager config, NotificationOverlay notificationOverlay)
|
|
||||||
{
|
|
||||||
showHud = config.GetBindable<bool>(OsuSetting.ShowInterface);
|
showHud = config.GetBindable<bool>(OsuSetting.ShowInterface);
|
||||||
showHud.ValueChanged += visible => visibilityContainer.FadeTo(visible.NewValue ? 1 : 0, duration);
|
showHud.ValueChanged += visible => visibilityContainer.FadeTo(visible.NewValue ? 1 : 0, duration);
|
||||||
showHud.TriggerChange();
|
showHud.TriggerChange();
|
||||||
|
@ -10,6 +10,7 @@ using osu.Game.Graphics;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
@ -55,7 +56,9 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private readonly BindableBool replayLoaded = new BindableBool();
|
private readonly BindableBool replayLoaded = new BindableBool();
|
||||||
|
|
||||||
private GameplayClock gameplayClock;
|
public IClock ReferenceClock;
|
||||||
|
|
||||||
|
private IClock gameplayClock;
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(OsuColour colours, GameplayClock clock)
|
private void load(OsuColour colours, GameplayClock clock)
|
||||||
@ -154,10 +157,12 @@ namespace osu.Game.Screens.Play
|
|||||||
if (objects == null)
|
if (objects == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
double position = gameplayClock?.CurrentTime ?? Time.Current;
|
double gameplayTime = gameplayClock?.CurrentTime ?? Time.Current;
|
||||||
double progress = Math.Min(1, (position - firstHitTime) / (lastHitTime - firstHitTime));
|
double frameStableTime = ReferenceClock?.CurrentTime ?? gameplayTime;
|
||||||
|
|
||||||
bar.CurrentTime = position;
|
double progress = Math.Min(1, (frameStableTime - firstHitTime) / (lastHitTime - firstHitTime));
|
||||||
|
|
||||||
|
bar.CurrentTime = gameplayTime;
|
||||||
graph.Progress = (int)(graph.ColumnCount * progress);
|
graph.Progress = (int)(graph.ColumnCount * progress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user