1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 10:33:30 +08:00

Merge pull request #7256 from peppy/remove-ruleset-ctor-param

Remove RulesetInfo parameter from Ruleset constructor
This commit is contained in:
Dean Herbert 2019-12-18 18:42:42 +09:00 committed by GitHub
commit 51a01c7006
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 6 additions and 36 deletions

View File

@ -137,10 +137,5 @@ namespace osu.Game.Rulesets.Catch
public override int? LegacyID => 2; public override int? LegacyID => 2;
public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new CatchReplayFrame(); public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new CatchReplayFrame();
public CatchRuleset(RulesetInfo rulesetInfo = null)
: base(rulesetInfo)
{
}
} }
} }

View File

@ -186,11 +186,6 @@ namespace osu.Game.Rulesets.Mania
public override RulesetSettingsSubsection CreateSettings() => new ManiaSettingsSubsection(this); public override RulesetSettingsSubsection CreateSettings() => new ManiaSettingsSubsection(this);
public ManiaRuleset(RulesetInfo rulesetInfo = null)
: base(rulesetInfo)
{
}
public override IEnumerable<int> AvailableVariants public override IEnumerable<int> AvailableVariants
{ {
get get

View File

@ -183,10 +183,5 @@ namespace osu.Game.Rulesets.Osu
public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new OsuReplayFrame(); public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new OsuReplayFrame();
public override IRulesetConfigManager CreateConfig(SettingsStore settings) => new OsuRulesetConfigManager(settings, RulesetInfo); public override IRulesetConfigManager CreateConfig(SettingsStore settings) => new OsuRulesetConfigManager(settings, RulesetInfo);
public OsuRuleset(RulesetInfo rulesetInfo = null)
: base(rulesetInfo)
{
}
} }
} }

View File

@ -136,10 +136,5 @@ namespace osu.Game.Rulesets.Taiko
public override int? LegacyID => 1; public override int? LegacyID => 1;
public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new TaikoReplayFrame(); public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new TaikoReplayFrame();
public TaikoRuleset(RulesetInfo rulesetInfo = null)
: base(rulesetInfo)
{
}
} }
} }

View File

@ -194,11 +194,6 @@ namespace osu.Game.Tests.Visual.Gameplay
private class TestScrollingRuleset : Ruleset private class TestScrollingRuleset : Ruleset
{ {
public TestScrollingRuleset(RulesetInfo rulesetInfo = null)
: base(rulesetInfo)
{
}
public override IEnumerable<Mod> GetModsFor(ModType type) => throw new NotImplementedException(); public override IEnumerable<Mod> GetModsFor(ModType type) => throw new NotImplementedException();
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => new TestDrawableScrollingRuleset(this, beatmap, mods); public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => new TestDrawableScrollingRuleset(this, beatmap, mods);

View File

@ -51,7 +51,7 @@ namespace osu.Game.Beatmaps
private class DummyRulesetInfo : RulesetInfo private class DummyRulesetInfo : RulesetInfo
{ {
public override Ruleset CreateInstance() => new DummyRuleset(this); public override Ruleset CreateInstance() => new DummyRuleset();
private class DummyRuleset : Ruleset private class DummyRuleset : Ruleset
{ {
@ -70,11 +70,6 @@ namespace osu.Game.Beatmaps
public override string ShortName => "dummy"; public override string ShortName => "dummy";
public DummyRuleset(RulesetInfo rulesetInfo = null)
: base(rulesetInfo)
{
}
private class DummyBeatmapConverter : IBeatmapConverter private class DummyBeatmapConverter : IBeatmapConverter
{ {
public event Action<HitObject, IEnumerable<HitObject>> ObjectConverted; public event Action<HitObject, IEnumerable<HitObject>> ObjectConverted;

View File

@ -49,9 +49,9 @@ namespace osu.Game.Rulesets
public virtual ISkin CreateLegacySkinProvider(ISkinSource source) => null; public virtual ISkin CreateLegacySkinProvider(ISkinSource source) => null;
protected Ruleset(RulesetInfo rulesetInfo = null) protected Ruleset()
{ {
RulesetInfo = rulesetInfo ?? createRulesetInfo(); RulesetInfo = createRulesetInfo();
} }
/// <summary> /// <summary>

View File

@ -24,7 +24,7 @@ namespace osu.Game.Rulesets
{ {
if (!Available) return null; if (!Available) return null;
return (Ruleset)Activator.CreateInstance(Type.GetType(InstantiationInfo), this); return (Ruleset)Activator.CreateInstance(Type.GetType(InstantiationInfo));
} }
public bool Equals(RulesetInfo other) => other != null && ID == other.ID && Available == other.Available && Name == other.Name && InstantiationInfo == other.InstantiationInfo; public bool Equals(RulesetInfo other) => other != null && ID == other.ID && Available == other.Available && Name == other.Name && InstantiationInfo == other.InstantiationInfo;

View File

@ -56,7 +56,7 @@ namespace osu.Game.Rulesets
{ {
var context = usage.Context; var context = usage.Context;
var instances = loadedAssemblies.Values.Select(r => (Ruleset)Activator.CreateInstance(r, (RulesetInfo)null)).ToList(); var instances = loadedAssemblies.Values.Select(r => (Ruleset)Activator.CreateInstance(r)).ToList();
//add all legacy modes in correct order //add all legacy modes in correct order
foreach (var r in instances.Where(r => r.LegacyID != null).OrderBy(r => r.LegacyID)) foreach (var r in instances.Where(r => r.LegacyID != null).OrderBy(r => r.LegacyID))
@ -87,7 +87,7 @@ namespace osu.Game.Rulesets
// this allows for debug builds to successfully load rulesets (even though debug rulesets have a 0.0.0 version). // this allows for debug builds to successfully load rulesets (even though debug rulesets have a 0.0.0 version).
asm.Version = null; asm.Version = null;
return Assembly.Load(asm); return Assembly.Load(asm);
}, null), (RulesetInfo)null)).RulesetInfo; }, null))).RulesetInfo;
r.Name = instanceInfo.Name; r.Name = instanceInfo.Name;
r.ShortName = instanceInfo.ShortName; r.ShortName = instanceInfo.ShortName;