1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-18 10:43:22 +08:00

Fix failing tests

- Caches `DrawableRuleset` in editor compose screen for mania playfield adjustment container (because it's used to wrap the blueprint container as well)
- Fixes `ManiaModWithPlayfieldCover` performing a no-longer-correct direct cast with a naive-but-working approach.
This commit is contained in:
Salman Alshamrani 2025-01-12 22:56:28 -05:00
parent f718696102
commit c1ac27d658
6 changed files with 27 additions and 15 deletions

View File

@ -5,9 +5,9 @@ using System;
using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Mania.UI.Components;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI;
@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Mania.Mods
foreach (Column column in maniaPlayfield.Stages.SelectMany(stage => stage.Columns))
{
HitObjectContainer hoc = column.HitObjectContainer;
Container hocParent = (Container)hoc.Parent!;
ColumnHitObjectArea hocParent = (ColumnHitObjectArea)hoc.Parent!;
hocParent.Remove(hoc, false);
hocParent.Add(CreateCover(hoc).With(c =>

View File

@ -19,6 +19,16 @@ namespace osu.Game.Rulesets.Mania.UI.Components
InternalChild = child;
}
internal void Add(Drawable drawable)
{
base.AddInternal(drawable);
}
internal void Remove(Drawable drawable, bool disposeImmediately = true)
{
base.RemoveInternal(drawable, disposeImmediately);
}
[BackgroundDependencyLoader]
private void load(IScrollingInfo scrollingInfo)
{

View File

@ -32,7 +32,6 @@ using osu.Game.Skinning;
namespace osu.Game.Rulesets.Mania.UI
{
[Cached(typeof(DrawableManiaRuleset))]
public partial class DrawableManiaRuleset : DrawableScrollingRuleset<ManiaHitObject>
{
/// <summary>

View File

@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Mania.UI
}
[Resolved]
private DrawableManiaRuleset drawableManiaRuleset { get; set; } = null!;
private DrawableRuleset drawableRuleset { get; set; } = null!;
protected override void Update()
{
@ -40,6 +40,8 @@ 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,

View File

@ -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;
private readonly DrawableRuleset<TObject> drawableRuleset;
public readonly DrawableRuleset<TObject> DrawableRuleset;
[Resolved]
private EditorBeatmap beatmap { get; set; } = null!;
public DrawableEditorRulesetWrapper(DrawableRuleset<TObject> drawableRuleset)
{
this.drawableRuleset = drawableRuleset;
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)
{

View File

@ -132,6 +132,7 @@ namespace osu.Game.Rulesets.Edit
if (DrawableRuleset is IDrawableScrollingRuleset scrollingRuleset)
dependencies.CacheAs(scrollingRuleset.ScrollingInfo);
dependencies.CacheAs<DrawableRuleset>(drawableRulesetWrapper.DrawableRuleset);
dependencies.CacheAs(Playfield);
InternalChildren = new[]