2021-07-08 06:42:29 +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.
|
|
|
|
|
2021-07-19 13:33:03 +00:00
|
|
|
using osu.Framework.Allocation;
|
2021-07-08 06:42:29 +00:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2021-07-19 13:33:03 +00:00
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
|
|
|
using osu.Game.Rulesets.Catch.Beatmaps;
|
|
|
|
using osu.Game.Rulesets.Edit;
|
2021-07-08 06:42:29 +00:00
|
|
|
using osu.Game.Rulesets.UI.Scrolling;
|
2021-07-19 13:33:03 +00:00
|
|
|
using osu.Game.Screens.Edit;
|
2021-07-08 06:42:29 +00:00
|
|
|
using osu.Game.Tests.Visual;
|
2021-07-19 13:33:03 +00:00
|
|
|
using osuTK;
|
2021-07-08 06:42:29 +00:00
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Catch.Tests.Editor
|
|
|
|
{
|
|
|
|
public abstract class CatchSelectionBlueprintTestScene : SelectionBlueprintTestScene
|
|
|
|
{
|
|
|
|
protected ScrollingHitObjectContainer HitObjectContainer => contentContainer.Playfield.HitObjectContainer;
|
|
|
|
|
|
|
|
protected override Container<Drawable> Content => contentContainer;
|
|
|
|
|
2021-07-19 13:33:03 +00:00
|
|
|
[Cached(typeof(EditorBeatmap))]
|
|
|
|
[Cached(typeof(IBeatSnapProvider))]
|
|
|
|
protected readonly EditorBeatmap EditorBeatmap;
|
|
|
|
|
2021-07-08 06:42:29 +00:00
|
|
|
private readonly CatchEditorTestSceneContainer contentContainer;
|
|
|
|
|
|
|
|
protected CatchSelectionBlueprintTestScene()
|
|
|
|
{
|
2022-01-12 14:17:35 +00:00
|
|
|
EditorBeatmap = new EditorBeatmap(new CatchBeatmap
|
|
|
|
{
|
|
|
|
BeatmapInfo =
|
|
|
|
{
|
|
|
|
Ruleset = new CatchRuleset().RulesetInfo,
|
|
|
|
}
|
|
|
|
}) { Difficulty = { CircleSize = 0 } };
|
2021-07-19 13:33:03 +00:00
|
|
|
EditorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint
|
|
|
|
{
|
|
|
|
BeatLength = 100
|
|
|
|
});
|
|
|
|
|
|
|
|
base.Content.Add(new EditorBeatmapDependencyContainer(EditorBeatmap, new BindableBeatDivisor())
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
EditorBeatmap,
|
|
|
|
contentContainer = new CatchEditorTestSceneContainer()
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void AddMouseMoveStep(double time, float x) => AddStep($"move to time={time}, x={x}", () =>
|
|
|
|
{
|
|
|
|
float y = HitObjectContainer.PositionAtTime(time);
|
|
|
|
Vector2 pos = HitObjectContainer.ToScreenSpace(new Vector2(x, y + HitObjectContainer.DrawHeight));
|
|
|
|
InputManager.MoveMouseTo(pos);
|
|
|
|
});
|
|
|
|
|
|
|
|
private class EditorBeatmapDependencyContainer : Container
|
|
|
|
{
|
|
|
|
[Cached]
|
|
|
|
private readonly EditorClock editorClock;
|
|
|
|
|
|
|
|
[Cached]
|
|
|
|
private readonly BindableBeatDivisor beatDivisor;
|
|
|
|
|
|
|
|
public EditorBeatmapDependencyContainer(IBeatmap beatmap, BindableBeatDivisor beatDivisor)
|
|
|
|
{
|
|
|
|
editorClock = new EditorClock(beatmap, beatDivisor);
|
|
|
|
this.beatDivisor = beatDivisor;
|
|
|
|
}
|
2021-07-08 06:42:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|