2023-06-23 00:37:25 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2019-01-24 16:43:03 +08:00
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-11-07 15:21:32 +08:00
|
|
|
|
|
2018-11-13 15:42:40 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2024-02-21 01:29:35 +08:00
|
|
|
|
using osu.Framework.Bindables;
|
2018-11-12 16:18:58 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
2018-11-07 15:21:32 +08:00
|
|
|
|
using osu.Game.Rulesets.Edit;
|
2021-05-13 18:53:32 +08:00
|
|
|
|
using osu.Game.Rulesets.Mania.Objects;
|
2021-06-15 12:20:33 +08:00
|
|
|
|
using osu.Game.Rulesets.Mania.UI;
|
2021-06-17 09:07:52 +08:00
|
|
|
|
using osu.Game.Rulesets.UI;
|
2018-11-13 15:42:40 +08:00
|
|
|
|
using osu.Game.Rulesets.UI.Scrolling;
|
2018-11-07 15:21:32 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|
|
|
|
{
|
2022-11-24 13:32:20 +08:00
|
|
|
|
public abstract partial class ManiaSelectionBlueprint<T> : HitObjectSelectionBlueprint<T>
|
2021-05-13 18:53:32 +08:00
|
|
|
|
where T : ManiaHitObject
|
2018-11-07 15:21:32 +08:00
|
|
|
|
{
|
2021-06-15 12:20:33 +08:00
|
|
|
|
[Resolved]
|
2023-06-23 00:37:25 +08:00
|
|
|
|
private Playfield playfield { get; set; } = null!;
|
2018-11-26 10:34:25 +08:00
|
|
|
|
|
2021-06-17 09:07:52 +08:00
|
|
|
|
protected ScrollingHitObjectContainer HitObjectContainer => ((ManiaPlayfield)playfield).GetColumn(HitObject.Column).HitObjectContainer;
|
2021-06-15 12:20:33 +08:00
|
|
|
|
|
2021-05-13 18:53:32 +08:00
|
|
|
|
protected ManiaSelectionBlueprint(T hitObject)
|
|
|
|
|
: base(hitObject)
|
2018-11-07 15:21:32 +08:00
|
|
|
|
{
|
2018-11-12 16:18:58 +08:00
|
|
|
|
RelativeSizeAxes = Axes.None;
|
2018-11-07 15:21:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-02-21 01:29:35 +08:00
|
|
|
|
private readonly IBindable<ScrollingDirection> directionBindable = new Bindable<ScrollingDirection>();
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(IScrollingInfo scrollingInfo)
|
2018-11-13 14:45:06 +08:00
|
|
|
|
{
|
2024-02-21 01:29:35 +08:00
|
|
|
|
directionBindable.BindTo(scrollingInfo.Direction);
|
|
|
|
|
}
|
2018-11-13 14:45:06 +08:00
|
|
|
|
|
2024-02-21 01:29:35 +08:00
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
directionBindable.BindValueChanged(onDirectionChanged, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void onDirectionChanged(ValueChangedEvent<ScrollingDirection> direction)
|
|
|
|
|
{
|
|
|
|
|
var anchor = direction.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre;
|
2021-06-15 12:20:33 +08:00
|
|
|
|
Anchor = Origin = anchor;
|
|
|
|
|
foreach (var child in InternalChildren)
|
|
|
|
|
child.Anchor = child.Origin = anchor;
|
2024-02-21 01:29:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Update()
|
|
|
|
|
{
|
|
|
|
|
base.Update();
|
2018-11-26 10:34:25 +08:00
|
|
|
|
|
2023-10-17 16:40:44 +08:00
|
|
|
|
Position = Parent!.ToLocalSpace(HitObjectContainer.ScreenSpacePositionAtTime(HitObject.StartTime)) - AnchorPosition;
|
2021-06-15 12:20:33 +08:00
|
|
|
|
Width = HitObjectContainer.DrawWidth;
|
2018-11-26 10:47:48 +08:00
|
|
|
|
}
|
2018-11-07 15:21:32 +08:00
|
|
|
|
}
|
|
|
|
|
}
|