2020-04-15 16:50:57 +08:00
|
|
|
// 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;
|
2020-07-17 15:55:01 +08:00
|
|
|
using osu.Framework.Graphics.OpenGL.Textures;
|
2020-04-15 16:50:57 +08:00
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Skinning;
|
|
|
|
using osuTK.Graphics;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Skinning
|
|
|
|
{
|
2020-04-15 17:44:12 +08:00
|
|
|
public class LegacyDrumRoll : CompositeDrawable, IHasAccentColour
|
2020-04-15 16:50:57 +08:00
|
|
|
{
|
|
|
|
private LegacyCirclePiece headCircle;
|
|
|
|
|
|
|
|
private Sprite body;
|
|
|
|
|
|
|
|
private Sprite end;
|
|
|
|
|
|
|
|
public LegacyDrumRoll()
|
|
|
|
{
|
2020-04-15 17:44:12 +08:00
|
|
|
RelativeSizeAxes = Axes.Both;
|
2020-04-15 16:50:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2020-04-15 17:44:12 +08:00
|
|
|
private void load(ISkinSource skin, OsuColour colours)
|
2020-04-15 16:50:57 +08:00
|
|
|
{
|
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
2020-04-15 17:44:12 +08:00
|
|
|
end = new Sprite
|
|
|
|
{
|
|
|
|
Anchor = Anchor.CentreRight,
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2020-07-17 15:55:01 +08:00
|
|
|
Texture = skin.GetTexture("taiko-roll-end", WrapMode.ClampToEdge, WrapMode.ClampToEdge),
|
2020-04-15 17:44:12 +08:00
|
|
|
FillMode = FillMode.Fit,
|
|
|
|
},
|
|
|
|
body = new Sprite
|
2020-04-15 16:50:57 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2020-07-17 15:55:01 +08:00
|
|
|
Texture = skin.GetTexture("taiko-roll-middle", WrapMode.ClampToEdge, WrapMode.ClampToEdge),
|
2020-04-15 17:44:12 +08:00
|
|
|
},
|
|
|
|
headCircle = new LegacyCirclePiece
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
2020-04-15 16:50:57 +08:00
|
|
|
},
|
|
|
|
};
|
2020-04-15 17:44:12 +08:00
|
|
|
|
|
|
|
AccentColour = colours.YellowDark;
|
2020-04-15 16:50:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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()
|
|
|
|
{
|
2020-08-25 14:16:41 +08:00
|
|
|
headCircle.AccentColour = LegacyColourCompatibility.DisallowZeroAlpha(accentColour);
|
|
|
|
body.Colour = LegacyColourCompatibility.DisallowZeroAlpha(accentColour);
|
|
|
|
end.Colour = LegacyColourCompatibility.DisallowZeroAlpha(accentColour);
|
2020-04-15 16:50:57 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|