mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 04:32:57 +08:00
Add replay statistics frames to FramedReplayInputHandler
This commit is contained in:
parent
4727aeda01
commit
0458d408bb
@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.EmptyFreeform.Replays
|
||||
|
||||
protected override bool IsImportant(EmptyFreeformReplayFrame frame) => frame.Actions.Any();
|
||||
|
||||
public override void CollectPendingInputs(List<IInput> inputs)
|
||||
protected override void CollectReplayInputs(List<IInput> inputs)
|
||||
{
|
||||
var position = Interpolation.ValueAt(CurrentTime, StartFrame.Position, EndFrame.Position, StartFrame.Time, EndFrame.Time);
|
||||
|
||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Pippidon.Replays
|
||||
|
||||
protected override bool IsImportant(PippidonReplayFrame frame) => true;
|
||||
|
||||
public override void CollectPendingInputs(List<IInput> inputs)
|
||||
protected override void CollectReplayInputs(List<IInput> inputs)
|
||||
{
|
||||
var position = Interpolation.ValueAt(CurrentTime, StartFrame.Position, EndFrame.Position, StartFrame.Time, EndFrame.Time);
|
||||
|
||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.EmptyScrolling.Replays
|
||||
|
||||
protected override bool IsImportant(EmptyScrollingReplayFrame frame) => frame.Actions.Any();
|
||||
|
||||
public override void CollectPendingInputs(List<IInput> inputs)
|
||||
protected override void CollectReplayInputs(List<IInput> inputs)
|
||||
{
|
||||
inputs.Add(new ReplayState<EmptyScrollingAction>
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Pippidon.Replays
|
||||
|
||||
protected override bool IsImportant(PippidonReplayFrame frame) => frame.Actions.Any();
|
||||
|
||||
public override void CollectPendingInputs(List<IInput> inputs)
|
||||
protected override void CollectReplayInputs(List<IInput> inputs)
|
||||
{
|
||||
inputs.Add(new ReplayState<PippidonAction>
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Catch.Replays
|
||||
|
||||
protected override bool IsImportant(CatchReplayFrame frame) => frame.Actions.Any();
|
||||
|
||||
public override void CollectPendingInputs(List<IInput> inputs)
|
||||
protected override void CollectReplayInputs(List<IInput> inputs)
|
||||
{
|
||||
float position = Interpolation.ValueAt(CurrentTime, StartFrame.Position, EndFrame.Position, StartFrame.Time, EndFrame.Time);
|
||||
|
||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Mania.Replays
|
||||
|
||||
protected override bool IsImportant(ManiaReplayFrame frame) => frame.Actions.Any();
|
||||
|
||||
public override void CollectPendingInputs(List<IInput> inputs)
|
||||
protected override void CollectReplayInputs(List<IInput> inputs)
|
||||
{
|
||||
inputs.Add(new ReplayState<ManiaAction> { PressedActions = CurrentFrame?.Actions ?? new List<ManiaAction>() });
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Osu.Replays
|
||||
|
||||
protected override bool IsImportant(OsuReplayFrame frame) => frame.Actions.Any();
|
||||
|
||||
public override void CollectPendingInputs(List<IInput> inputs)
|
||||
protected override void CollectReplayInputs(List<IInput> inputs)
|
||||
{
|
||||
var position = Interpolation.ValueAt(CurrentTime, StartFrame.Position, EndFrame.Position, StartFrame.Time, EndFrame.Time);
|
||||
|
||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Taiko.Replays
|
||||
|
||||
protected override bool IsImportant(TaikoReplayFrame frame) => frame.Actions.Any();
|
||||
|
||||
public override void CollectPendingInputs(List<IInput> inputs)
|
||||
protected override void CollectReplayInputs(List<IInput> inputs)
|
||||
{
|
||||
inputs.Add(new ReplayState<TaikoAction> { PressedActions = CurrentFrame?.Actions ?? new List<TaikoAction>() });
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
}
|
||||
|
||||
public override void CollectPendingInputs(List<IInput> inputs)
|
||||
protected override void CollectReplayInputs(List<IInput> inputs)
|
||||
{
|
||||
inputs.Add(new MousePositionAbsoluteInput { Position = GamefieldToScreenSpace(CurrentFrame?.Position ?? Vector2.Zero) });
|
||||
inputs.Add(new ReplayState<TestAction> { PressedActions = CurrentFrame?.Actions ?? new List<TestAction>() });
|
||||
|
@ -259,7 +259,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
}
|
||||
|
||||
public override void CollectPendingInputs(List<IInput> inputs)
|
||||
protected override void CollectReplayInputs(List<IInput> inputs)
|
||||
{
|
||||
inputs.Add(new MousePositionAbsoluteInput { Position = GamefieldToScreenSpace(CurrentFrame?.Position ?? Vector2.Zero) });
|
||||
inputs.Add(new ReplayState<TestAction> { PressedActions = CurrentFrame?.Actions ?? new List<TestAction>() });
|
||||
|
@ -9,6 +9,7 @@ using osu.Framework.Input.StateChanges;
|
||||
using osu.Framework.Input.StateChanges.Events;
|
||||
using osu.Framework.Input.States;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Rulesets.Replays;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osuTK;
|
||||
|
||||
@ -79,5 +80,38 @@ namespace osu.Game.Input.Handlers
|
||||
PressedActions = pressedActions;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An <see cref="IInput"/> that is triggered when a frame containing replay statistics arrives.
|
||||
/// </summary>
|
||||
public class ReplayStatisticsFrameInput : IInput
|
||||
{
|
||||
/// <summary>
|
||||
/// The frame containing the statistics.
|
||||
/// </summary>
|
||||
public ReplayFrame Frame;
|
||||
|
||||
public void Apply(InputState state, IInputStateChangeHandler handler)
|
||||
{
|
||||
handler.HandleInputStateChange(new ReplayStatisticsFrameEvent(state, this, Frame));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An <see cref="InputStateChangeEvent"/> that is triggered when a frame containing replay statistics arrives.
|
||||
/// </summary>
|
||||
public class ReplayStatisticsFrameEvent : InputStateChangeEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// The frame containing the statistics.
|
||||
/// </summary>
|
||||
public readonly ReplayFrame Frame;
|
||||
|
||||
public ReplayStatisticsFrameEvent(InputState state, IInput input, ReplayFrame frame)
|
||||
: base(state, input)
|
||||
{
|
||||
Frame = frame;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Input.StateChanges;
|
||||
using osu.Game.Input.Handlers;
|
||||
using osu.Game.Replays;
|
||||
|
||||
@ -174,5 +175,19 @@ namespace osu.Game.Rulesets.Replays
|
||||
|
||||
return Frames[index].Time;
|
||||
}
|
||||
|
||||
public sealed override void CollectPendingInputs(List<IInput> inputs)
|
||||
{
|
||||
base.CollectPendingInputs(inputs);
|
||||
|
||||
CollectReplayInputs(inputs);
|
||||
|
||||
if (CurrentFrame?.Header != null)
|
||||
inputs.Add(new ReplayStatisticsFrameInput { Frame = CurrentFrame });
|
||||
}
|
||||
|
||||
protected virtual void CollectReplayInputs(List<IInput> inputs)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user