1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-23 16:27:20 +08:00

Revert "Add support for custom hyper-dash fruit colouring"

This reverts commit 6f2cc5471adabc4392fcf1f63a5de32266016c10 and also its testing cases.

This became dead code after actual correct osu!catch skin colouring, we don't support modern skinning (non-legacy skinning) at the moment, so for what it's worth this can be reverted to default red-coloured
This commit is contained in:
Salman Ahmed 2020-04-05 00:02:33 +03:00
parent f67a62699b
commit c4f7b45768
2 changed files with 23 additions and 56 deletions

View File

@ -4,15 +4,10 @@
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Testing;
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Catch.Objects;
@ -31,9 +26,8 @@ namespace osu.Game.Rulesets.Catch.Tests
[Resolved]
private SkinManager skins { get; set; }
[TestCase(false)]
[TestCase(true)]
public void TestHyperDashFruitColour(bool legacyFruit)
[Test]
public void TestHyperDashFruitColour()
{
DrawableFruit drawableFruit = null;
@ -47,20 +41,15 @@ namespace osu.Game.Rulesets.Catch.Tests
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(4f),
}, false, false, false, legacyFruit);
}, false, false, false);
});
AddAssert("hyper-dash fruit has default colour", () =>
legacyFruit
? checkLegacyFruitHyperDashColour(drawableFruit, Catcher.DefaultHyperDashColour)
: checkFruitHyperDashColour(drawableFruit, Catcher.DefaultHyperDashColour));
AddAssert("hyper-dash fruit has default colour", () => checkLegacyFruitHyperDashColour(drawableFruit, Catcher.DefaultHyperDashColour));
}
[TestCase(false, true)]
[TestCase(false, false)]
[TestCase(true, true)]
[TestCase(true, false)]
public void TestCustomHyperDashFruitColour(bool legacyFruit, bool customCatcherHyperDashColour)
[TestCase(true)]
[TestCase(false)]
public void TestCustomHyperDashFruitColour(bool customCatcherHyperDashColour)
{
DrawableFruit drawableFruit = null;
@ -74,18 +63,14 @@ namespace osu.Game.Rulesets.Catch.Tests
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(4f),
}, customCatcherHyperDashColour, false, true, legacyFruit);
}, customCatcherHyperDashColour, false, true);
});
AddAssert("hyper-dash fruit use fruit colour from skin", () =>
legacyFruit
? checkLegacyFruitHyperDashColour(drawableFruit, TestSkin.CustomHyperDashFruitColour)
: checkFruitHyperDashColour(drawableFruit, TestSkin.CustomHyperDashFruitColour));
AddAssert("hyper-dash fruit use fruit colour from skin", () => checkLegacyFruitHyperDashColour(drawableFruit, TestSkin.CustomHyperDashFruitColour));
}
[TestCase(false)]
[TestCase(true)]
public void TestCustomHyperDashFruitColourFallback(bool legacyFruit)
[Test]
public void TestCustomHyperDashFruitColourFallback()
{
DrawableFruit drawableFruit = null;
@ -100,36 +85,24 @@ namespace osu.Game.Rulesets.Catch.Tests
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(4f),
}, true, false, false, legacyFruit);
}, true, false, false);
});
AddAssert("hyper-dash fruit colour falls back to catcher colour from skin", () =>
legacyFruit
? checkLegacyFruitHyperDashColour(drawableFruit, TestSkin.CustomHyperDashColour)
: checkFruitHyperDashColour(drawableFruit, TestSkin.CustomHyperDashColour));
AddAssert("hyper-dash fruit colour falls back to catcher colour from skin", () => checkLegacyFruitHyperDashColour(drawableFruit, TestSkin.CustomHyperDashColour));
}
private Drawable setupSkinHierarchy(Drawable child, bool customCatcherColour, bool customAfterColour, bool customFruitColour, bool legacySkin = true)
private Drawable setupSkinHierarchy(Drawable child, bool customCatcherColour, bool customAfterColour, bool customFruitColour)
{
var legacySkinProvider = new SkinProvidingContainer(skins.GetSkin(DefaultLegacySkin.Info));
var testSkinProvider = new SkinProvidingContainer(new TestSkin(customCatcherColour, customAfterColour, customFruitColour));
var legacySkinTransformer = new SkinProvidingContainer(new CatchLegacySkinTransformer(testSkinProvider));
if (legacySkin)
{
var legacySkinProvider = new SkinProvidingContainer(skins.GetSkin(DefaultLegacySkin.Info));
var legacySkinTransformer = new SkinProvidingContainer(new CatchLegacySkinTransformer(testSkinProvider));
return legacySkinProvider
.WithChild(testSkinProvider
.WithChild(legacySkinTransformer
.WithChild(child)));
}
return testSkinProvider.WithChild(child);
return legacySkinProvider
.WithChild(testSkinProvider
.WithChild(legacySkinTransformer
.WithChild(child)));
}
private bool checkFruitHyperDashColour(DrawableFruit fruit, Color4 expectedColour) =>
fruit.ChildrenOfType<SkinnableDrawable>().First().Drawable.ChildrenOfType<Circle>().Single(c => c.BorderColour == expectedColour).Any(d => d.Colour == expectedColour);
private bool checkLegacyFruitHyperDashColour(DrawableFruit fruit, Color4 expectedColour) =>
fruit.ChildrenOfType<SkinnableDrawable>().First().Drawable.ChildrenOfType<Sprite>().Any(c => c.Colour == expectedColour);

View File

@ -7,10 +7,8 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Catch.Skinning;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Skinning;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Catch.Objects.Drawables
@ -34,7 +32,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
}
[BackgroundDependencyLoader]
private void load(DrawableHitObject drawableObject, ISkinSource skin)
private void load(DrawableHitObject drawableObject)
{
DrawableCatchHitObject drawableCatchObject = (DrawableCatchHitObject)drawableObject;
hitObject = drawableCatchObject.HitObject;
@ -63,10 +61,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
},
});
var hyperDashColour =
skin.GetHyperDashFruitColour()?.Value ??
Catcher.DefaultHyperDashColour;
if (hitObject.HyperDash)
{
AddInternal(new Circle
@ -74,7 +68,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
BorderColour = hyperDashColour,
BorderColour = Catcher.DefaultHyperDashColour,
BorderThickness = 12f * RADIUS_ADJUST,
Children = new Drawable[]
{
@ -84,7 +78,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
Alpha = 0.3f,
Blending = BlendingParameters.Additive,
RelativeSizeAxes = Axes.Both,
Colour = hyperDashColour,
Colour = Catcher.DefaultHyperDashColour,
}
}
});