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
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
2025-01-26 09:17:21 +08:00
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Bindables;
|
2017-09-11 16:53:27 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Game.Rulesets.Judgements;
|
2020-11-17 13:59:34 +08:00
|
|
|
using osu.Game.Rulesets.Scoring;
|
2025-01-26 09:17:21 +08:00
|
|
|
using osu.Game.Rulesets.UI.Scrolling;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
2017-09-11 16:53:27 +08:00
|
|
|
namespace osu.Game.Rulesets.Mania.UI
|
|
|
|
{
|
2018-05-22 04:24:10 +08:00
|
|
|
public partial class DrawableManiaJudgement : DrawableJudgement
|
2017-09-11 16:53:27 +08:00
|
|
|
{
|
2025-01-26 09:17:21 +08:00
|
|
|
private IBindable<ScrollingDirection> direction;
|
2020-11-17 13:59:34 +08:00
|
|
|
|
2025-01-26 09:17:21 +08:00
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(IScrollingInfo scrollingInfo)
|
2020-11-17 13:59:34 +08:00
|
|
|
{
|
2025-01-26 09:17:21 +08:00
|
|
|
direction = scrollingInfo.Direction.GetBoundCopy();
|
|
|
|
direction.BindValueChanged(_ => onDirectionChanged(), true);
|
|
|
|
}
|
2020-12-14 12:07:55 +08:00
|
|
|
|
2025-01-26 09:17:21 +08:00
|
|
|
private void onDirectionChanged()
|
|
|
|
{
|
|
|
|
Anchor = direction.Value == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre;
|
|
|
|
Origin = Anchor.Centre;
|
2020-11-17 13:59:34 +08:00
|
|
|
}
|
2025-01-26 09:17:21 +08:00
|
|
|
|
|
|
|
protected override Drawable CreateDefaultJudgement(HitResult result) => new DefaultManiaJudgementPiece(result);
|
2017-09-11 16:53:27 +08:00
|
|
|
}
|
|
|
|
}
|