mirror of
https://github.com/ppy/osu.git
synced 2025-01-08 00:02:54 +08:00
Rename conversion methods for clarity
This commit is contained in:
parent
800e395bc8
commit
8a2aac5f83
@ -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;
|
Position = currentFrame.Position.X / CatchPlayfield.BASE_WIDTH;
|
||||||
Dashing = currentFrame.ButtonState == ReplayButtonState.Left1;
|
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;
|
ReplayButtonState state = ReplayButtonState.None;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Mania.Replays
|
|||||||
Actions.AddRange(actions);
|
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
|
// We don't need to fully convert, just create the converter
|
||||||
var converter = new ManiaBeatmapConverter(beatmap, new ManiaRuleset());
|
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;
|
int keys = 0;
|
||||||
|
|
||||||
|
@ -26,14 +26,14 @@ namespace osu.Game.Rulesets.Osu.Replays
|
|||||||
Actions.AddRange(actions);
|
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;
|
Position = currentFrame.Position;
|
||||||
if (currentFrame.MouseLeft) Actions.Add(OsuAction.LeftButton);
|
if (currentFrame.MouseLeft) Actions.Add(OsuAction.LeftButton);
|
||||||
if (currentFrame.MouseRight) Actions.Add(OsuAction.RightButton);
|
if (currentFrame.MouseRight) Actions.Add(OsuAction.RightButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LegacyReplayFrame ConvertTo(IBeatmap beatmap)
|
public LegacyReplayFrame ToLegacy(IBeatmap beatmap)
|
||||||
{
|
{
|
||||||
ReplayButtonState state = ReplayButtonState.None;
|
ReplayButtonState state = ReplayButtonState.None;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Taiko.Replays
|
|||||||
Actions.AddRange(actions);
|
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.MouseRight1) Actions.Add(TaikoAction.LeftRim);
|
||||||
if (currentFrame.MouseRight2) Actions.Add(TaikoAction.RightRim);
|
if (currentFrame.MouseRight2) Actions.Add(TaikoAction.RightRim);
|
||||||
@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Taiko.Replays
|
|||||||
if (currentFrame.MouseLeft2) Actions.Add(TaikoAction.RightCentre);
|
if (currentFrame.MouseLeft2) Actions.Add(TaikoAction.RightCentre);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LegacyReplayFrame ConvertTo(IBeatmap beatmap)
|
public LegacyReplayFrame ToLegacy(IBeatmap beatmap)
|
||||||
{
|
{
|
||||||
ReplayButtonState state = ReplayButtonState.None;
|
ReplayButtonState state = ReplayButtonState.None;
|
||||||
|
|
||||||
|
@ -17,12 +17,12 @@ namespace osu.Game.Rulesets.Replays.Types
|
|||||||
/// <param name="currentFrame">The <see cref="LegacyReplayFrame"/> to extract values from.</param>
|
/// <param name="currentFrame">The <see cref="LegacyReplayFrame"/> to extract values from.</param>
|
||||||
/// <param name="beatmap">The beatmap.</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>
|
/// <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>
|
/// <summary>
|
||||||
/// Populates this <see cref="ReplayFrame"/> using values from a <see cref="LegacyReplayFrame"/>.
|
/// Populates this <see cref="ReplayFrame"/> using values from a <see cref="LegacyReplayFrame"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="beatmap">The beatmap.</param>
|
/// <param name="beatmap">The beatmap.</param>
|
||||||
LegacyReplayFrame ConvertTo(IBeatmap beatmap);
|
LegacyReplayFrame ToLegacy(IBeatmap beatmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -264,7 +264,7 @@ namespace osu.Game.Scoring.Legacy
|
|||||||
if (convertible == null)
|
if (convertible == null)
|
||||||
throw new InvalidOperationException($"Legacy replay cannot be converted for the ruleset: {currentRuleset.Description}");
|
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;
|
var frame = (ReplayFrame)convertible;
|
||||||
frame.Time = currentFrame.Time;
|
frame.Time = currentFrame.Time;
|
||||||
|
@ -93,7 +93,7 @@ namespace osu.Game.Scoring.Legacy
|
|||||||
{
|
{
|
||||||
LegacyReplayFrame lastF = new LegacyReplayFrame(0, 0, 0, ReplayButtonState.None);
|
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},"));
|
replayData.Append(FormattableString.Invariant($"{f.Time - lastF.Time}|{f.MouseX ?? 0}|{f.MouseY ?? 0}|{(int)f.ButtonState},"));
|
||||||
lastF = f;
|
lastF = f;
|
||||||
|
Loading…
Reference in New Issue
Block a user