1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-29 00:22:55 +08:00
osu-lazer/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneHitExplosion.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

76 lines
2.3 KiB
C#
Raw Normal View History

// 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.
2022-06-17 15:37:17 +08:00
#nullable disable
2020-07-29 15:25:17 +08:00
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
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;
using osu.Game.Rulesets.Mania.UI;
2020-07-29 15:25:17 +08:00
using osu.Game.Rulesets.Objects;
using osuTK;
namespace osu.Game.Rulesets.Mania.Tests.Skinning
{
[TestFixture]
public partial class TestSceneHitExplosion : ManiaSkinnableTestScene
{
2020-07-29 15:25:17 +08:00
private readonly List<DrawablePool<PoolableHitExplosion>> hitExplosionPools = new List<DrawablePool<PoolableHitExplosion>>();
public TestSceneHitExplosion()
{
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>())
{
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()));
2020-07-29 15:25:17 +08:00
e.Anchor = Anchor.Centre;
e.Origin = Anchor.Centre;
}));
poolIndex++;
}
}, 100);
}
[BackgroundDependencyLoader]
private void load()
{
SetContents(_ =>
{
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
};
});
}
}
}