1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-26 06:43:21 +08:00
osu-lazer/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModRelax.cs

102 lines
3.2 KiB
C#
Raw Normal View History

2020-08-24 00:00:06 +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.
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics.Containers;
2020-08-24 00:00:06 +08:00
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Graphics.Cursor;
2020-08-24 00:00:06 +08:00
using osu.Game.Rulesets.Catch.Mods;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Objects;
2020-08-24 03:35:15 +08:00
using osu.Game.Rulesets.Objects.Types;
2020-08-24 00:00:06 +08:00
using osu.Game.Tests.Visual;
2020-08-24 03:35:15 +08:00
using osuTK;
2020-08-24 00:00:06 +08:00
namespace osu.Game.Rulesets.Catch.Tests.Mods
{
2022-11-24 13:32:20 +08:00
public partial class TestSceneCatchModRelax : ModTestScene
2020-08-24 00:00:06 +08:00
{
protected override Ruleset CreatePlayerRuleset() => new CatchRuleset();
[Test]
public void TestModRelax() => CreateModTest(new ModTestData
{
Mod = new CatchModRelax(),
Autoplay = false,
2020-08-24 03:35:15 +08:00
PassCondition = passCondition,
2020-08-24 00:00:06 +08:00
Beatmap = new Beatmap
{
HitObjects = new List<HitObject>
{
new Fruit
{
2020-08-24 03:35:15 +08:00
X = CatchPlayfield.CENTER_X,
StartTime = 0
},
new Fruit
{
X = 0,
StartTime = 1000
2020-08-24 03:35:15 +08:00
},
new Fruit
{
X = CatchPlayfield.WIDTH,
StartTime = 2000
2020-08-24 03:35:15 +08:00
},
new JuiceStream
{
X = CatchPlayfield.CENTER_X,
StartTime = 3000,
2020-08-24 03:52:50 +08:00
Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, Vector2.UnitY * 200 })
2020-08-24 00:00:06 +08:00
}
}
}
});
2020-08-24 03:35:15 +08:00
[Test]
public void TestGameCursorHidden()
{
CreateModTest(new ModTestData
{
Mod = new CatchModRelax(),
Autoplay = false,
PassCondition = () =>
{
InputManager.MoveMouseTo(this.ChildrenOfType<DrawableCatchRuleset>().Single());
return this.ChildrenOfType<MenuCursorContainer>().Single().State.Value == Visibility.Hidden;
}
});
}
2020-08-24 03:35:15 +08:00
private bool passCondition()
{
var playfield = this.ChildrenOfType<CatchPlayfield>().Single();
switch (Player.ScoreProcessor.Combo.Value)
{
case 0:
InputManager.MoveMouseTo(playfield.ScreenSpaceDrawQuad.Centre);
break;
2020-08-24 03:52:50 +08:00
2020-08-24 03:35:15 +08:00
case 1:
InputManager.MoveMouseTo(playfield.ScreenSpaceDrawQuad.BottomLeft);
break;
2020-08-24 03:52:50 +08:00
2020-08-24 03:35:15 +08:00
case 2:
InputManager.MoveMouseTo(playfield.ScreenSpaceDrawQuad.BottomRight);
break;
2020-08-24 03:52:50 +08:00
2020-08-24 03:35:15 +08:00
case 3:
InputManager.MoveMouseTo(playfield.ScreenSpaceDrawQuad.Centre);
break;
}
return Player.ScoreProcessor.Combo.Value >= 6;
}
2020-08-24 00:00:06 +08:00
}
}