Add ruleset API versioning

This commit is contained in:
Dean Herbert 2022-08-22 16:10:55 +09:00
parent 3fb3a18e68
commit f5710d8000
5 changed files with 25 additions and 0 deletions

View File

@ -43,6 +43,8 @@ public class CatchRuleset : Ruleset, ILegacyRuleset
public const string SHORT_NAME = "fruits";
public override string RulesetAPIVersionSupported => "internal";
public override IEnumerable<KeyBinding> GetDefaultKeyBindings(int variant = 0) => new[]
{
new KeyBinding(InputKey.Z, CatchAction.MoveLeft),

View File

@ -60,6 +60,8 @@ public class ManiaRuleset : Ruleset, ILegacyRuleset
public const string SHORT_NAME = "mania";
public override string RulesetAPIVersionSupported => "internal";
public override HitObjectComposer CreateHitObjectComposer() => new ManiaHitObjectComposer(this);
public override ISkin CreateLegacySkinProvider(ISkin skin, IBeatmap beatmap) => new ManiaLegacySkinTransformer(skin, beatmap);

View File

@ -54,6 +54,8 @@ public class OsuRuleset : Ruleset, ILegacyRuleset
public const string SHORT_NAME = "osu";
public override string RulesetAPIVersionSupported => "internal";
public override IEnumerable<KeyBinding> GetDefaultKeyBindings(int variant = 0) => new[]
{
new KeyBinding(InputKey.Z, OsuAction.LeftButton),

View File

@ -49,6 +49,8 @@ public class TaikoRuleset : Ruleset, ILegacyRuleset
public const string SHORT_NAME = "taiko";
public override string RulesetAPIVersionSupported => "internal";
public override IEnumerable<KeyBinding> GetDefaultKeyBindings(int variant = 0) => new[]
{
new KeyBinding(InputKey.MouseLeft, TaikoAction.LeftCentre),

View File

@ -44,6 +44,23 @@ public abstract class Ruleset
private static readonly ConcurrentDictionary<string, IMod[]> mod_reference_cache = new ConcurrentDictionary<string, IMod[]>();
/// <summary>
/// Version history:
/// 2022.205.0 FramedReplayInputHandler.CollectPendingInputs renamed to FramedReplayHandler.CollectReplayInputs.
/// 2022.822.0 All strings return values have been converted to LocalisableString to allow for localisation support.
/// </summary>
public const string CURRENT_RULESET_API_VERSION = "2022.822.0";
/// <summary>
/// Define the ruleset API version supported by this ruleset.
/// Ruleset implementations should be updated to support the latest version to ensure they can still be loaded.
/// </summary>
/// <remarks>
/// When updating a ruleset to support the latest API, you should set this to <see cref="CURRENT_RULESET_API_VERSION"/>.
/// See https://github.com/ppy/osu/wiki/Breaking-Changes for full details on required ongoing changes.
/// </remarks>
public virtual string RulesetAPIVersionSupported => string.Empty;
/// <summary>
/// A queryable source containing all available mods.
/// Call <see cref="IMod.CreateInstance"/> for consumption purposes.