mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Fix FramedReplayInputHandler starting at frame 0 when it shouldn't
This commit is contained in:
@ -7,7 +7,6 @@ using osu.Framework.Input.StateChanges;
|
||||
using osu.Game.Input.Handlers;
|
||||
using osu.Game.Replays;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Rulesets.Replays
|
||||
{
|
||||
@ -22,12 +21,12 @@ namespace osu.Game.Rulesets.Replays
|
||||
|
||||
protected List<ReplayFrame> Frames => replay.Frames;
|
||||
|
||||
public TFrame CurrentFrame => !HasFrames ? null : (TFrame)Frames[currentFrameIndex];
|
||||
public TFrame CurrentFrame => !HasFrames || !currentFrameIndex.HasValue ? null : (TFrame)Frames[currentFrameIndex.Value];
|
||||
public TFrame NextFrame => !HasFrames ? null : (TFrame)Frames[nextFrameIndex];
|
||||
|
||||
private int currentFrameIndex;
|
||||
private int? currentFrameIndex;
|
||||
|
||||
private int nextFrameIndex => MathHelper.Clamp(currentFrameIndex + (currentDirection > 0 ? 1 : -1), 0, Frames.Count - 1);
|
||||
private int nextFrameIndex => currentFrameIndex.HasValue ? MathHelper.Clamp(currentFrameIndex.Value + (currentDirection > 0 ? 1 : -1), 0, Frames.Count - 1) : 0;
|
||||
|
||||
protected FramedReplayInputHandler(Replay replay)
|
||||
{
|
||||
@ -47,9 +46,6 @@ namespace osu.Game.Rulesets.Replays
|
||||
|
||||
public override List<IInput> GetPendingInputs() => new List<IInput>();
|
||||
|
||||
public bool AtLastFrame => currentFrameIndex == Frames.Count - 1;
|
||||
public bool AtFirstFrame => currentFrameIndex == 0;
|
||||
|
||||
private const double sixty_frame_time = 1000.0 / 60;
|
||||
|
||||
protected double CurrentTime { get; private set; }
|
||||
@ -106,22 +102,5 @@ namespace osu.Game.Rulesets.Replays
|
||||
|
||||
return CurrentTime = time;
|
||||
}
|
||||
|
||||
protected class ReplayMouseState : osu.Framework.Input.States.MouseState
|
||||
{
|
||||
public ReplayMouseState(Vector2 position)
|
||||
{
|
||||
Position = position;
|
||||
}
|
||||
}
|
||||
|
||||
protected class ReplayKeyboardState : osu.Framework.Input.States.KeyboardState
|
||||
{
|
||||
public ReplayKeyboardState(List<Key> keys)
|
||||
{
|
||||
foreach (var key in keys)
|
||||
Keys.Add(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user