mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 04:02:55 +08:00
CreateReplayFrame -> CreateConvertibleReplayFrame
This commit is contained in:
parent
ab4d7fa46e
commit
c9c65cab53
@ -11,7 +11,7 @@ using System.Collections.Generic;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Game.Rulesets.Catch.Replays;
|
using osu.Game.Rulesets.Catch.Replays;
|
||||||
using osu.Game.Rulesets.Replays;
|
using osu.Game.Rulesets.Replays.Types;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch
|
namespace osu.Game.Rulesets.Catch
|
||||||
{
|
{
|
||||||
@ -103,7 +103,7 @@ namespace osu.Game.Rulesets.Catch
|
|||||||
|
|
||||||
public override int LegacyID => 2;
|
public override int LegacyID => 2;
|
||||||
|
|
||||||
public override ReplayFrame CreateReplayFrame() => new CatchReplayFrame();
|
public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new CatchReplayFrame();
|
||||||
|
|
||||||
public CatchRuleset(RulesetInfo rulesetInfo = null)
|
public CatchRuleset(RulesetInfo rulesetInfo = null)
|
||||||
: base(rulesetInfo)
|
: base(rulesetInfo)
|
||||||
|
@ -13,7 +13,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Mania.Replays;
|
using osu.Game.Rulesets.Mania.Replays;
|
||||||
using osu.Game.Rulesets.Replays;
|
using osu.Game.Rulesets.Replays.Types;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania
|
namespace osu.Game.Rulesets.Mania
|
||||||
{
|
{
|
||||||
@ -116,7 +116,7 @@ namespace osu.Game.Rulesets.Mania
|
|||||||
|
|
||||||
public override int LegacyID => 3;
|
public override int LegacyID => 3;
|
||||||
|
|
||||||
public override ReplayFrame CreateReplayFrame() => new ManiaReplayFrame();
|
public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new ManiaReplayFrame();
|
||||||
|
|
||||||
public ManiaRuleset(RulesetInfo rulesetInfo = null)
|
public ManiaRuleset(RulesetInfo rulesetInfo = null)
|
||||||
: base(rulesetInfo)
|
: base(rulesetInfo)
|
||||||
|
@ -20,7 +20,7 @@ using osu.Game.Rulesets.Edit;
|
|||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Replays;
|
using osu.Game.Rulesets.Osu.Replays;
|
||||||
using osu.Game.Rulesets.Replays;
|
using osu.Game.Rulesets.Replays.Types;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu
|
namespace osu.Game.Rulesets.Osu
|
||||||
{
|
{
|
||||||
@ -147,7 +147,7 @@ namespace osu.Game.Rulesets.Osu
|
|||||||
|
|
||||||
public override int LegacyID => 0;
|
public override int LegacyID => 0;
|
||||||
|
|
||||||
public override ReplayFrame CreateReplayFrame() => new OsuReplayFrame();
|
public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new OsuReplayFrame();
|
||||||
|
|
||||||
public OsuRuleset(RulesetInfo rulesetInfo = null)
|
public OsuRuleset(RulesetInfo rulesetInfo = null)
|
||||||
: base(rulesetInfo)
|
: base(rulesetInfo)
|
||||||
|
@ -10,7 +10,7 @@ using osu.Game.Rulesets.UI;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Game.Rulesets.Replays;
|
using osu.Game.Rulesets.Replays.Types;
|
||||||
using osu.Game.Rulesets.Taiko.Replays;
|
using osu.Game.Rulesets.Taiko.Replays;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko
|
namespace osu.Game.Rulesets.Taiko
|
||||||
@ -105,7 +105,7 @@ namespace osu.Game.Rulesets.Taiko
|
|||||||
|
|
||||||
public override int LegacyID => 1;
|
public override int LegacyID => 1;
|
||||||
|
|
||||||
public override ReplayFrame CreateReplayFrame() => new TaikoReplayFrame();
|
public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new TaikoReplayFrame();
|
||||||
|
|
||||||
public TaikoRuleset(RulesetInfo rulesetInfo = null)
|
public TaikoRuleset(RulesetInfo rulesetInfo = null)
|
||||||
: base(rulesetInfo)
|
: base(rulesetInfo)
|
||||||
|
@ -11,7 +11,7 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Overlays.Settings;
|
using osu.Game.Overlays.Settings;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Replays;
|
using osu.Game.Rulesets.Replays.Types;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ namespace osu.Game.Rulesets
|
|||||||
/// <returns>A descriptive name of the variant.</returns>
|
/// <returns>A descriptive name of the variant.</returns>
|
||||||
public virtual string GetVariantName(int variant) => string.Empty;
|
public virtual string GetVariantName(int variant) => string.Empty;
|
||||||
|
|
||||||
public virtual ReplayFrame CreateReplayFrame() => new ReplayFrame();
|
public virtual IConvertibleReplayFrame CreateConvertibleReplayFrame() => null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a ruleset info based on this ruleset.
|
/// Create a ruleset info based on this ruleset.
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.IO.Legacy;
|
using osu.Game.IO.Legacy;
|
||||||
using osu.Game.Rulesets.Replays;
|
using osu.Game.Rulesets.Replays;
|
||||||
using osu.Game.Rulesets.Replays.Legacy;
|
using osu.Game.Rulesets.Replays.Legacy;
|
||||||
using osu.Game.Rulesets.Replays.Types;
|
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using SharpCompress.Compressors.LZMA;
|
using SharpCompress.Compressors.LZMA;
|
||||||
|
|
||||||
@ -139,13 +139,12 @@ namespace osu.Game.Rulesets.Scoring.Legacy
|
|||||||
|
|
||||||
private ReplayFrame convertFrame(LegacyReplayFrame legacyFrame)
|
private ReplayFrame convertFrame(LegacyReplayFrame legacyFrame)
|
||||||
{
|
{
|
||||||
var converted = currentRuleset.CreateReplayFrame();
|
var convertible = currentRuleset.CreateConvertibleReplayFrame();
|
||||||
converted.Time = legacyFrame.Time;
|
if (convertible == null)
|
||||||
|
throw new InvalidOperationException($"Legacy replay cannot be converted for the ruleset: {currentRuleset.Description}");
|
||||||
|
convertible.ConvertFrom(legacyFrame, currentScore, currentBeatmap);
|
||||||
|
|
||||||
if (converted is IConvertibleReplayFrame convertible)
|
return (ReplayFrame)convertible;
|
||||||
convertible.ConvertFrom(legacyFrame, currentScore, currentBeatmap);
|
|
||||||
|
|
||||||
return converted;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user