mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 15:03:13 +08:00
Make TestSceneFruitObjects show correct color
This commit is contained in:
parent
35cd6674f6
commit
7ce752391d
@ -1,7 +1,6 @@
|
||||
// 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 System;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Catch.Objects;
|
||||
@ -17,33 +16,48 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
foreach (FruitVisualRepresentation rep in Enum.GetValues(typeof(FruitVisualRepresentation)))
|
||||
AddStep($"show {rep}", () => SetContents(() => createDrawableFruit(rep)));
|
||||
AddStep("show pear", () => SetContents(() => createDrawableFruit(0)));
|
||||
AddStep("show grape", () => SetContents(() => createDrawableFruit(1)));
|
||||
AddStep("show pineapple / apple", () => SetContents(() => createDrawableFruit(2)));
|
||||
AddStep("show raspberry / orange", () => SetContents(() => createDrawableFruit(3)));
|
||||
|
||||
AddStep("show banana", () => SetContents(createDrawableBanana));
|
||||
|
||||
AddStep("show droplet", () => SetContents(() => createDrawableDroplet()));
|
||||
AddStep("show tiny droplet", () => SetContents(createDrawableTinyDroplet));
|
||||
|
||||
foreach (FruitVisualRepresentation rep in Enum.GetValues(typeof(FruitVisualRepresentation)))
|
||||
AddStep($"show hyperdash {rep}", () => SetContents(() => createDrawableFruit(rep, true)));
|
||||
AddStep("show hyperdash pear", () => SetContents(() => createDrawableFruit(0, true)));
|
||||
AddStep("show hyperdash grape", () => SetContents(() => createDrawableFruit(1, true)));
|
||||
AddStep("show hyperdash pineapple / apple", () => SetContents(() => createDrawableFruit(2, true)));
|
||||
AddStep("show hyperdash raspberry / orange", () => SetContents(() => createDrawableFruit(3, true)));
|
||||
|
||||
AddStep("show hyperdash droplet", () => SetContents(() => createDrawableDroplet(true)));
|
||||
}
|
||||
|
||||
private Drawable createDrawableFruit(FruitVisualRepresentation rep, bool hyperdash = false) =>
|
||||
SetProperties(new TestDrawableFruit(new Fruit(), rep), hyperdash);
|
||||
private Drawable createDrawableFruit(int indexInBeatmap, bool hyperdash = false) =>
|
||||
SetProperties(new DrawableFruit(new Fruit
|
||||
{
|
||||
IndexInBeatmap = indexInBeatmap,
|
||||
HyperDashBindable = { Value = hyperdash }
|
||||
}));
|
||||
|
||||
private Drawable createDrawableDroplet(bool hyperdash = false) => SetProperties(new DrawableDroplet(new Droplet()), hyperdash);
|
||||
private Drawable createDrawableBanana() =>
|
||||
SetProperties(new DrawableBanana(new Banana()));
|
||||
|
||||
private Drawable createDrawableDroplet(bool hyperdash = false) =>
|
||||
SetProperties(new DrawableDroplet(new Droplet
|
||||
{
|
||||
HyperDashBindable = { Value = hyperdash }
|
||||
}));
|
||||
|
||||
private Drawable createDrawableTinyDroplet() => SetProperties(new DrawableTinyDroplet(new TinyDroplet()));
|
||||
|
||||
protected virtual DrawableCatchHitObject SetProperties(DrawableCatchHitObject d, bool hyperdash = false)
|
||||
protected virtual DrawableCatchHitObject SetProperties(DrawableCatchHitObject d)
|
||||
{
|
||||
var hitObject = d.HitObject;
|
||||
hitObject.StartTime = 1000000000000;
|
||||
hitObject.Scale = 1.5f;
|
||||
|
||||
if (hyperdash)
|
||||
((PalpableCatchHitObject)hitObject).HyperDashTarget = new Banana();
|
||||
hitObject.Samples.Clear(); // otherwise crash due to samples not loaded
|
||||
|
||||
d.Anchor = Anchor.Centre;
|
||||
d.RelativePositionAxes = Axes.None;
|
||||
@ -55,18 +69,5 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
};
|
||||
return d;
|
||||
}
|
||||
|
||||
public class TestDrawableFruit : DrawableFruit
|
||||
{
|
||||
private readonly FruitVisualRepresentation visualRepresentation;
|
||||
|
||||
protected override FruitVisualRepresentation GetVisualRepresentation(int indexInBeatmap) => visualRepresentation;
|
||||
|
||||
public TestDrawableFruit(Fruit fruit, FruitVisualRepresentation rep)
|
||||
: base(fruit)
|
||||
{
|
||||
visualRepresentation = rep;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user