1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 07:33:20 +08:00

Merge pull request #26336 from bdach/catch-fruit-layering

Fix backwards z-ordering of fruits in juice streams and banana showers
This commit is contained in:
Dean Herbert 2024-01-03 12:56:58 +09:00 committed by GitHub
commit f2e0c87f65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 3 deletions

View File

@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Catch.Tests
Mod = new CatchModHidden(),
PassCondition = () => Player.Results.Count > 0
&& Player.ChildrenOfType<DrawableJuiceStream>().Single().Alpha > 0
&& Player.ChildrenOfType<DrawableFruit>().Last().Alpha > 0
&& Player.ChildrenOfType<DrawableFruit>().First().Alpha > 0
});
}

View File

@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
RelativeSizeAxes = Axes.X;
Origin = Anchor.BottomLeft;
AddInternal(bananaContainer = new Container { RelativeSizeAxes = Axes.Both });
AddInternal(bananaContainer = new NestedFruitContainer { RelativeSizeAxes = Axes.Both });
}
protected override void AddNestedHitObject(DrawableHitObject hitObject)

View File

@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
RelativeSizeAxes = Axes.X;
Origin = Anchor.BottomLeft;
AddInternal(dropletContainer = new Container { RelativeSizeAxes = Axes.Both, });
AddInternal(dropletContainer = new NestedFruitContainer { RelativeSizeAxes = Axes.Both, });
}
protected override void AddNestedHitObject(DrawableHitObject hitObject)

View File

@ -0,0 +1,26 @@
// 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 osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Catch.Objects.Drawables
{
public partial class NestedFruitContainer : Container
{
/// <remarks>
/// This comparison logic is a copy of <see cref="HitObjectContainer"/> comparison logic,
/// which can't be easily extracted to a more common place.
/// </remarks>
/// <seealso cref="HitObjectContainer.Compare"/>
protected override int Compare(Drawable x, Drawable y)
{
if (x is not DrawableCatchHitObject xObj || y is not DrawableCatchHitObject yObj)
return base.Compare(x, y);
int result = yObj.HitObject.StartTime.CompareTo(xObj.HitObject.StartTime);
return result == 0 ? CompareReverseChildID(x, y) : result;
}
}
}