mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 15:44:04 +09:00
Purge final spectator frames before ending play
This commit is contained in:
@ -167,6 +167,9 @@ namespace osu.Game.Online.Spectator
|
||||
if (!IsPlaying)
|
||||
return;
|
||||
|
||||
if (pendingFrames.Count > 0)
|
||||
purgePendingFrames(true);
|
||||
|
||||
IsPlaying = false;
|
||||
currentBeatmap = null;
|
||||
|
||||
@ -238,9 +241,12 @@ namespace osu.Game.Online.Spectator
|
||||
purgePendingFrames();
|
||||
}
|
||||
|
||||
private void purgePendingFrames()
|
||||
private void purgePendingFrames(bool force = false)
|
||||
{
|
||||
if (lastSend?.IsCompleted == false)
|
||||
if (lastSend?.IsCompleted == false && !force)
|
||||
return;
|
||||
|
||||
if (pendingFrames.Count == 0)
|
||||
return;
|
||||
|
||||
var frames = pendingFrames.ToArray();
|
||||
|
@ -14,6 +14,7 @@ using osu.Framework.Utils;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.Spectator;
|
||||
using osu.Game.Replays.Legacy;
|
||||
using osu.Game.Rulesets.Replays;
|
||||
using osu.Game.Scoring;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Spectator
|
||||
@ -27,12 +28,22 @@ namespace osu.Game.Tests.Visual.Spectator
|
||||
|
||||
public override IBindable<bool> IsConnected { get; } = new Bindable<bool>(true);
|
||||
|
||||
public readonly Dictionary<int, ReplayFrame> LastReceivedFrame = new Dictionary<int, ReplayFrame>();
|
||||
private readonly Dictionary<int, int> userBeatmapDictionary = new Dictionary<int, int>();
|
||||
private readonly Dictionary<int, int> userNextFrameDictionary = new Dictionary<int, int>();
|
||||
|
||||
[Resolved]
|
||||
private IAPIProvider api { get; set; } = null!;
|
||||
|
||||
public TestSpectatorClient()
|
||||
{
|
||||
OnNewFrames += (i, bundle) =>
|
||||
{
|
||||
if (PlayingUsers.Contains(i))
|
||||
LastReceivedFrame[i] = bundle.Frames[^1];
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts play for an arbitrary user.
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user