2018-10-25 18:11:57 +08:00
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Timing;
|
|
|
|
using osu.Game.Rulesets.Edit;
|
|
|
|
using osu.Game.Rulesets.Objects;
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
using osu.Game.Screens.Edit.Screens.Compose;
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual
|
|
|
|
{
|
|
|
|
[Cached(Type = typeof(IPlacementHandler))]
|
2018-11-06 17:06:13 +08:00
|
|
|
public abstract class PlacementBlueprintTestCase : OsuTestCase, IPlacementHandler
|
2018-10-25 18:11:57 +08:00
|
|
|
{
|
|
|
|
private readonly Container hitObjectContainer;
|
2018-11-06 17:04:03 +08:00
|
|
|
private PlacementBlueprint currentBlueprint;
|
2018-10-25 18:11:57 +08:00
|
|
|
|
2018-11-06 17:06:13 +08:00
|
|
|
protected PlacementBlueprintTestCase()
|
2018-10-25 18:11:57 +08:00
|
|
|
{
|
2018-10-26 14:36:09 +08:00
|
|
|
Beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize = 2;
|
|
|
|
|
2018-10-25 18:11:57 +08:00
|
|
|
Add(hitObjectContainer = new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Clock = new FramedClock(new StopwatchClock())
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
2018-11-06 17:04:03 +08:00
|
|
|
Add(currentBlueprint = CreateMask());
|
2018-10-25 18:11:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
|
|
|
{
|
|
|
|
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
|
|
|
dependencies.CacheAs<IAdjustableClock>(new StopwatchClock());
|
|
|
|
|
|
|
|
return dependencies;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void BeginPlacement(HitObject hitObject)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public void EndPlacement(HitObject hitObject)
|
|
|
|
{
|
|
|
|
hitObjectContainer.Add(CreateHitObject(hitObject));
|
|
|
|
|
2018-11-06 17:04:03 +08:00
|
|
|
Remove(currentBlueprint);
|
|
|
|
Add(currentBlueprint = CreateMask());
|
2018-10-25 18:11:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public void Delete(HitObject hitObject)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
protected abstract DrawableHitObject CreateHitObject(HitObject hitObject);
|
2018-11-06 17:04:03 +08:00
|
|
|
protected abstract PlacementBlueprint CreateMask();
|
2018-10-25 18:11:57 +08:00
|
|
|
}
|
|
|
|
}
|