Merge branch 'master' into taiko_hit_drawables

This commit is contained in:
Dean Herbert 2017-03-25 20:23:33 +09:00 committed by GitHub
commit 73d2f91086
7 changed files with 19 additions and 11 deletions

View File

@ -29,7 +29,7 @@ namespace osu.Game.Modes.Osu
createAutoReplay(); createAutoReplay();
} }
internal class LegacyReplayFrameComparer : IComparer<LegacyReplayFrame> private class LegacyReplayFrameComparer : IComparer<LegacyReplayFrame>
{ {
public int Compare(LegacyReplayFrame f1, LegacyReplayFrame f2) public int Compare(LegacyReplayFrame f1, LegacyReplayFrame f2)
{ {

View File

@ -101,7 +101,7 @@ namespace osu.Game.Database
using (var lzma = new LzmaStream(properties, replayInStream, compressedSize, outSize)) using (var lzma = new LzmaStream(properties, replayInStream, compressedSize, outSize))
using (var reader = new StreamReader(lzma)) using (var reader = new StreamReader(lzma))
score.Replay = new LegacyReplay(reader); score.Replay = score.CreateLegacyReplayFrom(reader);
} }
} }

View File

@ -46,13 +46,13 @@ namespace osu.Game.Modes
} }
} }
public override ReplayInputHandler GetInputHandler() => new LegacyReplayInputHandler(Frames); public override ReplayInputHandler CreateInputHandler() => new LegacyReplayInputHandler(Frames);
/// <summary> /// <summary>
/// The ReplayHandler will take a replay and handle the propagation of updates to the input stack. /// 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. /// It handles logic of any frames which *must* be executed.
/// </summary> /// </summary>
public class LegacyReplayInputHandler : ReplayInputHandler protected class LegacyReplayInputHandler : ReplayInputHandler
{ {
private readonly List<LegacyReplayFrame> replayContent; private readonly List<LegacyReplayFrame> replayContent;
@ -163,7 +163,7 @@ namespace osu.Game.Modes
return currentTime = time; return currentTime = time;
} }
private class ReplayMouseState : MouseState protected class ReplayMouseState : MouseState
{ {
public ReplayMouseState(Vector2 position, IEnumerable<MouseButton> list) public ReplayMouseState(Vector2 position, IEnumerable<MouseButton> list)
{ {
@ -172,7 +172,7 @@ namespace osu.Game.Modes
} }
} }
private class ReplayKeyboardState : KeyboardState protected class ReplayKeyboardState : KeyboardState
{ {
public ReplayKeyboardState(List<Key> keys) public ReplayKeyboardState(List<Key> keys)
{ {
@ -182,7 +182,7 @@ namespace osu.Game.Modes
} }
[Flags] [Flags]
public enum LegacyButtonState protected enum LegacyButtonState
{ {
None = 0, None = 0,
Left1 = 1, Left1 = 1,
@ -192,7 +192,7 @@ namespace osu.Game.Modes
Smoke = 16 Smoke = 16
} }
public class LegacyReplayFrame protected class LegacyReplayFrame
{ {
public Vector2 Position => new Vector2(MouseX, MouseY); public Vector2 Position => new Vector2(MouseX, MouseY);

View File

@ -157,7 +157,7 @@ namespace osu.Game.Modes.Mods
public void Apply(HitRenderer<T> hitRenderer) public void Apply(HitRenderer<T> hitRenderer)
{ {
hitRenderer.InputManager.ReplayInputHandler = CreateReplayScore(hitRenderer.Beatmap)?.Replay?.GetInputHandler(); hitRenderer.InputManager.ReplayInputHandler = CreateReplayScore(hitRenderer.Beatmap)?.Replay?.CreateInputHandler();
} }
} }

View File

@ -7,6 +7,6 @@ namespace osu.Game.Modes
{ {
public abstract class Replay public abstract class Replay
{ {
public virtual ReplayInputHandler GetInputHandler() => null; public virtual ReplayInputHandler CreateInputHandler() => null;
} }
} }

View File

@ -6,6 +6,7 @@ using Newtonsoft.Json;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.Modes.Mods; using osu.Game.Modes.Mods;
using osu.Game.Users; using osu.Game.Users;
using System.IO;
namespace osu.Game.Modes.Scoring namespace osu.Game.Modes.Scoring
{ {
@ -43,6 +44,13 @@ namespace osu.Game.Modes.Scoring
[JsonProperty(@"date")] [JsonProperty(@"date")]
public DateTime Date; public DateTime Date;
/// <summary>
/// Creates a legacy replay which is read from a stream.
/// </summary>
/// <param name="reader">The stream reader.</param>
/// <returns>The replay.</returns>
public virtual Replay CreateLegacyReplayFrom(StreamReader reader) => new LegacyReplay(reader);
// [JsonProperty(@"count50")] 0, // [JsonProperty(@"count50")] 0,
//[JsonProperty(@"count100")] 0, //[JsonProperty(@"count100")] 0,
//[JsonProperty(@"count300")] 100, //[JsonProperty(@"count300")] 100,

View File

@ -126,7 +126,7 @@ namespace osu.Game
Beatmap.Value = BeatmapDatabase.GetWorkingBeatmap(s.Beatmap); 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() protected override void LoadComplete()