2019-01-24 16:43:03 +08:00
|
|
|
|
// 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.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-03-20 15:26:36 +08:00
|
|
|
|
using System;
|
2021-06-22 15:19:55 +08:00
|
|
|
|
using System.Collections.Generic;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-03-20 15:26:36 +08:00
|
|
|
|
namespace osu.Game.Skinning
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2023-02-15 14:14:38 +08:00
|
|
|
|
/// An abstract skin implementation which generally provides access to more than one skins (with fallback logic).
|
2018-03-20 15:26:36 +08:00
|
|
|
|
/// </summary>
|
2023-02-15 14:14:38 +08:00
|
|
|
|
/// <remarks>
|
|
|
|
|
/// Common usage is to do an initial lookup via <see cref="FindProvider"/>, and use the returned <see cref="ISkin"/>
|
|
|
|
|
/// to do further lookups for related components.
|
|
|
|
|
///
|
|
|
|
|
/// The initial lookup is used to lock consecutive lookups to the same underlying skin source (as to not get some elements
|
|
|
|
|
/// from one skin and others from another, which would be the case if using <see cref="ISkin"/> methods like
|
|
|
|
|
/// <see cref="ISkin.GetSample"/> directly).
|
|
|
|
|
/// </remarks>
|
2019-04-25 16:36:17 +08:00
|
|
|
|
public interface ISkinSource : ISkin
|
2018-03-20 15:26:36 +08:00
|
|
|
|
{
|
2021-10-12 11:50:28 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Fired whenever a source change occurs, signalling that consumers should re-query as required.
|
|
|
|
|
/// </summary>
|
2018-03-20 15:26:36 +08:00
|
|
|
|
event Action SourceChanged;
|
2021-06-06 10:08:54 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Find the first (if any) skin that can fulfill the lookup.
|
|
|
|
|
/// This should be used for cases where subsequent lookups (for related components) need to occur on the same skin.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>The skin to be used for subsequent lookups, or <c>null</c> if none is available.</returns>
|
2022-11-09 12:44:59 +08:00
|
|
|
|
ISkin? FindProvider(Func<ISkin, bool> lookupFunction);
|
2021-06-22 15:19:55 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Retrieve all sources available for lookup, with highest priority source first.
|
|
|
|
|
/// </summary>
|
|
|
|
|
IEnumerable<ISkin> AllSources { get; }
|
2018-03-20 15:26:36 +08:00
|
|
|
|
}
|
|
|
|
|
}
|