mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 15:03:13 +08:00
Allow LegacySkin to be constructed with all nulls
This commit is contained in:
parent
343af28ed5
commit
04c2c33c64
@ -30,14 +30,14 @@ namespace osu.Game.Skinning
|
||||
protected LegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager audioManager, string filename)
|
||||
: base(skin)
|
||||
{
|
||||
Stream stream = storage.GetStream(filename);
|
||||
Stream stream = storage?.GetStream(filename);
|
||||
if (stream != null)
|
||||
using (StreamReader reader = new StreamReader(stream))
|
||||
Configuration = new LegacySkinDecoder().Decode(reader);
|
||||
else
|
||||
Configuration = new DefaultSkinConfiguration();
|
||||
|
||||
Samples = audioManager.GetSampleStore(storage);
|
||||
Samples = audioManager?.GetSampleStore(storage);
|
||||
Textures = new TextureStore(new TextureLoaderStore(storage));
|
||||
}
|
||||
|
||||
@ -72,6 +72,10 @@ namespace osu.Game.Skinning
|
||||
{
|
||||
if (Configuration.ConfigDictionary.TryGetValue(lookup.ToString(), out var val))
|
||||
{
|
||||
// special case for handling skins which use 1 or 0 to signify a boolean state.
|
||||
if (typeof(TValue) == typeof(bool))
|
||||
val = val == "1" ? "true" : "false";
|
||||
|
||||
var bindable = new Bindable<TValue>();
|
||||
bindable.Parse(val);
|
||||
return bindable;
|
||||
|
Loading…
Reference in New Issue
Block a user