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-11-12 10:41:06 +00:00
|
|
|
|
2019-04-10 08:54:57 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
2018-11-12 10:41:06 +00:00
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Timing;
|
2020-05-21 05:25:37 +00:00
|
|
|
using osu.Game.Rulesets.Edit;
|
2018-11-12 10:41:06 +00:00
|
|
|
using osu.Game.Rulesets.Mania.Edit;
|
|
|
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
|
|
|
using osu.Game.Rulesets.Mania.UI;
|
2019-04-10 08:54:57 +00:00
|
|
|
using osu.Game.Rulesets.Mods;
|
2018-11-12 10:41:06 +00:00
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
using osu.Game.Rulesets.UI.Scrolling;
|
|
|
|
using osu.Game.Tests.Visual;
|
2018-11-26 01:44:48 +00:00
|
|
|
using osuTK;
|
|
|
|
using osuTK.Graphics;
|
2018-11-12 10:41:06 +00:00
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Tests
|
|
|
|
{
|
|
|
|
[Cached(Type = typeof(IManiaHitObjectComposer))]
|
2019-05-14 19:37:25 +00:00
|
|
|
public abstract class ManiaPlacementBlueprintTestScene : PlacementBlueprintTestScene, IManiaHitObjectComposer
|
2018-11-12 10:41:06 +00:00
|
|
|
{
|
|
|
|
private readonly Column column;
|
|
|
|
|
2019-04-10 08:54:57 +00:00
|
|
|
[Cached(typeof(IReadOnlyList<Mod>))]
|
|
|
|
private IReadOnlyList<Mod> mods { get; set; } = Array.Empty<Mod>();
|
|
|
|
|
2019-10-03 09:21:00 +00:00
|
|
|
[Cached(typeof(IScrollingInfo))]
|
|
|
|
private IScrollingInfo scrollingInfo;
|
|
|
|
|
2019-05-14 19:37:25 +00:00
|
|
|
protected ManiaPlacementBlueprintTestScene()
|
2018-11-12 10:41:06 +00:00
|
|
|
{
|
2019-10-03 09:21:00 +00:00
|
|
|
scrollingInfo = ((ScrollingTestContainer)HitObjectContainer).ScrollingInfo;
|
|
|
|
|
2018-11-12 10:41:06 +00:00
|
|
|
Add(column = new Column(0)
|
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
AccentColour = Color4.OrangeRed,
|
|
|
|
Clock = new FramedClock(new StopwatchClock()), // No scroll
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-05-21 05:25:37 +00:00
|
|
|
protected override SnapResult SnapForBlueprint(PlacementBlueprint blueprint)
|
|
|
|
{
|
|
|
|
var time = column.TimeAtScreenSpacePosition(InputManager.CurrentState.Mouse.Position);
|
|
|
|
var pos = column.ScreenSpacePositionAtTime(time);
|
|
|
|
|
|
|
|
return new ManiaSnapResult(pos, time, column);
|
|
|
|
}
|
|
|
|
|
2018-11-12 10:41:06 +00:00
|
|
|
protected override Container CreateHitObjectContainer() => new ScrollingTestContainer(ScrollingDirection.Down) { RelativeSizeAxes = Axes.Both };
|
|
|
|
|
|
|
|
protected override void AddHitObject(DrawableHitObject hitObject) => column.Add((DrawableManiaHitObject)hitObject);
|
|
|
|
|
|
|
|
public Column ColumnAt(Vector2 screenSpacePosition) => column;
|
2018-11-15 12:37:22 +00:00
|
|
|
|
|
|
|
public int TotalColumns => 1;
|
2018-11-12 10:41:06 +00:00
|
|
|
}
|
|
|
|
}
|