2023-06-23 00:37:25 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2019-09-11 17:12:43 +08:00
|
|
|
|
// 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]
|
2022-11-24 13:32:20 +08:00
|
|
|
|
public partial 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
|
|
|
|
{
|
2021-12-10 13:15:00 +08:00
|
|
|
|
int runCount = 0;
|
2019-09-11 17:12:43 +08:00
|
|
|
|
|
|
|
|
|
AddRepeatStep("explode", () =>
|
|
|
|
|
{
|
2021-12-10 13:15:00 +08:00
|
|
|
|
runCount++;
|
2019-09-11 17:12:43 +08:00
|
|
|
|
|
2021-12-10 13:15:00 +08:00
|
|
|
|
if (runCount % 15 > 12)
|
2019-09-11 17:12:43 +08:00
|
|
|
|
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 =>
|
|
|
|
|
{
|
2021-12-10 13:15:00 +08:00
|
|
|
|
e.Apply(new JudgementResult(new HitObject(), runCount % 6 == 0 ? new HoldNoteTickJudgement() : new ManiaJudgement()));
|
2020-07-29 15:25:17 +08:00
|
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
}
|