2019-01-24 08:43:03 +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.
|
2018-10-25 09:48:11 +00:00
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Input.Events;
|
|
|
|
using osu.Framework.Timing;
|
|
|
|
using osu.Game.Rulesets.Edit;
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual
|
|
|
|
{
|
2019-05-14 19:37:25 +00:00
|
|
|
public abstract class SelectionBlueprintTestScene : OsuTestScene
|
2018-10-25 09:48:11 +00:00
|
|
|
{
|
2018-11-06 08:56:04 +00:00
|
|
|
private SelectionBlueprint blueprint;
|
2018-10-25 09:48:11 +00:00
|
|
|
|
|
|
|
protected override Container<Drawable> Content => content ?? base.Content;
|
|
|
|
private readonly Container content;
|
|
|
|
|
2019-05-14 19:37:25 +00:00
|
|
|
protected SelectionBlueprintTestScene()
|
2018-10-25 09:48:11 +00:00
|
|
|
{
|
|
|
|
base.Content.Add(content = new Container
|
|
|
|
{
|
|
|
|
Clock = new FramedClock(new StopwatchClock()),
|
|
|
|
RelativeSizeAxes = Axes.Both
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
2018-11-06 07:58:10 +00:00
|
|
|
blueprint = CreateBlueprint();
|
|
|
|
blueprint.Depth = float.MinValue;
|
2018-11-06 08:56:04 +00:00
|
|
|
blueprint.SelectionRequested += (_, __) => blueprint.Select();
|
2018-10-25 09:48:11 +00:00
|
|
|
|
2018-11-06 07:58:10 +00:00
|
|
|
Add(blueprint);
|
|
|
|
|
2018-11-06 08:56:04 +00:00
|
|
|
AddStep("Select", () => blueprint.Select());
|
|
|
|
AddStep("Deselect", () => blueprint.Deselect());
|
2018-10-25 09:48:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override bool OnClick(ClickEvent e)
|
|
|
|
{
|
2018-11-06 08:56:04 +00:00
|
|
|
blueprint.Deselect();
|
2018-10-25 09:48:11 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-11-07 06:04:48 +00:00
|
|
|
protected abstract SelectionBlueprint CreateBlueprint();
|
2018-10-25 09:48:11 +00:00
|
|
|
}
|
|
|
|
}
|