1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 18:32:55 +08:00

Introduce legacy skin configuration

This commit is contained in:
iiSaLMaN 2019-10-09 23:04:34 +03:00
parent 84c13b93fc
commit 003af19e3f
2 changed files with 36 additions and 2 deletions

View File

@ -26,6 +26,8 @@ namespace osu.Game.Skinning
[CanBeNull] [CanBeNull]
protected IResourceStore<SampleChannel> Samples; protected IResourceStore<SampleChannel> Samples;
protected new LegacySkinConfiguration Configuration => (LegacySkinConfiguration)base.Configuration;
public LegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager audioManager) public LegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager audioManager)
: this(skin, new LegacySkinResourceStore<SkinFileInfo>(skin, storage), audioManager, "skin.ini") : this(skin, new LegacySkinResourceStore<SkinFileInfo>(skin, storage), audioManager, "skin.ini")
{ {
@ -37,9 +39,9 @@ namespace osu.Game.Skinning
Stream stream = storage?.GetStream(filename); Stream stream = storage?.GetStream(filename);
if (stream != null) if (stream != null)
using (LineBufferedReader reader = new LineBufferedReader(stream)) using (LineBufferedReader reader = new LineBufferedReader(stream))
Configuration = new LegacySkinDecoder().Decode(reader); base.Configuration = new LegacySkinDecoder().Decode(reader);
else else
Configuration = new DefaultSkinConfiguration(); base.Configuration = new LegacySkinConfiguration { LegacyVersion = LegacySkinConfiguration.LATEST_VERSION };
if (storage != null) if (storage != null)
{ {
@ -71,6 +73,18 @@ namespace osu.Game.Skinning
case GlobalSkinColour colour: case GlobalSkinColour colour:
return SkinUtils.As<TValue>(getCustomColour(colour.ToString())); return SkinUtils.As<TValue>(getCustomColour(colour.ToString()));
case LegacySkinConfigurations legacy:
switch (legacy)
{
case LegacySkinConfigurations.Version:
if (Configuration.LegacyVersion.HasValue)
return SkinUtils.As<TValue>(new BindableDouble(Configuration.LegacyVersion.Value));
break;
}
break;
case SkinCustomColourLookup customColour: case SkinCustomColourLookup customColour:
return SkinUtils.As<TValue>(getCustomColour(customColour.Lookup.ToString())); return SkinUtils.As<TValue>(getCustomColour(customColour.Lookup.ToString()));

View File

@ -0,0 +1,20 @@
// 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.
namespace osu.Game.Skinning
{
public class LegacySkinConfiguration : DefaultSkinConfiguration
{
public const double LATEST_VERSION = 2.5;
/// <summary>
/// Legacy version of this skin.
/// </summary>
public double? LegacyVersion { get; internal set; }
}
public enum LegacySkinConfigurations
{
Version,
}
}