Move Ruleset method to ILegacyRuleset interface

This commit is contained in:
Dan Balasescu 2023-06-29 17:24:37 +09:00
parent 6822871dab
commit c6ad184d94
7 changed files with 17 additions and 5 deletions

View File

@ -202,6 +202,8 @@ public override LocalisableString GetDisplayNameForHitResult(HitResult result)
public int LegacyID => 2;
public ILegacyScoreProcessor CreateLegacyScoreProcessor() => new CatchLegacyScoreProcessor();
public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new CatchReplayFrame();
public override HitObjectComposer CreateHitObjectComposer() => new CatchHitObjectComposer(this);

View File

@ -302,6 +302,8 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
public int LegacyID => 3;
public ILegacyScoreProcessor CreateLegacyScoreProcessor() => new ManiaLegacyScoreProcessor();
public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new ManiaReplayFrame();
public override IRulesetConfigManager CreateConfig(SettingsStore? settings) => new ManiaRulesetConfigManager(settings, RulesetInfo);

View File

@ -253,6 +253,8 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
public int LegacyID => 0;
public ILegacyScoreProcessor CreateLegacyScoreProcessor() => new OsuLegacyScoreProcessor();
public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new OsuReplayFrame();
public override IRulesetConfigManager CreateConfig(SettingsStore? settings) => new OsuRulesetConfigManager(settings, RulesetInfo);
@ -322,7 +324,5 @@ public override StatisticItem[] CreateStatisticsForScore(ScoreInfo score, IBeatm
}
public override RulesetSetupSection CreateEditorSetupSection() => new OsuSetupSection();
public override ILegacyScoreProcessor CreateLegacyScoreProcessor() => new OsuLegacyScoreProcessor();
}
}

View File

@ -197,6 +197,8 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
public int LegacyID => 1;
public ILegacyScoreProcessor CreateLegacyScoreProcessor() => new TaikoLegacyScoreProcessor();
public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new TaikoReplayFrame();
public override IRulesetConfigManager CreateConfig(SettingsStore? settings) => new TaikoRulesetConfigManager(settings, RulesetInfo);

View File

@ -6,6 +6,7 @@
using System.Diagnostics;
using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects;
@ -201,7 +202,10 @@ public static long ConvertFromLegacyTotalScore(ScoreInfo score, BeatmapManager b
var beatmap = beatmaps.GetWorkingBeatmap(score.BeatmapInfo);
var ruleset = score.Ruleset.CreateInstance();
var sv1Processor = ruleset.CreateLegacyScoreProcessor();
if (ruleset is not ILegacyRuleset legacyRuleset)
return score.TotalScore;
var sv1Processor = legacyRuleset.CreateLegacyScoreProcessor();
if (sv1Processor == null)
return score.TotalScore;

View File

@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets
{
public interface ILegacyRuleset
@ -11,5 +13,7 @@ public interface ILegacyRuleset
/// Identifies the server-side ID of a legacy ruleset.
/// </summary>
int LegacyID { get; }
ILegacyScoreProcessor CreateLegacyScoreProcessor();
}
}

View File

@ -380,7 +380,5 @@ protected Ruleset()
/// Can be overridden to add a ruleset-specific section to the editor beatmap setup screen.
/// </summary>
public virtual RulesetSetupSection? CreateEditorSetupSection() => null;
public virtual ILegacyScoreProcessor? CreateLegacyScoreProcessor() => null;
}
}