mirror of
https://github.com/ppy/osu.git
synced 2024-12-17 10:23:21 +08:00
87 lines
2.4 KiB
C#
87 lines
2.4 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.Allocation;
|
|
using osu.Framework.Graphics;
|
|
using osu.Framework.Graphics.Containers;
|
|
using osu.Framework.Graphics.OpenGL.Textures;
|
|
using osu.Framework.Graphics.Sprites;
|
|
using osu.Game.Graphics;
|
|
using osu.Game.Skinning;
|
|
using osuTK.Graphics;
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Skinning
|
|
{
|
|
public class LegacyDrumRoll : CompositeDrawable, IHasAccentColour
|
|
{
|
|
private LegacyCirclePiece headCircle;
|
|
|
|
private Sprite body;
|
|
|
|
private Sprite end;
|
|
|
|
public LegacyDrumRoll()
|
|
{
|
|
RelativeSizeAxes = Axes.Both;
|
|
}
|
|
|
|
[BackgroundDependencyLoader]
|
|
private void load(ISkinSource skin, OsuColour colours)
|
|
{
|
|
InternalChildren = new Drawable[]
|
|
{
|
|
end = new Sprite
|
|
{
|
|
Anchor = Anchor.CentreRight,
|
|
Origin = Anchor.CentreLeft,
|
|
RelativeSizeAxes = Axes.Both,
|
|
Texture = skin.GetTexture("taiko-roll-end", WrapMode.ClampToEdge, WrapMode.ClampToEdge),
|
|
FillMode = FillMode.Fit,
|
|
},
|
|
body = new Sprite
|
|
{
|
|
RelativeSizeAxes = Axes.Both,
|
|
Texture = skin.GetTexture("taiko-roll-middle", WrapMode.ClampToEdge, WrapMode.ClampToEdge),
|
|
},
|
|
headCircle = new LegacyCirclePiece
|
|
{
|
|
RelativeSizeAxes = Axes.Y,
|
|
},
|
|
};
|
|
|
|
AccentColour = colours.YellowDark;
|
|
}
|
|
|
|
protected override void LoadComplete()
|
|
{
|
|
base.LoadComplete();
|
|
updateAccentColour();
|
|
}
|
|
|
|
private Color4 accentColour;
|
|
|
|
public Color4 AccentColour
|
|
{
|
|
get => accentColour;
|
|
set
|
|
{
|
|
if (value == accentColour)
|
|
return;
|
|
|
|
accentColour = value;
|
|
if (IsLoaded)
|
|
updateAccentColour();
|
|
}
|
|
}
|
|
|
|
private void updateAccentColour()
|
|
{
|
|
var colour = LegacyColourCompatibility.DisallowZeroAlpha(accentColour);
|
|
|
|
headCircle.AccentColour = colour;
|
|
body.Colour = colour;
|
|
end.Colour = colour;
|
|
}
|
|
}
|
|
}
|