1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-30 01:49:56 +08:00

Expose Mods in DrawableRuleset to avoid using external DI

This commit is contained in:
Dean Herbert
2021-02-11 17:47:29 +09:00
Unverified
parent aaa0362b12
commit f84ea30637
4 changed files with 5 additions and 9 deletions
@@ -62,8 +62,7 @@ namespace osu.Game.Rulesets.Osu.Mods
inputManager.AllowUserCursorMovement = false;
// Generate the replay frames the cursor should follow
var mods = (IReadOnlyList<Mod>)drawableRuleset.Dependencies.Get(typeof(IReadOnlyList<Mod>));
replayFrames = new OsuAutoGenerator(drawableRuleset.Beatmap, mods).Generate().Frames.Cast<OsuReplayFrame>().ToList();
replayFrames = new OsuAutoGenerator(drawableRuleset.Beatmap, drawableRuleset.Mods).Generate().Frames.Cast<OsuReplayFrame>().ToList();
}
}
}
+1 -2
View File
@@ -18,8 +18,7 @@ namespace osu.Game.Rulesets.Mods
{
public virtual void ApplyToDrawableRuleset(DrawableRuleset<T> drawableRuleset)
{
var mods = (IReadOnlyList<Mod>)drawableRuleset.Dependencies.Get(typeof(IReadOnlyList<Mod>));
drawableRuleset.SetReplayScore(CreateReplayScore(drawableRuleset.Beatmap, mods));
drawableRuleset.SetReplayScore(CreateReplayScore(drawableRuleset.Beatmap, drawableRuleset.Mods));
}
}
+1 -3
View File
@@ -1,7 +1,6 @@
// 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.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Rulesets.Objects;
@@ -15,8 +14,7 @@ namespace osu.Game.Rulesets.Mods
{
public virtual void ApplyToDrawableRuleset(DrawableRuleset<T> drawableRuleset)
{
var mods = (IReadOnlyList<Mod>)drawableRuleset.Dependencies.Get(typeof(IReadOnlyList<Mod>));
drawableRuleset.SetReplayScore(CreateReplayScore(drawableRuleset.Beatmap, mods));
drawableRuleset.SetReplayScore(CreateReplayScore(drawableRuleset.Beatmap, drawableRuleset.Mods));
// AlwaysPresent required for hitsounds
drawableRuleset.Playfield.AlwaysPresent = true;
+2 -2
View File
@@ -92,7 +92,7 @@ namespace osu.Game.Rulesets.UI
protected IRulesetConfigManager Config { get; private set; }
[Cached(typeof(IReadOnlyList<Mod>))]
protected override IReadOnlyList<Mod> Mods { get; }
public sealed override IReadOnlyList<Mod> Mods { get; }
private FrameStabilityContainer frameStabilityContainer;
@@ -434,7 +434,7 @@ namespace osu.Game.Rulesets.UI
/// <summary>
/// The mods which are to be applied.
/// </summary>
protected abstract IReadOnlyList<Mod> Mods { get; }
public abstract IReadOnlyList<Mod> Mods { get; }
/// <summary>~
/// The associated ruleset.