1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-17 13:12:56 +08:00
osu-lazer/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs

53 lines
1.8 KiB
C#
Raw Normal View History

// 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.
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
2019-09-11 17:21:29 +08:00
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
2018-09-21 13:35:50 +08:00
using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.UI.Scrolling;
2020-03-31 11:17:44 +08:00
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Mania.UI.Components
{
public class ColumnHitObjectArea : HitObjectArea
{
2020-03-31 11:17:44 +08:00
public readonly Container<HitExplosion> Explosions;
2019-12-29 23:37:28 +08:00
private readonly Drawable hitTarget;
2018-09-21 13:35:50 +08:00
public ColumnHitObjectArea(HitObjectContainer hitObjectContainer)
: base(hitObjectContainer)
{
AddRangeInternal(new[]
{
2020-03-31 11:17:44 +08:00
hitTarget = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.HitTarget), _ => new DefaultHitTarget())
{
RelativeSizeAxes = Axes.X,
Depth = 1
},
Explosions = new Container<HitExplosion>
{
RelativeSizeAxes = Axes.Both,
Depth = -1,
}
});
2020-03-31 11:17:44 +08:00
}
2019-12-28 13:48:10 +08:00
protected override void UpdateHitPosition()
2020-03-31 11:17:44 +08:00
{
base.UpdateHitPosition();
2019-12-28 13:48:10 +08:00
if (Direction.Value == ScrollingDirection.Up)
2019-12-28 13:48:10 +08:00
{
2020-03-31 11:17:44 +08:00
hitTarget.Anchor = hitTarget.Origin = Anchor.TopLeft;
Explosions.Padding = new MarginPadding { Top = DefaultNotePiece.NOTE_HEIGHT / 2 };
2019-12-28 13:48:10 +08:00
}
2020-03-31 11:17:44 +08:00
else
2019-12-28 13:48:10 +08:00
{
2020-03-31 11:17:44 +08:00
hitTarget.Anchor = hitTarget.Origin = Anchor.BottomLeft;
Explosions.Padding = new MarginPadding { Bottom = DefaultNotePiece.NOTE_HEIGHT / 2 };
2019-12-28 13:48:10 +08:00
}
}
}
}