1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-26 23:32:55 +08:00
osu-lazer/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

73 lines
2.0 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
using osu.Framework.Allocation;
using osu.Framework.Bindables;
2017-03-21 19:39:18 +08:00
using osu.Framework.Graphics;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Skinning.Default;
2020-04-23 13:32:48 +08:00
using osu.Game.Skinning;
2018-04-13 17:19:50 +08:00
2017-04-18 15:05:58 +08:00
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
2017-03-21 19:39:18 +08:00
{
/// <summary>
/// A line that scrolls alongside hit objects in the playfield and visualises control points.
/// </summary>
public partial class DrawableBarLine : DrawableHitObject<HitObject>
2017-03-21 19:39:18 +08:00
{
public new BarLine HitObject => (BarLine)base.HitObject;
2017-04-03 09:04:13 +08:00
/// <summary>
/// The width of the line tracker.
/// </summary>
private const float tracker_width = 2f;
2018-04-13 17:19:50 +08:00
public readonly Bindable<bool> Major = new Bindable<bool>();
public DrawableBarLine()
: this(null)
{
}
public DrawableBarLine(BarLine? barLine)
: base(barLine!)
2017-03-21 19:39:18 +08:00
{
}
2018-04-13 17:19:50 +08:00
[BackgroundDependencyLoader]
private void load()
{
2017-08-09 09:54:00 +08:00
Anchor = Anchor.CentreLeft;
Origin = Anchor.Centre;
2018-04-13 17:19:50 +08:00
2017-03-21 19:39:18 +08:00
RelativeSizeAxes = Axes.Y;
2017-04-03 09:04:13 +08:00
Width = tracker_width;
2018-04-13 17:19:50 +08:00
AddInternal(new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.BarLine), _ => new DefaultBarLine())
2017-03-21 19:39:18 +08:00
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});
2017-03-21 19:39:18 +08:00
}
protected override void OnApply()
{
base.OnApply();
Major.BindTo(HitObject.MajorBindable);
}
protected override void OnFree()
{
base.OnFree();
Major.UnbindFrom(HitObject.MajorBindable);
}
protected override void UpdateHitStateTransforms(ArmedState state)
{
using (BeginAbsoluteSequence(HitObject.StartTime))
this.FadeOutFromOne(150).Expire();
}
2017-03-21 19:39:18 +08:00
}
2017-08-21 14:35:16 +08:00
}