Move beatmap skin info creation to static method at IBeatmapSkin

This commit is contained in:
Salman Ahmed 2021-05-15 17:56:19 +03:00
parent 87833bfb61
commit 9806d94b74
2 changed files with 17 additions and 4 deletions

View File

@ -0,0 +1,16 @@
// 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.Game.Beatmaps;
namespace osu.Game.Skinning
{
public static class BeatmapSkinExtensions
{
public static SkinInfo CreateSkinInfo(BeatmapInfo beatmap) => new SkinInfo
{
Name = beatmap.ToString(),
Creator = beatmap.Metadata?.AuthorString,
};
}
}

View File

@ -17,7 +17,7 @@ namespace osu.Game.Skinning
protected override bool UseCustomSampleBanks => true;
public LegacyBeatmapSkin(BeatmapInfo beatmap, IResourceStore<byte[]> storage, IStorageResourceProvider resources)
: base(createSkinInfo(beatmap), new LegacySkinResourceStore<BeatmapSetFileInfo>(beatmap.BeatmapSet, storage), resources, beatmap.Path)
: base(BeatmapSkinExtensions.CreateSkinInfo(beatmap), new LegacySkinResourceStore<BeatmapSetFileInfo>(beatmap.BeatmapSet, storage), resources, beatmap.Path)
{
// Disallow default colours fallback on beatmap skins to allow using parent skin combo colours. (via SkinProvidingContainer)
Configuration.AllowDefaultComboColoursFallback = false;
@ -49,8 +49,5 @@ namespace osu.Game.Skinning
return base.GetSample(sampleInfo);
}
private static SkinInfo createSkinInfo(BeatmapInfo beatmap) =>
new SkinInfo { Name = beatmap.ToString(), Creator = beatmap.Metadata.Author.ToString() };
}
}