2020-04-02 09:39:49 +00: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.
|
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using NUnit.Framework;
|
2023-12-30 02:21:10 +00:00
|
|
|
|
using osu.Framework.Allocation;
|
2020-04-02 09:39:49 +00:00
|
|
|
|
using osu.Game.Beatmaps;
|
2023-12-30 02:21:10 +00:00
|
|
|
|
using osu.Game.Rulesets.Judgements;
|
2020-04-02 09:39:49 +00:00
|
|
|
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
|
|
|
|
using osu.Game.Rulesets.Mania.UI;
|
2023-12-30 02:21:10 +00:00
|
|
|
|
using osu.Game.Rulesets.Objects;
|
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
2023-06-17 08:25:09 +00:00
|
|
|
|
using osuTK;
|
2020-04-02 09:39:49 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Tests.Skinning
|
|
|
|
|
{
|
|
|
|
|
public partial class TestScenePlayfield : ManiaSkinnableTestScene
|
|
|
|
|
{
|
2023-12-30 02:21:10 +00:00
|
|
|
|
[Cached]
|
|
|
|
|
private ScoreProcessor scoreProcessor = new ScoreProcessor(new ManiaRuleset());
|
|
|
|
|
|
2020-04-02 09:39:49 +00:00
|
|
|
|
private List<StageDefinition> stageDefinitions = new List<StageDefinition>();
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestSingleStage()
|
|
|
|
|
{
|
|
|
|
|
AddStep("create stage", () =>
|
|
|
|
|
{
|
|
|
|
|
stageDefinitions = new List<StageDefinition>
|
|
|
|
|
{
|
2022-10-05 10:14:31 +00:00
|
|
|
|
new StageDefinition(2)
|
2020-04-02 09:39:49 +00:00
|
|
|
|
};
|
|
|
|
|
|
2023-06-17 08:25:09 +00:00
|
|
|
|
SetContents(_ => new ManiaInputManager(new ManiaRuleset().RulesetInfo, 2)
|
|
|
|
|
{
|
|
|
|
|
Child = new ManiaPlayfield(stageDefinitions)
|
|
|
|
|
});
|
2020-04-02 09:39:49 +00:00
|
|
|
|
});
|
2023-12-30 02:21:10 +00:00
|
|
|
|
|
|
|
|
|
AddRepeatStep("perform hit", () => scoreProcessor.ApplyResult(new JudgementResult(new HitObject(), new Judgement()) { Type = HitResult.Perfect }), 20);
|
|
|
|
|
AddStep("perform miss", () => scoreProcessor.ApplyResult(new JudgementResult(new HitObject(), new Judgement()) { Type = HitResult.Miss }));
|
2020-04-02 09:39:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-06-17 08:25:09 +00:00
|
|
|
|
[TestCase(2)]
|
|
|
|
|
[TestCase(3)]
|
|
|
|
|
[TestCase(5)]
|
|
|
|
|
public void TestDualStages(int columnCount)
|
2020-04-02 09:39:49 +00:00
|
|
|
|
{
|
|
|
|
|
AddStep("create stage", () =>
|
|
|
|
|
{
|
|
|
|
|
stageDefinitions = new List<StageDefinition>
|
|
|
|
|
{
|
2023-06-17 08:25:09 +00:00
|
|
|
|
new StageDefinition(columnCount),
|
|
|
|
|
new StageDefinition(columnCount)
|
2020-04-02 09:39:49 +00:00
|
|
|
|
};
|
|
|
|
|
|
2023-06-17 08:25:09 +00:00
|
|
|
|
SetContents(_ => new ManiaInputManager(new ManiaRuleset().RulesetInfo, (int)PlayfieldType.Dual + 2 * columnCount)
|
|
|
|
|
{
|
|
|
|
|
Child = new ManiaPlayfield(stageDefinitions)
|
|
|
|
|
{
|
|
|
|
|
// bit of a hack to make sure the dual stages fit on screen without overlapping each other.
|
|
|
|
|
Size = new Vector2(1.5f),
|
|
|
|
|
Scale = new Vector2(1 / 1.5f)
|
|
|
|
|
}
|
|
|
|
|
});
|
2020-04-02 09:39:49 +00:00
|
|
|
|
});
|
2023-12-30 02:21:10 +00:00
|
|
|
|
|
|
|
|
|
AddRepeatStep("perform hit", () => scoreProcessor.ApplyResult(new JudgementResult(new HitObject(), new Judgement()) { Type = HitResult.Perfect }), 20);
|
|
|
|
|
AddStep("perform miss", () => scoreProcessor.ApplyResult(new JudgementResult(new HitObject(), new Judgement()) { Type = HitResult.Miss }));
|
2020-04-02 09:39:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override IBeatmap CreateBeatmapForSkinProvider()
|
|
|
|
|
{
|
|
|
|
|
var maniaBeatmap = (ManiaBeatmap)base.CreateBeatmapForSkinProvider();
|
|
|
|
|
maniaBeatmap.Stages = stageDefinitions;
|
|
|
|
|
return maniaBeatmap;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|