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-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
using NUnit.Framework;
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Timing;
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
using osu.Game.Rulesets.Edit;
|
|
|
|
using osu.Game.Rulesets.Objects;
|
2018-11-01 14:38:19 +08:00
|
|
|
using osu.Game.Rulesets.Objects.Types;
|
2018-04-13 17:19:50 +08:00
|
|
|
using osu.Game.Rulesets.Osu;
|
|
|
|
using osu.Game.Rulesets.Osu.Edit;
|
2018-11-07 15:08:56 +08:00
|
|
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
|
|
|
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
|
2018-04-13 17:19:50 +08:00
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
2018-11-06 17:28:22 +08:00
|
|
|
using osu.Game.Screens.Edit.Compose;
|
|
|
|
using osu.Game.Screens.Edit.Compose.Components;
|
2019-03-25 00:02:36 +08:00
|
|
|
using osuTK;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
2019-03-25 00:02:36 +08:00
|
|
|
namespace osu.Game.Tests.Visual.Editor
|
2018-04-13 17:19:50 +08:00
|
|
|
{
|
|
|
|
[TestFixture]
|
2018-10-17 14:46:30 +08:00
|
|
|
[Cached(Type = typeof(IPlacementHandler))]
|
2019-05-15 03:37:25 +08:00
|
|
|
public class TestSceneHitObjectComposer : OsuTestScene, IPlacementHandler
|
2018-04-13 17:19:50 +08:00
|
|
|
{
|
|
|
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
|
|
|
{
|
2018-11-19 15:58:11 +08:00
|
|
|
typeof(SelectionHandler),
|
2018-11-06 16:24:38 +08:00
|
|
|
typeof(DragBox),
|
2018-04-13 17:19:50 +08:00
|
|
|
typeof(HitObjectComposer),
|
|
|
|
typeof(OsuHitObjectComposer),
|
2018-11-06 16:36:10 +08:00
|
|
|
typeof(BlueprintContainer),
|
2018-10-04 12:43:50 +08:00
|
|
|
typeof(NotNullAttribute),
|
2018-10-25 17:28:04 +08:00
|
|
|
typeof(HitCirclePiece),
|
2018-11-06 16:56:04 +08:00
|
|
|
typeof(HitCircleSelectionBlueprint),
|
2018-11-06 17:04:03 +08:00
|
|
|
typeof(HitCirclePlacementBlueprint),
|
2018-04-13 17:19:50 +08:00
|
|
|
};
|
|
|
|
|
2018-10-17 16:41:17 +08:00
|
|
|
private HitObjectComposer composer;
|
2018-10-17 14:46:30 +08:00
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
[BackgroundDependencyLoader]
|
2018-05-23 16:37:39 +08:00
|
|
|
private void load()
|
2018-04-13 17:19:50 +08:00
|
|
|
{
|
2019-05-31 13:40:53 +08:00
|
|
|
Beatmap.Value = CreateWorkingBeatmap(new Beatmap
|
2018-04-13 17:19:50 +08:00
|
|
|
{
|
|
|
|
HitObjects = new List<HitObject>
|
|
|
|
{
|
|
|
|
new HitCircle { Position = new Vector2(256, 192), Scale = 0.5f },
|
|
|
|
new HitCircle { Position = new Vector2(344, 148), Scale = 0.5f },
|
|
|
|
new Slider
|
|
|
|
{
|
|
|
|
Position = new Vector2(128, 256),
|
2018-11-01 14:38:19 +08:00
|
|
|
Path = new SliderPath(PathType.Linear, new[]
|
2018-04-13 17:19:50 +08:00
|
|
|
{
|
|
|
|
Vector2.Zero,
|
|
|
|
new Vector2(216, 0),
|
2018-11-01 14:38:19 +08:00
|
|
|
}),
|
2018-04-13 17:19:50 +08:00
|
|
|
Scale = 0.5f,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
var clock = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
|
2018-06-06 19:25:40 +08:00
|
|
|
Dependencies.CacheAs<IAdjustableClock>(clock);
|
|
|
|
Dependencies.CacheAs<IFrameBasedClock>(clock);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
2018-10-17 16:41:17 +08:00
|
|
|
Child = composer = new OsuHitObjectComposer(new OsuRuleset());
|
2018-04-13 17:19:50 +08:00
|
|
|
}
|
2018-10-17 14:46:30 +08:00
|
|
|
|
2018-10-17 16:41:17 +08:00
|
|
|
public void BeginPlacement(HitObject hitObject)
|
|
|
|
{
|
|
|
|
}
|
2018-10-17 14:46:30 +08:00
|
|
|
|
2018-10-17 16:41:17 +08:00
|
|
|
public void EndPlacement(HitObject hitObject) => composer.Add(hitObject);
|
2018-10-18 15:36:06 +08:00
|
|
|
|
|
|
|
public void Delete(HitObject hitObject) => composer.Remove(hitObject);
|
2018-04-13 17:19:50 +08:00
|
|
|
}
|
|
|
|
}
|