mirror of
https://github.com/ppy/osu.git
synced 2024-12-16 02:22:59 +08:00
54 lines
1.7 KiB
C#
54 lines
1.7 KiB
C#
// 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;
|
|
using osu.Game.Rulesets.UI;
|
|
using osu.Game.Rulesets.UI.Scrolling;
|
|
using osu.Game.Skinning;
|
|
|
|
namespace osu.Game.Rulesets.Mania.UI.Components
|
|
{
|
|
public class ColumnHitObjectArea : HitObjectArea
|
|
{
|
|
public readonly Container Explosions;
|
|
|
|
public readonly Container UnderlayElements;
|
|
|
|
private readonly Drawable hitTarget;
|
|
|
|
public ColumnHitObjectArea(int columnIndex, HitObjectContainer hitObjectContainer)
|
|
: base(hitObjectContainer)
|
|
{
|
|
AddRangeInternal(new[]
|
|
{
|
|
UnderlayElements = new Container
|
|
{
|
|
RelativeSizeAxes = Axes.Both,
|
|
Depth = 2,
|
|
},
|
|
hitTarget = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.HitTarget, columnIndex), _ => new DefaultHitTarget())
|
|
{
|
|
RelativeSizeAxes = Axes.X,
|
|
Depth = 1
|
|
},
|
|
Explosions = new Container
|
|
{
|
|
RelativeSizeAxes = Axes.Both,
|
|
Depth = -1,
|
|
}
|
|
});
|
|
}
|
|
|
|
protected override void UpdateHitPosition()
|
|
{
|
|
base.UpdateHitPosition();
|
|
|
|
if (Direction.Value == ScrollingDirection.Up)
|
|
hitTarget.Anchor = hitTarget.Origin = Anchor.TopLeft;
|
|
else
|
|
hitTarget.Anchor = hitTarget.Origin = Anchor.BottomLeft;
|
|
}
|
|
}
|
|
}
|