mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 07:06:35 +09:00
Update all existing calls to extension method with correct fallback handling
This commit is contained in:
@ -67,7 +67,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
private void regenerateAutoplay()
|
||||
{
|
||||
var autoplayMod = drawableRuleset.Mods.OfType<ModAutoplay>().Single();
|
||||
drawableRuleset.SetReplayScore(autoplayMod.CreateReplayScore(drawableRuleset.Beatmap, drawableRuleset.Mods));
|
||||
drawableRuleset.SetReplayScore(autoplayMod.CreateScoreFromReplayData(drawableRuleset.Beatmap, drawableRuleset.Mods));
|
||||
}
|
||||
|
||||
private void addHitObject(HitObject hitObject)
|
||||
|
31
osu.Game/Rulesets/Mods/ModExtensions.cs
Normal file
31
osu.Game/Rulesets/Mods/ModExtensions.cs
Normal file
@ -0,0 +1,31 @@
|
||||
// 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 System.Collections.Generic;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Scoring;
|
||||
|
||||
namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public static class ModExtensions
|
||||
{
|
||||
public static Score CreateScoreFromReplayData(this ICreateReplayData mod, IBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||
{
|
||||
var replayData = mod.CreateReplayData(beatmap, mods);
|
||||
|
||||
return new Score
|
||||
{
|
||||
Replay = replayData.Replay,
|
||||
ScoreInfo =
|
||||
{
|
||||
User = new APIUser
|
||||
{
|
||||
Id = APIUser.SYSTEM_USER_ID,
|
||||
Username = replayData.User.Username,
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user