mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Split out ruleset lookup code
This commit is contained in:
@ -75,14 +75,7 @@ namespace osu.Desktop.LegacyIpc
|
|||||||
case LegacyIpcDifficultyCalculationRequest req:
|
case LegacyIpcDifficultyCalculationRequest req:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Ruleset ruleset = req.RulesetId switch
|
var ruleset = getLegacyRulesetFromID(req.RulesetId);
|
||||||
{
|
|
||||||
0 => new OsuRuleset(),
|
|
||||||
1 => new TaikoRuleset(),
|
|
||||||
2 => new CatchRuleset(),
|
|
||||||
3 => new ManiaRuleset(),
|
|
||||||
_ => throw new ArgumentException("Invalid ruleset id")
|
|
||||||
};
|
|
||||||
|
|
||||||
Mod[] mods = ruleset.ConvertFromLegacyMods((LegacyMods)req.Mods).ToArray();
|
Mod[] mods = ruleset.ConvertFromLegacyMods((LegacyMods)req.Mods).ToArray();
|
||||||
WorkingBeatmap beatmap = new FlatFileWorkingBeatmap(req.BeatmapFile, _ => ruleset);
|
WorkingBeatmap beatmap = new FlatFileWorkingBeatmap(req.BeatmapFile, _ => ruleset);
|
||||||
@ -101,5 +94,26 @@ namespace osu.Desktop.LegacyIpc
|
|||||||
Console.WriteLine("Type not matched.");
|
Console.WriteLine("Type not matched.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Ruleset getLegacyRulesetFromID(int rulesetId)
|
||||||
|
{
|
||||||
|
switch (rulesetId)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return new OsuRuleset();
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
return new TaikoRuleset();
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
return new CatchRuleset();
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
return new ManiaRuleset();
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new ArgumentException("Invalid ruleset id");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user