// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using System.Collections.Generic; using osu.Framework.Input; using osu.Framework.Input.Handlers; using osu.Framework.Platform; using OpenTK; namespace osu.Game.Input.Handlers { public abstract class ReplayInputHandler : InputHandler { /// /// A function provided to convert replay coordinates from gamefield to screen space. /// public Func ToScreenSpace { protected get; set; } /// /// Update the current frame based on an incoming time value. /// There are cases where we return a "must-use" time value that is different from the input. /// This is to ensure accurate playback of replay data. /// /// The time which we should use for finding the current frame. /// The usable time value. If null, we should not advance time as we do not have enough data. public abstract double? SetFrameFromTime(double time); public override bool Initialize(GameHost host) => true; public override bool IsActive => true; public override int Priority => 0; public class ReplayState : InputState where T : struct { public List PressedActions; public override InputState Clone() { var clone = (ReplayState)base.Clone(); clone.PressedActions = new List(PressedActions); return clone; } } } }