2019-09-11 17:12:43 +08:00
|
|
|
// 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.
|
|
|
|
|
2020-07-29 15:25:17 +08:00
|
|
|
using System.Collections.Generic;
|
2020-04-01 18:19:32 +08:00
|
|
|
using System.Linq;
|
2019-09-11 17:12:43 +08:00
|
|
|
using NUnit.Framework;
|
2020-04-01 18:19:32 +08:00
|
|
|
using osu.Framework.Allocation;
|
2019-09-11 17:12:43 +08:00
|
|
|
using osu.Framework.Graphics;
|
2020-04-01 18:19:32 +08:00
|
|
|
using osu.Framework.Graphics.Containers;
|
2020-07-29 15:25:17 +08:00
|
|
|
using osu.Framework.Graphics.Pooling;
|
|
|
|
using osu.Game.Rulesets.Judgements;
|
|
|
|
using osu.Game.Rulesets.Mania.Judgements;
|
2020-12-07 11:32:52 +08:00
|
|
|
using osu.Game.Rulesets.Mania.Skinning.Default;
|
2019-09-11 17:12:43 +08:00
|
|
|
using osu.Game.Rulesets.Mania.UI;
|
2020-07-29 15:25:17 +08:00
|
|
|
using osu.Game.Rulesets.Objects;
|
2019-09-11 17:12:43 +08:00
|
|
|
using osuTK;
|
|
|
|
|
2020-04-01 18:19:32 +08:00
|
|
|
namespace osu.Game.Rulesets.Mania.Tests.Skinning
|
2019-09-11 17:12:43 +08:00
|
|
|
{
|
|
|
|
[TestFixture]
|
2020-04-01 18:19:32 +08:00
|
|
|
public class TestSceneHitExplosion : ManiaSkinnableTestScene
|
2019-09-11 17:12:43 +08:00
|
|
|
{
|
2020-07-29 15:25:17 +08:00
|
|
|
private readonly List<DrawablePool<PoolableHitExplosion>> hitExplosionPools = new List<DrawablePool<PoolableHitExplosion>>();
|
|
|
|
|
2020-04-01 18:19:32 +08:00
|
|
|
public TestSceneHitExplosion()
|
2019-09-11 17:12:43 +08:00
|
|
|
{
|
|
|
|
int runcount = 0;
|
|
|
|
|
|
|
|
AddRepeatStep("explode", () =>
|
|
|
|
{
|
|
|
|
runcount++;
|
|
|
|
|
|
|
|
if (runcount % 15 > 12)
|
|
|
|
return;
|
|
|
|
|
2020-07-29 15:25:17 +08:00
|
|
|
int poolIndex = 0;
|
|
|
|
|
|
|
|
foreach (var c in CreatedDrawables.OfType<Container>())
|
2019-09-11 17:12:43 +08:00
|
|
|
{
|
2020-07-29 15:25:17 +08:00
|
|
|
c.Add(hitExplosionPools[poolIndex].Get(e =>
|
|
|
|
{
|
|
|
|
e.Apply(new JudgementResult(new HitObject(), runcount % 6 == 0 ? new HoldNoteTickJudgement() : new ManiaJudgement()));
|
|
|
|
|
|
|
|
e.Anchor = Anchor.Centre;
|
|
|
|
e.Origin = Anchor.Centre;
|
|
|
|
}));
|
|
|
|
|
|
|
|
poolIndex++;
|
|
|
|
}
|
2019-09-11 17:12:43 +08:00
|
|
|
}, 100);
|
|
|
|
}
|
2020-04-01 18:19:32 +08:00
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
2021-06-02 15:04:53 +08:00
|
|
|
SetContents(_ =>
|
2020-04-01 18:19:32 +08:00
|
|
|
{
|
2020-07-29 15:25:17 +08:00
|
|
|
var pool = new DrawablePool<PoolableHitExplosion>(5);
|
|
|
|
hitExplosionPools.Add(pool);
|
|
|
|
|
|
|
|
return new ColumnTestContainer(0, ManiaAction.Key1)
|
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
RelativePositionAxes = Axes.Y,
|
|
|
|
Y = -0.25f,
|
|
|
|
Size = new Vector2(Column.COLUMN_WIDTH, DefaultNotePiece.NOTE_HEIGHT),
|
|
|
|
Child = pool
|
|
|
|
};
|
2020-04-01 18:19:32 +08:00
|
|
|
});
|
|
|
|
}
|
2019-09-11 17:12:43 +08:00
|
|
|
}
|
|
|
|
}
|