mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 10:23:03 +08:00
Make fallback bool into a function
Allows correct handling now that beatmap skins are also a thing.
This commit is contained in:
parent
f03abb3145
commit
fb3d319d0e
@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
Blending = BlendingMode.Additive,
|
Blending = BlendingMode.Additive,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Alpha = 0.2f,
|
Alpha = 0.2f,
|
||||||
}, false);
|
}, s => s.GetTexture("Play/osu/hitcircle") == null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both
|
RelativeSizeAxes = Axes.Both
|
||||||
}
|
}
|
||||||
}, false);
|
}, s => s.GetTexture("Play/osu/hitcircle") == null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
Texture = textures.Get(name),
|
Texture = textures.Get(name),
|
||||||
Blending = BlendingMode.Additive,
|
Blending = BlendingMode.Additive,
|
||||||
Alpha = 0.5f
|
Alpha = 0.5f
|
||||||
}, false);
|
}, s => s.GetTexture("Play/osu/hitcircle") == null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
Colour = Color4.White.Opacity(0.5f),
|
Colour = Color4.White.Opacity(0.5f),
|
||||||
},
|
},
|
||||||
Child = new Box()
|
Child = new Box()
|
||||||
}, false),
|
}, s => s.GetTexture("Play/osu/hitcircle") == null),
|
||||||
number = new OsuSpriteText
|
number = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = @"1",
|
Text = @"1",
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
|
||||||
@ -11,20 +12,21 @@ namespace osu.Game.Skinning
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class SkinReloadableDrawable : CompositeDrawable
|
public abstract class SkinReloadableDrawable : CompositeDrawable
|
||||||
{
|
{
|
||||||
|
private readonly Func<ISkinSource, bool> allowFallback;
|
||||||
private ISkinSource skin;
|
private ISkinSource skin;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether fallback to default skin should be allowed if the custom skin is missing this resource.
|
/// Whether fallback to default skin should be allowed if the custom skin is missing this resource.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly bool allowDefaultFallback;
|
private bool allowDefaultFallback => allowFallback == null || allowFallback.Invoke(skin);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new <see cref="SkinReloadableDrawable"/>
|
/// Create a new <see cref="SkinReloadableDrawable"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="fallback">Whether fallback to default skin should be allowed if the custom skin is missing this resource.</param>
|
/// <param name="fallback">Whether fallback to default skin should be allowed if the custom skin is missing this resource.</param>
|
||||||
protected SkinReloadableDrawable(bool fallback = true)
|
protected SkinReloadableDrawable(Func<ISkinSource, bool> allowFallback = null)
|
||||||
{
|
{
|
||||||
allowDefaultFallback = fallback;
|
this.allowFallback = allowFallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
@ -9,8 +9,8 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
public class SkinnableDrawable : SkinnableDrawable<Drawable>
|
public class SkinnableDrawable : SkinnableDrawable<Drawable>
|
||||||
{
|
{
|
||||||
public SkinnableDrawable(string name, Func<string, Drawable> defaultImplementation, bool fallback = true, bool restrictSize = true)
|
public SkinnableDrawable(string name, Func<string, Drawable> defaultImplementation, Func<ISkinSource, bool> allowFallback = null, bool restrictSize = true)
|
||||||
: base(name, defaultImplementation, fallback, restrictSize)
|
: base(name, defaultImplementation, allowFallback, restrictSize)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,7 +31,7 @@ namespace osu.Game.Skinning
|
|||||||
/// <param name="defaultImplementation">A function to create the default skin implementation of this element.</param>
|
/// <param name="defaultImplementation">A function to create the default skin implementation of this element.</param>
|
||||||
/// <param name="fallback">Whther to fallback to the default implementation when a custom skin is specified but not implementation is present.</param>
|
/// <param name="fallback">Whther to fallback to the default implementation when a custom skin is specified but not implementation is present.</param>
|
||||||
/// <param name="restrictSize">Whether a user-skin drawable should be limited to the size of our parent.</param>
|
/// <param name="restrictSize">Whether a user-skin drawable should be limited to the size of our parent.</param>
|
||||||
public SkinnableDrawable(string name, Func<string, T> defaultImplementation, bool fallback = true, bool restrictSize = true) : base(fallback)
|
public SkinnableDrawable(string name, Func<string, T> defaultImplementation, Func<ISkinSource, bool> allowFallback = null, bool restrictSize = true) : base(allowFallback)
|
||||||
{
|
{
|
||||||
componentName = name;
|
componentName = name;
|
||||||
createDefault = defaultImplementation;
|
createDefault = defaultImplementation;
|
||||||
|
Loading…
Reference in New Issue
Block a user