1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-06 11:43:22 +08:00

Rename conversion methods for clarity

This commit is contained in:
Dean Herbert 2020-03-25 20:21:34 +09:00
parent 800e395bc8
commit 8a2aac5f83
7 changed files with 12 additions and 12 deletions

View File

@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Catch.Replays
}
}
public void ConvertFrom(LegacyReplayFrame currentFrame, IBeatmap beatmap, ReplayFrame lastFrame = null)
public void FromLegacy(LegacyReplayFrame currentFrame, IBeatmap beatmap, ReplayFrame lastFrame = null)
{
Position = currentFrame.Position.X / CatchPlayfield.BASE_WIDTH;
Dashing = currentFrame.ButtonState == ReplayButtonState.Left1;
@ -57,7 +57,7 @@ namespace osu.Game.Rulesets.Catch.Replays
}
}
public LegacyReplayFrame ConvertTo(IBeatmap beatmap)
public LegacyReplayFrame ToLegacy(IBeatmap beatmap)
{
ReplayButtonState state = ReplayButtonState.None;

View File

@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Mania.Replays
Actions.AddRange(actions);
}
public void ConvertFrom(LegacyReplayFrame legacyFrame, IBeatmap beatmap, ReplayFrame lastFrame = null)
public void FromLegacy(LegacyReplayFrame legacyFrame, IBeatmap beatmap, ReplayFrame lastFrame = null)
{
// We don't need to fully convert, just create the converter
var converter = new ManiaBeatmapConverter(beatmap, new ManiaRuleset());
@ -57,7 +57,7 @@ namespace osu.Game.Rulesets.Mania.Replays
}
}
public LegacyReplayFrame ConvertTo(IBeatmap beatmap)
public LegacyReplayFrame ToLegacy(IBeatmap beatmap)
{
int keys = 0;

View File

@ -26,14 +26,14 @@ namespace osu.Game.Rulesets.Osu.Replays
Actions.AddRange(actions);
}
public void ConvertFrom(LegacyReplayFrame currentFrame, IBeatmap beatmap, ReplayFrame lastFrame = null)
public void FromLegacy(LegacyReplayFrame currentFrame, IBeatmap beatmap, ReplayFrame lastFrame = null)
{
Position = currentFrame.Position;
if (currentFrame.MouseLeft) Actions.Add(OsuAction.LeftButton);
if (currentFrame.MouseRight) Actions.Add(OsuAction.RightButton);
}
public LegacyReplayFrame ConvertTo(IBeatmap beatmap)
public LegacyReplayFrame ToLegacy(IBeatmap beatmap)
{
ReplayButtonState state = ReplayButtonState.None;

View File

@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Taiko.Replays
Actions.AddRange(actions);
}
public void ConvertFrom(LegacyReplayFrame currentFrame, IBeatmap beatmap, ReplayFrame lastFrame = null)
public void FromLegacy(LegacyReplayFrame currentFrame, IBeatmap beatmap, ReplayFrame lastFrame = null)
{
if (currentFrame.MouseRight1) Actions.Add(TaikoAction.LeftRim);
if (currentFrame.MouseRight2) Actions.Add(TaikoAction.RightRim);
@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Taiko.Replays
if (currentFrame.MouseLeft2) Actions.Add(TaikoAction.RightCentre);
}
public LegacyReplayFrame ConvertTo(IBeatmap beatmap)
public LegacyReplayFrame ToLegacy(IBeatmap beatmap)
{
ReplayButtonState state = ReplayButtonState.None;

View File

@ -17,12 +17,12 @@ namespace osu.Game.Rulesets.Replays.Types
/// <param name="currentFrame">The <see cref="LegacyReplayFrame"/> to extract values from.</param>
/// <param name="beatmap">The beatmap.</param>
/// <param name="lastFrame">The last post-conversion <see cref="ReplayFrame"/>, used to fill in missing delta information. May be null.</param>
void ConvertFrom(LegacyReplayFrame currentFrame, IBeatmap beatmap, ReplayFrame lastFrame = null);
void FromLegacy(LegacyReplayFrame currentFrame, IBeatmap beatmap, ReplayFrame lastFrame = null);
/// <summary>
/// Populates this <see cref="ReplayFrame"/> using values from a <see cref="LegacyReplayFrame"/>.
/// </summary>
/// <param name="beatmap">The beatmap.</param>
LegacyReplayFrame ConvertTo(IBeatmap beatmap);
LegacyReplayFrame ToLegacy(IBeatmap beatmap);
}
}

View File

@ -264,7 +264,7 @@ namespace osu.Game.Scoring.Legacy
if (convertible == null)
throw new InvalidOperationException($"Legacy replay cannot be converted for the ruleset: {currentRuleset.Description}");
convertible.ConvertFrom(currentFrame, currentBeatmap, lastFrame);
convertible.FromLegacy(currentFrame, currentBeatmap, lastFrame);
var frame = (ReplayFrame)convertible;
frame.Time = currentFrame.Time;

View File

@ -93,7 +93,7 @@ namespace osu.Game.Scoring.Legacy
{
LegacyReplayFrame lastF = new LegacyReplayFrame(0, 0, 0, ReplayButtonState.None);
foreach (var f in score.Replay.Frames.OfType<IConvertibleReplayFrame>().Select(f => f.ConvertTo(beatmap)))
foreach (var f in score.Replay.Frames.OfType<IConvertibleReplayFrame>().Select(f => f.ToLegacy(beatmap)))
{
replayData.Append(FormattableString.Invariant($"{f.Time - lastF.Time}|{f.MouseX ?? 0}|{f.MouseY ?? 0}|{(int)f.ButtonState},"));
lastF = f;