mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:43:05 +08:00
Add some more xmldoc
This commit is contained in:
parent
aca9289d89
commit
9593e66a96
@ -15,6 +15,10 @@ namespace osu.Game.Skinning
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A drawable which can be skinned via an <see cref="ISkinSource"/>.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of drawable.</typeparam>
|
||||
public class SkinnableDrawable<T> : SkinReloadableDrawable
|
||||
where T : Drawable
|
||||
{
|
||||
@ -32,7 +36,7 @@ namespace osu.Game.Skinning
|
||||
private readonly bool restrictSize;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Create a new skinnable drawable.
|
||||
/// </summary>
|
||||
/// <param name="name">The namespace-complete resource name for this skinnable element.</param>
|
||||
/// <param name="defaultImplementation">A function to create the default skin implementation of this element.</param>
|
||||
@ -53,7 +57,10 @@ namespace osu.Game.Skinning
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
protected virtual bool ApplySizeToDefault => false;
|
||||
/// <summary>
|
||||
/// Whether to apply size restrictions (specified via <see cref="restrictSize"/>) to the default implementation.
|
||||
/// </summary>
|
||||
protected virtual bool ApplySizeRestrictionsToDefault => false;
|
||||
|
||||
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
||||
{
|
||||
@ -69,7 +76,7 @@ namespace osu.Game.Skinning
|
||||
|
||||
if (Drawable != null)
|
||||
{
|
||||
if (restrictSize && (!isDefault || ApplySizeToDefault))
|
||||
if (restrictSize && (!isDefault || ApplySizeRestrictionsToDefault))
|
||||
{
|
||||
Drawable.RelativeSizeAxes = Axes.Both;
|
||||
Drawable.Size = Vector2.One;
|
||||
|
@ -8,9 +8,12 @@ using osu.Framework.Graphics.Textures;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
/// <summary>
|
||||
/// A skinnable element which uses a stable sprite and can therefore share implementation logic.
|
||||
/// </summary>
|
||||
public class SkinnableSprite : SkinnableDrawable<Sprite>
|
||||
{
|
||||
protected override bool ApplySizeToDefault => true;
|
||||
protected override bool ApplySizeRestrictionsToDefault => true;
|
||||
|
||||
protected override Sprite CreateDefault(string name) => new Sprite { Texture = textures.Get(name) };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user