1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-26 05:53:21 +08:00
osu-lazer/osu.Game.Rulesets.Mania/Skinning/ManiaLegacySkinTransformer.cs

68 lines
2.1 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.
using osu.Framework.Graphics;
using osu.Framework.Graphics.Textures;
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Audio;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Mania.Skinning
{
public class ManiaLegacySkinTransformer : ISkin
{
private readonly ISkin source;
public ManiaLegacySkinTransformer(ISkin source)
{
this.source = source;
}
public Drawable GetDrawableComponent(ISkinComponent component)
{
switch (component)
{
case GameplaySkinComponent<HitResult> resultComponent:
2019-12-27 10:37:05 +08:00
return getResult(resultComponent);
}
return null;
}
2019-12-27 10:37:05 +08:00
private Drawable getResult(GameplaySkinComponent<HitResult> resultComponent)
{
switch (resultComponent.Component)
{
case HitResult.Miss:
return this.GetAnimation("mania-hit0", true, true);
2019-12-27 10:37:05 +08:00
case HitResult.Meh:
return this.GetAnimation("mania-hit50", true, true);
2019-12-27 10:37:05 +08:00
case HitResult.Ok:
return this.GetAnimation("mania-hit100", true, true);
2019-12-27 10:37:05 +08:00
case HitResult.Good:
return this.GetAnimation("mania-hit200", true, true);
2019-12-27 10:37:05 +08:00
case HitResult.Great:
return this.GetAnimation("mania-hit300", true, true);
2019-12-27 10:37:05 +08:00
case HitResult.Perfect:
return this.GetAnimation("mania-hit300g", true, true);
}
return null;
}
public Texture GetTexture(string componentName) => source.GetTexture(componentName);
public SampleChannel GetSample(ISampleInfo sample) => source.GetSample(sample);
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) =>
source.GetConfig<TLookup, TValue>(lookup);
}
}