mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Introduce StartFrame
and EndFrame
to simplify the replay interpolation code
This commit is contained in:
@ -7,7 +7,6 @@ using osu.Framework.Input.StateChanges;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Replays;
|
||||
using osu.Game.Rulesets.Replays;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Replays
|
||||
{
|
||||
@ -20,22 +19,11 @@ namespace osu.Game.Rulesets.Osu.Replays
|
||||
|
||||
protected override bool IsImportant(OsuReplayFrame frame) => frame.Actions.Any();
|
||||
|
||||
protected Vector2? Position
|
||||
{
|
||||
get
|
||||
{
|
||||
var frame = CurrentFrame;
|
||||
|
||||
if (frame == null)
|
||||
return null;
|
||||
|
||||
return NextFrame != null ? Interpolation.ValueAt(CurrentTime, frame.Position, NextFrame.Position, frame.Time, NextFrame.Time) : frame.Position;
|
||||
}
|
||||
}
|
||||
|
||||
public override void CollectPendingInputs(List<IInput> inputs)
|
||||
{
|
||||
inputs.Add(new MousePositionAbsoluteInput { Position = GamefieldToScreenSpace(Position ?? Vector2.Zero) });
|
||||
var position = Interpolation.ValueAt(CurrentTime, StartFrame.Position, EndFrame.Position, StartFrame.Time, EndFrame.Time);
|
||||
|
||||
inputs.Add(new MousePositionAbsoluteInput { Position = GamefieldToScreenSpace(position) });
|
||||
inputs.Add(new ReplayState<OsuAction> { PressedActions = CurrentFrame?.Actions ?? new List<OsuAction>() });
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user