1
0
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:
Dean Herbert 2019-06-24 15:25:01 +09:00
parent aca9289d89
commit 9593e66a96
2 changed files with 14 additions and 4 deletions

View File

@ -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 public class SkinnableDrawable<T> : SkinReloadableDrawable
where T : Drawable where T : Drawable
{ {
@ -32,7 +36,7 @@ namespace osu.Game.Skinning
private readonly bool restrictSize; private readonly bool restrictSize;
/// <summary> /// <summary>
/// /// Create a new skinnable drawable.
/// </summary> /// </summary>
/// <param name="name">The namespace-complete resource name for this skinnable element.</param> /// <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> /// <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; 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) protected override void SkinChanged(ISkinSource skin, bool allowFallback)
{ {
@ -69,7 +76,7 @@ namespace osu.Game.Skinning
if (Drawable != null) if (Drawable != null)
{ {
if (restrictSize && (!isDefault || ApplySizeToDefault)) if (restrictSize && (!isDefault || ApplySizeRestrictionsToDefault))
{ {
Drawable.RelativeSizeAxes = Axes.Both; Drawable.RelativeSizeAxes = Axes.Both;
Drawable.Size = Vector2.One; Drawable.Size = Vector2.One;

View File

@ -8,9 +8,12 @@ using osu.Framework.Graphics.Textures;
namespace osu.Game.Skinning 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> 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) }; protected override Sprite CreateDefault(string name) => new Sprite { Texture = textures.Get(name) };