1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 02:33:02 +08:00
osu-lazer/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs

58 lines
1.7 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.
2018-04-13 17:19:50 +08:00
2023-08-15 12:33:49 +08:00
using osu.Framework.Allocation;
using osu.Framework.Bindables;
2018-04-13 17:19:50 +08:00
using osu.Framework.Graphics;
2023-08-15 12:33:49 +08:00
using osu.Game.Rulesets.Mania.Skinning.Default;
using osu.Game.Skinning;
2018-04-13 17:19:50 +08:00
namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
/// <summary>
/// Visualises a <see cref="BarLine"/>. Although this derives DrawableManiaHitObject,
/// this does not handle input/sound like a normal hit object.
/// </summary>
2022-11-24 13:32:20 +08:00
public partial class DrawableBarLine : DrawableManiaHitObject<BarLine>
2018-04-13 17:19:50 +08:00
{
2023-08-15 12:33:49 +08:00
public readonly Bindable<bool> Major = new Bindable<bool>();
public DrawableBarLine()
: this(null!)
{
}
2018-04-13 17:19:50 +08:00
public DrawableBarLine(BarLine barLine)
: base(barLine)
{
RelativeSizeAxes = Axes.X;
2023-08-15 12:33:49 +08:00
}
2018-04-13 17:19:50 +08:00
2023-08-15 12:33:49 +08:00
[BackgroundDependencyLoader]
private void load()
{
AddInternal(new SkinnableDrawable(new ManiaSkinComponentLookup(ManiaSkinComponents.BarLine), _ => new DefaultBarLine())
2018-04-13 17:19:50 +08:00
{
2023-08-15 12:33:49 +08:00
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
2018-04-13 17:19:50 +08:00
});
2023-08-15 12:33:49 +08:00
Major.BindValueChanged(major => Height = major.NewValue ? 1.7f : 1.2f, true);
}
protected override void OnApply()
{
base.OnApply();
Major.BindTo(HitObject.MajorBindable);
}
protected override void OnFree()
{
base.OnFree();
Major.UnbindFrom(HitObject.MajorBindable);
2018-04-13 17:19:50 +08:00
}
2020-11-04 15:19:07 +08:00
protected override void UpdateStartTimeStateTransforms() => this.FadeOut(150);
2018-04-13 17:19:50 +08:00
}
}