mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:07:52 +08:00
Cache mods as array in DrawableRuleset
This commit is contained in:
parent
85d3ff4846
commit
7845d542e3
@ -81,9 +81,8 @@ namespace osu.Game.Rulesets.UI
|
||||
/// <summary>
|
||||
/// The mods which are to be applied.
|
||||
/// </summary>
|
||||
[Cached]
|
||||
[Cached(typeof(IBindable<IEnumerable<Mod>>))]
|
||||
private readonly Bindable<IEnumerable<Mod>> mods = new Bindable<IEnumerable<Mod>>();
|
||||
[Cached(typeof(IReadOnlyList<Mod>))]
|
||||
private readonly IReadOnlyList<Mod> mods;
|
||||
|
||||
private FrameStabilityContainer frameStabilityContainer;
|
||||
|
||||
@ -100,7 +99,7 @@ namespace osu.Game.Rulesets.UI
|
||||
if (workingBeatmap == null)
|
||||
throw new ArgumentException("Beatmap cannot be null.", nameof(workingBeatmap));
|
||||
|
||||
this.mods.Value = mods;
|
||||
this.mods = mods.ToArray();
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
@ -160,7 +159,7 @@ namespace osu.Game.Rulesets.UI
|
||||
.WithChild(ResumeOverlay)));
|
||||
}
|
||||
|
||||
applyRulesetMods(mods.Value, config);
|
||||
applyRulesetMods(mods, config);
|
||||
|
||||
loadObjects();
|
||||
}
|
||||
@ -175,7 +174,7 @@ namespace osu.Game.Rulesets.UI
|
||||
|
||||
Playfield.PostProcess();
|
||||
|
||||
foreach (var mod in mods.Value.OfType<IApplicableToDrawableHitObjects>())
|
||||
foreach (var mod in mods.OfType<IApplicableToDrawableHitObjects>())
|
||||
mod.ApplyToDrawableHitObjects(Playfield.HitObjectContainer.Objects);
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.UI
|
||||
private IBindable<WorkingBeatmap> beatmap { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private IBindable<IEnumerable<Mod>> mods { get; set; }
|
||||
private IReadOnlyList<Mod> mods { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
@ -125,7 +125,7 @@ namespace osu.Game.Rulesets.UI
|
||||
base.Update();
|
||||
|
||||
if (beatmap != null)
|
||||
foreach (var mod in mods.Value)
|
||||
foreach (var mod in mods)
|
||||
if (mod is IUpdatableByPlayfield updatable)
|
||||
updatable.Update(this);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user