mirror of
https://github.com/ppy/osu.git
synced 2025-02-07 17:13:24 +08:00
Avoid extra unnecessary DI
Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
parent
8151c3095d
commit
ffc37cece0
@ -161,7 +161,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
/// <returns>The scroll time.</returns>
|
||||
public static double ComputeScrollTime(double scrollSpeed) => MAX_TIME_RANGE / scrollSpeed;
|
||||
|
||||
public override PlayfieldAdjustmentContainer CreatePlayfieldAdjustmentContainer() => new ManiaPlayfieldAdjustmentContainer();
|
||||
public override PlayfieldAdjustmentContainer CreatePlayfieldAdjustmentContainer() => new ManiaPlayfieldAdjustmentContainer(this);
|
||||
|
||||
protected override Playfield CreatePlayfield() => new ManiaPlayfield(Beatmap.Stages);
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Rulesets.UI;
|
||||
@ -16,8 +15,11 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
|
||||
private readonly DrawSizePreservingFillContainer scalingContainer;
|
||||
|
||||
public ManiaPlayfieldAdjustmentContainer()
|
||||
private readonly DrawableManiaRuleset drawableManiaRuleset;
|
||||
|
||||
public ManiaPlayfieldAdjustmentContainer(DrawableManiaRuleset drawableManiaRuleset)
|
||||
{
|
||||
this.drawableManiaRuleset = drawableManiaRuleset;
|
||||
InternalChild = scalingContainer = new DrawSizePreservingFillContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
@ -30,9 +32,6 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
};
|
||||
}
|
||||
|
||||
[Resolved]
|
||||
private DrawableRuleset drawableRuleset { get; set; } = null!;
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
@ -40,8 +39,6 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
float aspectRatio = DrawWidth / DrawHeight;
|
||||
bool isPortrait = aspectRatio < 1f;
|
||||
|
||||
var drawableManiaRuleset = (DrawableManiaRuleset)drawableRuleset;
|
||||
|
||||
if (isPortrait && drawableManiaRuleset.Beatmap.Stages.Count == 1)
|
||||
{
|
||||
// Scale playfield up by 25% to become playable on mobile devices,
|
||||
|
@ -19,16 +19,16 @@ namespace osu.Game.Rulesets.Edit
|
||||
internal partial class DrawableEditorRulesetWrapper<TObject> : CompositeDrawable
|
||||
where TObject : HitObject
|
||||
{
|
||||
public Playfield Playfield => DrawableRuleset.Playfield;
|
||||
public Playfield Playfield => drawableRuleset.Playfield;
|
||||
|
||||
public readonly DrawableRuleset<TObject> DrawableRuleset;
|
||||
private readonly DrawableRuleset<TObject> drawableRuleset;
|
||||
|
||||
[Resolved]
|
||||
private EditorBeatmap beatmap { get; set; } = null!;
|
||||
|
||||
public DrawableEditorRulesetWrapper(DrawableRuleset<TObject> drawableRuleset)
|
||||
{
|
||||
DrawableRuleset = drawableRuleset;
|
||||
this.drawableRuleset = drawableRuleset;
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
DrawableRuleset.FrameStablePlayback = false;
|
||||
drawableRuleset.FrameStablePlayback = false;
|
||||
Playfield.DisplayJudgements.Value = false;
|
||||
}
|
||||
|
||||
@ -67,27 +67,27 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
private void regenerateAutoplay()
|
||||
{
|
||||
var autoplayMod = DrawableRuleset.Mods.OfType<ModAutoplay>().Single();
|
||||
DrawableRuleset.SetReplayScore(autoplayMod.CreateScoreFromReplayData(DrawableRuleset.Beatmap, DrawableRuleset.Mods));
|
||||
var autoplayMod = drawableRuleset.Mods.OfType<ModAutoplay>().Single();
|
||||
drawableRuleset.SetReplayScore(autoplayMod.CreateScoreFromReplayData(drawableRuleset.Beatmap, drawableRuleset.Mods));
|
||||
}
|
||||
|
||||
private void addHitObject(HitObject hitObject)
|
||||
{
|
||||
DrawableRuleset.AddHitObject((TObject)hitObject);
|
||||
DrawableRuleset.Playfield.PostProcess();
|
||||
drawableRuleset.AddHitObject((TObject)hitObject);
|
||||
drawableRuleset.Playfield.PostProcess();
|
||||
}
|
||||
|
||||
private void removeHitObject(HitObject hitObject)
|
||||
{
|
||||
DrawableRuleset.RemoveHitObject((TObject)hitObject);
|
||||
DrawableRuleset.Playfield.PostProcess();
|
||||
drawableRuleset.RemoveHitObject((TObject)hitObject);
|
||||
drawableRuleset.Playfield.PostProcess();
|
||||
}
|
||||
|
||||
public override bool PropagatePositionalInputSubTree => false;
|
||||
|
||||
public override bool PropagateNonPositionalInputSubTree => false;
|
||||
|
||||
public PlayfieldAdjustmentContainer CreatePlayfieldAdjustmentContainer() => DrawableRuleset.CreatePlayfieldAdjustmentContainer();
|
||||
public PlayfieldAdjustmentContainer CreatePlayfieldAdjustmentContainer() => drawableRuleset.CreatePlayfieldAdjustmentContainer();
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
|
@ -133,7 +133,6 @@ namespace osu.Game.Rulesets.Edit
|
||||
if (DrawableRuleset is IDrawableScrollingRuleset scrollingRuleset)
|
||||
dependencies.CacheAs(scrollingRuleset.ScrollingInfo);
|
||||
|
||||
dependencies.CacheAs<DrawableRuleset>(drawableRulesetWrapper.DrawableRuleset);
|
||||
dependencies.CacheAs(Playfield);
|
||||
|
||||
InternalChildren = new[]
|
||||
|
Loading…
Reference in New Issue
Block a user