2020-06-21 20:04:10 +00: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.Audio.Sample;
|
|
|
|
using osu.Game.Audio;
|
2020-06-21 20:44:35 +00:00
|
|
|
using osu.Game.Rulesets.Objects.Legacy;
|
2021-10-22 05:41:59 +00:00
|
|
|
using static osu.Game.Skinning.SkinConfiguration;
|
2020-06-21 20:04:10 +00:00
|
|
|
|
|
|
|
namespace osu.Game.Skinning
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Transformer used to handle support of legacy features for individual rulesets.
|
|
|
|
/// </summary>
|
2022-09-22 09:50:19 +00:00
|
|
|
public abstract class LegacySkinTransformer : SkinTransformer
|
2020-06-21 20:04:10 +00:00
|
|
|
{
|
2022-10-12 08:47:20 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Whether the skin being transformed is able to provide legacy resources for the ruleset.
|
|
|
|
/// </summary>
|
|
|
|
public virtual bool IsProvidingLegacyResources => this.HasFont(LegacyFont.Combo);
|
|
|
|
|
2022-09-22 09:50:19 +00:00
|
|
|
protected LegacySkinTransformer(ISkin skin)
|
|
|
|
: base(skin)
|
2020-06-21 20:04:10 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-09-22 09:50:19 +00:00
|
|
|
public override ISample? GetSample(ISampleInfo sampleInfo)
|
2020-06-21 20:44:35 +00:00
|
|
|
{
|
|
|
|
if (!(sampleInfo is ConvertHitObjectParser.LegacyHitSampleInfo legacySample))
|
2021-06-09 10:34:42 +00:00
|
|
|
return Skin.GetSample(sampleInfo);
|
2020-06-21 20:44:35 +00:00
|
|
|
|
2020-07-29 07:34:09 +00:00
|
|
|
var playLayeredHitSounds = GetConfig<LegacySetting, bool>(LegacySetting.LayeredHitSounds);
|
2020-06-21 20:44:35 +00:00
|
|
|
if (legacySample.IsLayered && playLayeredHitSounds?.Value == false)
|
2021-01-19 08:11:40 +00:00
|
|
|
return new SampleVirtual();
|
2020-06-21 20:44:35 +00:00
|
|
|
|
2022-09-22 09:50:19 +00:00
|
|
|
return base.GetSample(sampleInfo);
|
2020-06-21 20:44:35 +00:00
|
|
|
}
|
2020-06-21 20:04:10 +00:00
|
|
|
}
|
|
|
|
}
|