mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 00:23:59 +09:00
Stop using Drawable.Clock altogether
This commit is contained in:
@ -10,6 +10,7 @@ using System.Linq;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
@ -48,6 +49,17 @@ namespace osu.Game.Online.Spectator
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public IReadOnlyList<Mod> Mods => scoreProcessor?.Mods.Value ?? Array.Empty<Mod>();
|
public IReadOnlyList<Mod> Mods => scoreProcessor?.Mods.Value ?? Array.Empty<Mod>();
|
||||||
|
|
||||||
|
private IClock? referenceClock;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The clock used to determine the current score.
|
||||||
|
/// </summary>
|
||||||
|
public IClock ReferenceClock
|
||||||
|
{
|
||||||
|
get => referenceClock ?? Clock;
|
||||||
|
set => referenceClock = value;
|
||||||
|
}
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private SpectatorClient spectatorClient { get; set; } = null!;
|
private SpectatorClient spectatorClient { get; set; } = null!;
|
||||||
|
|
||||||
@ -131,7 +143,7 @@ namespace osu.Game.Online.Spectator
|
|||||||
Debug.Assert(spectatorState != null);
|
Debug.Assert(spectatorState != null);
|
||||||
Debug.Assert(scoreProcessor != null);
|
Debug.Assert(scoreProcessor != null);
|
||||||
|
|
||||||
int frameIndex = replayFrames.BinarySearch(new TimedFrame(Time.Current));
|
int frameIndex = replayFrames.BinarySearch(new TimedFrame(ReferenceClock.CurrentTime));
|
||||||
if (frameIndex < 0)
|
if (frameIndex < 0)
|
||||||
frameIndex = ~frameIndex;
|
frameIndex = ~frameIndex;
|
||||||
frameIndex = Math.Clamp(frameIndex - 1, 0, replayFrames.Count - 1);
|
frameIndex = Math.Clamp(frameIndex - 1, 0, replayFrames.Count - 1);
|
||||||
|
@ -20,8 +20,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
|||||||
if (!UserScores.TryGetValue(userId, out var data))
|
if (!UserScores.TryGetValue(userId, out var data))
|
||||||
throw new ArgumentException(@"Provided user is not tracked by this leaderboard", nameof(userId));
|
throw new ArgumentException(@"Provided user is not tracked by this leaderboard", nameof(userId));
|
||||||
|
|
||||||
data.ScoreProcessor.ProcessCustomClock = false;
|
data.ScoreProcessor.ReferenceClock = clock;
|
||||||
data.ScoreProcessor.Clock = new FramedClock(clock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
|
Reference in New Issue
Block a user