Merge branch 'master' into right-click-circle-delete

This commit is contained in:
Dean Herbert
2020-10-27 12:02:29 +09:00
committed by GitHub
28 changed files with 919 additions and 53 deletions

View File

@ -4,12 +4,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Online.Spectator;
using osu.Game.Replays;
using osu.Game.Rulesets.Replays;
using osu.Game.Screens.Play;
using osuTK;
namespace osu.Game.Rulesets.UI
@ -25,6 +28,12 @@ namespace osu.Game.Rulesets.UI
public int RecordFrameRate = 60;
[Resolved(canBeNull: true)]
private SpectatorStreamingClient spectatorStreaming { get; set; }
[Resolved]
private GameplayBeatmap gameplayBeatmap { get; set; }
protected ReplayRecorder(Replay target)
{
this.target = target;
@ -39,6 +48,14 @@ namespace osu.Game.Rulesets.UI
base.LoadComplete();
inputManager = GetContainingInputManager();
spectatorStreaming?.BeginPlaying(gameplayBeatmap);
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
spectatorStreaming?.EndPlaying();
}
protected override bool OnMouseMove(MouseMoveEvent e)
@ -72,7 +89,11 @@ namespace osu.Game.Rulesets.UI
var frame = HandleFrame(position, pressedActions, last);
if (frame != null)
{
target.Frames.Add(frame);
spectatorStreaming?.HandleFrame(frame);
}
}
protected abstract ReplayFrame HandleFrame(Vector2 mousePosition, List<T> actions, ReplayFrame previousFrame);