1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 21:42:56 +08:00

Add begin/end session logic

This commit is contained in:
Dean Herbert 2020-10-22 15:26:57 +09:00
parent 4788b4a643
commit 96049c39c9

View File

@ -5,10 +5,12 @@ using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Beatmaps;
using osu.Game.Online.Spectator;
using osu.Game.Replays;
using osu.Game.Rulesets.Replays;
@ -27,6 +29,12 @@ namespace osu.Game.Rulesets.UI
public int RecordFrameRate = 60;
[Resolved(canBeNull: true)]
private SpectatorStreamingClient spectatorStreaming { get; set; }
[Resolved]
private IBindable<WorkingBeatmap> beatmap { get; set; }
protected ReplayRecorder(Replay target)
{
this.target = target;
@ -41,6 +49,14 @@ namespace osu.Game.Rulesets.UI
base.LoadComplete();
inputManager = GetContainingInputManager();
spectatorStreaming?.BeginPlaying(beatmap.Value.BeatmapInfo.ID);
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
spectatorStreaming?.EndPlaying(beatmap.Value.BeatmapInfo.ID);
}
protected override bool OnMouseMove(MouseMoveEvent e)
@ -62,9 +78,6 @@ namespace osu.Game.Rulesets.UI
recordFrame(true);
}
[Resolved(canBeNull: true)]
private SpectatorStreamingClient spectatorStreaming { get; set; }
private void recordFrame(bool important)
{
var last = target.Frames.LastOrDefault();