diff --git a/osu.Game.Modes.Osu/OsuAutoReplay.cs b/osu.Game.Modes.Osu/OsuAutoReplay.cs index 61b7466d86..b3fece2b84 100644 --- a/osu.Game.Modes.Osu/OsuAutoReplay.cs +++ b/osu.Game.Modes.Osu/OsuAutoReplay.cs @@ -29,7 +29,7 @@ namespace osu.Game.Modes.Osu createAutoReplay(); } - internal class LegacyReplayFrameComparer : IComparer + private class LegacyReplayFrameComparer : IComparer { public int Compare(LegacyReplayFrame f1, LegacyReplayFrame f2) { diff --git a/osu.Game/Database/ScoreDatabase.cs b/osu.Game/Database/ScoreDatabase.cs index 665ae8649e..096c0dcc29 100644 --- a/osu.Game/Database/ScoreDatabase.cs +++ b/osu.Game/Database/ScoreDatabase.cs @@ -101,7 +101,7 @@ namespace osu.Game.Database using (var lzma = new LzmaStream(properties, replayInStream, compressedSize, outSize)) using (var reader = new StreamReader(lzma)) - score.Replay = new LegacyReplay(reader); + score.Replay = score.CreateLegacyReplayFrom(reader); } } diff --git a/osu.Game/Modes/LegacyReplay.cs b/osu.Game/Modes/LegacyReplay.cs index 4b77550cbc..d57d4a15d2 100644 --- a/osu.Game/Modes/LegacyReplay.cs +++ b/osu.Game/Modes/LegacyReplay.cs @@ -46,13 +46,13 @@ namespace osu.Game.Modes } } - public override ReplayInputHandler GetInputHandler() => new LegacyReplayInputHandler(Frames); + public override ReplayInputHandler CreateInputHandler() => new LegacyReplayInputHandler(Frames); /// /// The ReplayHandler will take a replay and handle the propagation of updates to the input stack. /// It handles logic of any frames which *must* be executed. /// - public class LegacyReplayInputHandler : ReplayInputHandler + protected class LegacyReplayInputHandler : ReplayInputHandler { private readonly List replayContent; @@ -163,7 +163,7 @@ namespace osu.Game.Modes return currentTime = time; } - private class ReplayMouseState : MouseState + protected class ReplayMouseState : MouseState { public ReplayMouseState(Vector2 position, IEnumerable list) { @@ -172,7 +172,7 @@ namespace osu.Game.Modes } } - private class ReplayKeyboardState : KeyboardState + protected class ReplayKeyboardState : KeyboardState { public ReplayKeyboardState(List keys) { @@ -182,7 +182,7 @@ namespace osu.Game.Modes } [Flags] - public enum LegacyButtonState + protected enum LegacyButtonState { None = 0, Left1 = 1, @@ -192,7 +192,7 @@ namespace osu.Game.Modes Smoke = 16 } - public class LegacyReplayFrame + protected class LegacyReplayFrame { public Vector2 Position => new Vector2(MouseX, MouseY); diff --git a/osu.Game/Modes/Mods/Mod.cs b/osu.Game/Modes/Mods/Mod.cs index 8416ae6211..c53c6faa21 100644 --- a/osu.Game/Modes/Mods/Mod.cs +++ b/osu.Game/Modes/Mods/Mod.cs @@ -157,7 +157,7 @@ namespace osu.Game.Modes.Mods public void Apply(HitRenderer hitRenderer) { - hitRenderer.InputManager.ReplayInputHandler = CreateReplayScore(hitRenderer.Beatmap)?.Replay?.GetInputHandler(); + hitRenderer.InputManager.ReplayInputHandler = CreateReplayScore(hitRenderer.Beatmap)?.Replay?.CreateInputHandler(); } } diff --git a/osu.Game/Modes/Replay.cs b/osu.Game/Modes/Replay.cs index 0a41a12335..6d93afdeb9 100644 --- a/osu.Game/Modes/Replay.cs +++ b/osu.Game/Modes/Replay.cs @@ -7,6 +7,6 @@ namespace osu.Game.Modes { public abstract class Replay { - public virtual ReplayInputHandler GetInputHandler() => null; + public virtual ReplayInputHandler CreateInputHandler() => null; } } \ No newline at end of file diff --git a/osu.Game/Modes/Scoring/Score.cs b/osu.Game/Modes/Scoring/Score.cs index fa74fba279..75c243278d 100644 --- a/osu.Game/Modes/Scoring/Score.cs +++ b/osu.Game/Modes/Scoring/Score.cs @@ -6,6 +6,7 @@ using Newtonsoft.Json; using osu.Game.Database; using osu.Game.Modes.Mods; using osu.Game.Users; +using System.IO; namespace osu.Game.Modes.Scoring { @@ -43,6 +44,13 @@ namespace osu.Game.Modes.Scoring [JsonProperty(@"date")] public DateTime Date; + /// + /// Creates a legacy replay which is read from a stream. + /// + /// The stream reader. + /// The replay. + public virtual Replay CreateLegacyReplayFrom(StreamReader reader) => new LegacyReplay(reader); + // [JsonProperty(@"count50")] 0, //[JsonProperty(@"count100")] 0, //[JsonProperty(@"count300")] 100, diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 8ac809e591..e6abdab729 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -126,7 +126,7 @@ namespace osu.Game Beatmap.Value = BeatmapDatabase.GetWorkingBeatmap(s.Beatmap); - menu.Push(new PlayerLoader(new Player { ReplayInputHandler = s.Replay.GetInputHandler() })); + menu.Push(new PlayerLoader(new Player { ReplayInputHandler = s.Replay.CreateInputHandler() })); } protected override void LoadComplete()