-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #118 from frenzibyte/replay-recorder
Add replay recording support
- Loading branch information
Showing
6 changed files
with
98 additions
and
9 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
osu.Game.Rulesets.Rush.Tests/Replay/RushReplayFrameTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) Shane Woolcock. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using NUnit.Framework; | ||
using osu.Game.Beatmaps; | ||
using osu.Game.Rulesets.Rush.Replays; | ||
|
||
namespace osu.Game.Rulesets.Rush.Tests.Replay | ||
{ | ||
[TestFixture] | ||
public class RushReplayFrameTest | ||
{ | ||
[TestCase] | ||
[TestCase(RushAction.AirPrimary, RushAction.GroundPrimary)] | ||
[TestCase(RushAction.AirPrimary, RushAction.AirSecondary, RushAction.GroundQuaternary)] | ||
[TestCase(RushAction.GroundPrimary, RushAction.GroundSecondary)] | ||
[TestCase(RushAction.AirPrimary, RushAction.AirSecondary, RushAction.AirTertiary, RushAction.AirQuaternary, RushAction.GroundPrimary, RushAction.GroundSecondary, RushAction.GroundTertiary, RushAction.GroundTertiary)] | ||
public void TestParity(params RushAction[] actions) | ||
{ | ||
var originalFrame = (RushReplayFrame)new RushRuleset().CreateConvertibleReplayFrame(); | ||
var resultFrame = (RushReplayFrame)new RushRuleset().CreateConvertibleReplayFrame(); | ||
|
||
resultFrame.FromLegacy(originalFrame.ToLegacy(new Beatmap()), new Beatmap()); | ||
|
||
Assert.That(resultFrame.Actions, Is.EquivalentTo(originalFrame.Actions)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (c) Shane Woolcock. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Collections.Generic; | ||
using osu.Game.Rulesets.Replays; | ||
using osu.Game.Rulesets.Rush.Replays; | ||
using osu.Game.Rulesets.UI; | ||
using osu.Game.Scoring; | ||
using osuTK; | ||
|
||
namespace osu.Game.Rulesets.Rush.UI | ||
{ | ||
public class RushReplayRecorder : ReplayRecorder<RushAction> | ||
{ | ||
public RushReplayRecorder(Score target) | ||
: base(target) | ||
{ | ||
} | ||
|
||
protected override ReplayFrame HandleFrame(Vector2 mousePosition, List<RushAction> actions, ReplayFrame previousFrame) | ||
=> new RushReplayFrame(Time.Current, actions); | ||
} | ||
} |