1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 16:13:34 +08:00

Add taiko barline skinning support

This commit is contained in:
Dean Herbert 2020-04-23 14:32:48 +09:00
parent 2a1cc35541
commit 12f156dcec
5 changed files with 44 additions and 7 deletions

View File

@ -6,6 +6,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osuTK; using osuTK;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{ {
@ -27,7 +28,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
/// <summary> /// <summary>
/// The visual line tracker. /// The visual line tracker.
/// </summary> /// </summary>
protected Box Tracker; protected SkinnableDrawable Line;
/// <summary> /// <summary>
/// The bar line. /// The bar line.
@ -45,13 +46,15 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
RelativeSizeAxes = Axes.Y; RelativeSizeAxes = Axes.Y;
Width = tracker_width; Width = tracker_width;
AddInternal(Tracker = new Box AddInternal(Line = new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.BarLine), _ => new Box
{
RelativeSizeAxes = Axes.Both,
EdgeSmoothness = new Vector2(0.5f, 0),
})
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both, Alpha = 0.75f,
EdgeSmoothness = new Vector2(0.5f, 0),
Alpha = 0.75f
}); });
} }

View File

@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
} }
}); });
Tracker.Alpha = 1f; Line.Alpha = 1f;
} }
protected override void LoadComplete() protected override void LoadComplete()

View File

@ -0,0 +1,27 @@
// 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.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.Taiko.Skinning
{
public class LegacyBarLine : Sprite
{
[BackgroundDependencyLoader]
private void load(ISkinSource skin)
{
Texture = skin.GetTexture("taiko-barline");
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
RelativeSizeAxes = Axes.Both;
Size = new Vector2(1, 0.88f);
FillMode = FillMode.Fill;
}
}
}

View File

@ -75,6 +75,12 @@ namespace osu.Game.Rulesets.Taiko.Skinning
return Drawable.Empty(); return Drawable.Empty();
return null; return null;
case TaikoSkinComponents.BarLine:
if (GetTexture("taiko-barline") != null)
return new LegacyBarLine();
return null;
} }
return source.GetDrawableComponent(component); return source.GetDrawableComponent(component);

View File

@ -13,6 +13,7 @@ namespace osu.Game.Rulesets.Taiko
Swell, Swell,
HitTarget, HitTarget,
PlayfieldBackgroundLeft, PlayfieldBackgroundLeft,
PlayfieldBackgroundRight PlayfieldBackgroundRight,
BarLine
} }
} }