Begin shaping the spectator streaming component

This commit is contained in:
Dean Herbert
2020-10-22 13:41:54 +09:00
parent db4dd3182b
commit 93db75bd41
3 changed files with 58 additions and 23 deletions

View File

@ -3,8 +3,6 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.SignalR.Client;
using Microsoft.Extensions.DependencyInjection;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -264,25 +262,13 @@ namespace osu.Game.Tests.Visual.Gameplay
internal class TestReplayRecorder : ReplayRecorder<TestAction>
{
private readonly SpectatorClient client;
public TestReplayRecorder(Replay target)
: base(target)
{
var connection = new HubConnectionBuilder()
.WithUrl("http://localhost:5009/spectator")
.AddMessagePackProtocol()
// .ConfigureLogging(logging => { logging.AddConsole(); })
.Build();
connection.StartAsync().Wait();
client = new SpectatorClient(connection);
}
protected override ReplayFrame HandleFrame(Vector2 mousePosition, List<TestAction> actions, ReplayFrame previousFrame)
{
client.SendFrames(new FrameDataBundle(new[] { new LegacyReplayFrame(Time.Current, mousePosition.X, mousePosition.Y, ReplayButtonState.None) }));
return new TestReplayFrame(Time.Current, mousePosition, actions.ToArray());
}
}