mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Make fallback bool into a function
Allows correct handling now that beatmap skins are also a thing.
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
@ -11,20 +12,21 @@ namespace osu.Game.Skinning
|
||||
/// </summary>
|
||||
public abstract class SkinReloadableDrawable : CompositeDrawable
|
||||
{
|
||||
private readonly Func<ISkinSource, bool> allowFallback;
|
||||
private ISkinSource skin;
|
||||
|
||||
/// <summary>
|
||||
/// Whether fallback to default skin should be allowed if the custom skin is missing this resource.
|
||||
/// </summary>
|
||||
private readonly bool allowDefaultFallback;
|
||||
private bool allowDefaultFallback => allowFallback == null || allowFallback.Invoke(skin);
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="SkinReloadableDrawable"/>
|
||||
/// </summary>
|
||||
/// <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]
|
||||
|
Reference in New Issue
Block a user