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

Expose default SkinManager providers for use in RulesetSkinProvidingContainer

This commit is contained in:
Salman Ahmed 2021-06-10 13:04:34 +03:00
parent 59be3588eb
commit c3a2f2c2a4
2 changed files with 19 additions and 4 deletions

View File

@ -1,7 +1,6 @@
// 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.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -53,7 +52,13 @@ namespace osu.Game.Skinning
private void updateSkins()
{
SkinSources.Clear();
SkinSources.AddRange(skinManager.CurrentSkinLayers.Select(s => ruleset.CreateLegacySkinProvider(s, beatmap)));
SkinSources.Add(ruleset.CreateLegacySkinProvider(skinManager.CurrentSkin.Value, beatmap));
if (skinManager.CurrentSkin.Value is LegacySkin)
SkinSources.Add(ruleset.CreateLegacySkinProvider(skinManager.DefaultLegacySkin, beatmap));
SkinSources.Add(ruleset.CreateLegacySkinProvider(skinManager.DefaultSkin, beatmap));
}
}
}

View File

@ -48,9 +48,19 @@ namespace osu.Game.Skinning
protected override string ImportFromStablePath => "Skins";
private readonly Skin defaultSkin;
/// <summary>
/// An <see cref="ISkin"/> providing the resources of the default skin.
/// </summary>
public ISkin DefaultSkin => defaultSkin;
private readonly Skin defaultLegacySkin;
private readonly Skin defaultSkin;
/// <summary>
/// An <see cref="ISkin"/> providing the resources of the default legacy skin.
/// </summary>
public ISkin DefaultLegacySkin => defaultLegacySkin;
public SkinManager(Storage storage, DatabaseContextFactory contextFactory, GameHost host, IResourceStore<byte[]> resources, AudioManager audio)
: base(storage, contextFactory, new SkinStore(contextFactory, storage), host)
@ -84,7 +94,7 @@ namespace osu.Game.Skinning
{
var userSkins = GetAllUserSkins();
userSkins.Insert(0, SkinInfo.Default);
userSkins.Insert(1, DefaultLegacySkin.Info);
userSkins.Insert(1, Skinning.DefaultLegacySkin.Info);
return userSkins;
}