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