2020-01-02 13:26:32 +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 System.Collections.Generic;
|
|
|
|
using osu.Framework.Audio.Sample;
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Textures;
|
|
|
|
using osu.Game.Audio;
|
2020-04-22 21:19:29 +08:00
|
|
|
using osu.Game.Rulesets.Taiko.UI;
|
2020-01-02 13:26:32 +08:00
|
|
|
using osu.Game.Skinning;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Skinning
|
|
|
|
{
|
|
|
|
public class TaikoLegacySkinTransformer : ISkin
|
|
|
|
{
|
|
|
|
private readonly ISkinSource source;
|
|
|
|
|
|
|
|
public TaikoLegacySkinTransformer(ISkinSource source)
|
|
|
|
{
|
|
|
|
this.source = source;
|
|
|
|
}
|
|
|
|
|
2020-04-03 17:23:03 +08:00
|
|
|
public Drawable GetDrawableComponent(ISkinComponent component)
|
|
|
|
{
|
|
|
|
if (!(component is TaikoSkinComponent taikoComponent))
|
|
|
|
return null;
|
|
|
|
|
|
|
|
switch (taikoComponent.Component)
|
|
|
|
{
|
2020-04-15 16:50:57 +08:00
|
|
|
case TaikoSkinComponents.DrumRollBody:
|
|
|
|
if (GetTexture("taiko-roll-middle") != null)
|
|
|
|
return new LegacyDrumRoll();
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
2020-04-03 17:23:03 +08:00
|
|
|
case TaikoSkinComponents.InputDrum:
|
|
|
|
if (GetTexture("taiko-bar-left") != null)
|
|
|
|
return new LegacyInputDrum();
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
2020-04-11 13:20:09 +08:00
|
|
|
case TaikoSkinComponents.CentreHit:
|
|
|
|
case TaikoSkinComponents.RimHit:
|
|
|
|
|
|
|
|
if (GetTexture("taikohitcircle") != null)
|
|
|
|
return new LegacyHit(taikoComponent.Component);
|
|
|
|
|
|
|
|
return null;
|
2020-04-15 18:24:50 +08:00
|
|
|
|
|
|
|
case TaikoSkinComponents.DrumRollTick:
|
|
|
|
return this.GetAnimation("sliderscorepoint", false, false);
|
2020-04-21 18:00:34 +08:00
|
|
|
|
|
|
|
case TaikoSkinComponents.HitTarget:
|
|
|
|
if (GetTexture("taikobigcircle") != null)
|
|
|
|
return new LegacyHitTarget();
|
|
|
|
|
|
|
|
return null;
|
2020-04-03 17:23:03 +08:00
|
|
|
|
2020-04-22 21:19:29 +08:00
|
|
|
case TaikoSkinComponents.TaikoDon:
|
|
|
|
if (GetTexture("pippidonclear0") != null)
|
|
|
|
return new DrawableTaikoCharacter();
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return source.GetDrawableComponent(component);
|
|
|
|
}
|
2020-04-03 17:23:03 +08:00
|
|
|
}
|
2020-01-02 13:26:32 +08:00
|
|
|
|
|
|
|
public Texture GetTexture(string componentName) => source.GetTexture(componentName);
|
|
|
|
|
|
|
|
public SampleChannel GetSample(ISampleInfo sampleInfo) => source.GetSample(new LegacyTaikoSampleInfo(sampleInfo));
|
|
|
|
|
|
|
|
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => source.GetConfig<TLookup, TValue>(lookup);
|
|
|
|
|
|
|
|
private class LegacyTaikoSampleInfo : ISampleInfo
|
|
|
|
{
|
|
|
|
private readonly ISampleInfo source;
|
|
|
|
|
|
|
|
public LegacyTaikoSampleInfo(ISampleInfo source)
|
|
|
|
{
|
|
|
|
this.source = source;
|
|
|
|
}
|
|
|
|
|
|
|
|
public IEnumerable<string> LookupNames
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
foreach (var name in source.LookupNames)
|
|
|
|
yield return $"taiko-{name}";
|
|
|
|
|
|
|
|
foreach (var name in source.LookupNames)
|
|
|
|
yield return name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public int Volume => source.Volume;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|