1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 08:33:21 +08:00

Add support for skinned hits

This commit is contained in:
Dean Herbert 2020-04-11 14:20:09 +09:00
parent 009b138364
commit dc56be0a1d
3 changed files with 72 additions and 0 deletions

View File

@ -11,6 +11,7 @@ using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Rulesets.Taiko.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Skinning;
namespace osu.Game.Rulesets.Taiko.Tests
{
@ -22,6 +23,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
typeof(DrawableHit),
typeof(DrawableCentreHit),
typeof(DrawableRimHit),
typeof(LegacyHit),
}).ToList();
[BackgroundDependencyLoader]

View File

@ -0,0 +1,62 @@
// 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.Animations;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Skinning;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Taiko.Skinning
{
public class LegacyHit : CompositeDrawable, IHasAccentColour
{
private readonly TaikoSkinComponents component;
private Drawable backgroundLayer;
public LegacyHit(TaikoSkinComponents component)
{
this.component = component;
}
[BackgroundDependencyLoader]
private void load(ISkinSource skin)
{
InternalChildren = new Drawable[]
{
backgroundLayer = skin.GetAnimation("taikohitcircle", true, false),
skin.GetAnimation("taikohitcircleoverlay", true, false),
};
// animations in taiko skins are used in a custom way (>150 combo and animating in time with beat).
// for now just stop at first frame for sanity.
foreach (var c in InternalChildren)
{
(c as IFramedAnimation)?.Stop();
c.Anchor = Anchor.Centre;
c.Origin = Anchor.Centre;
}
AccentColour = component == TaikoSkinComponents.CentreHit
? new Color4(235, 69, 44, 255)
: new Color4(67, 142, 172, 255);
}
private Color4 accentColour;
public Color4 AccentColour
{
get => accentColour;
set
{
if (value == accentColour)
return;
backgroundLayer.Colour = accentColour = value;
}
}
}
}

View File

@ -32,6 +32,14 @@ namespace osu.Game.Rulesets.Taiko.Skinning
return new LegacyInputDrum();
return null;
case TaikoSkinComponents.CentreHit:
case TaikoSkinComponents.RimHit:
if (GetTexture("taikohitcircle") != null)
return new LegacyHit(taikoComponent.Component);
return null;
}
return source.GetDrawableComponent(component);