[unity] SpineAttributes formatting.

This commit is contained in:
pharan 2018-11-19 10:42:25 +08:00 committed by GitHub
parent 44552cd809
commit b6c00a4880
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,8 +28,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
// Contributed by: Mitch Thompson
using UnityEngine;
using System;
using System.Collections;
@ -44,6 +42,34 @@ namespace Spine.Unity {
public bool fallbackToTextField = false;
}
public class SpineBone : SpineAttributeBase {
/// <summary>
/// Smart popup menu for Spine Bones
/// </summary>
/// <param name="startsWith">Filters popup results to elements that begin with supplied string.</param>
/// <param name="includeNone">If true, the dropdown list will include a "none" option which stored as an empty string.</param>
/// <param name = "fallbackToTextField">If true, and an animation list source can't be found, the field will fall back to a normal text field. If false, it will show an error.</param>
/// <param name="dataField">If specified, a locally scoped field with the name supplied by in dataField will be used to fill the popup results.
/// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives)
/// If left empty and the script the attribute is applied to is derived from Component, GetComponent<SkeletonRenderer>() will be called as a fallback.
/// </param>
public SpineBone (string startsWith = "", string dataField = "", bool includeNone = true, bool fallbackToTextField = false) {
this.startsWith = startsWith;
this.dataField = dataField;
this.includeNone = includeNone;
this.fallbackToTextField = fallbackToTextField;
}
public static Spine.Bone GetBone (string boneName, SkeletonRenderer renderer) {
return renderer.skeleton == null ? null : renderer.skeleton.FindBone(boneName);
}
public static Spine.BoneData GetBoneData (string boneName, SkeletonDataAsset skeletonDataAsset) {
var data = skeletonDataAsset.GetSkeletonData(true);
return data.FindBone(boneName);
}
}
public class SpineSlot : SpineAttributeBase {
public bool containsBoundingBoxes = false;
@ -67,6 +93,25 @@ namespace Spine.Unity {
}
}
public class SpineAnimation : SpineAttributeBase {
/// <summary>
/// Smart popup menu for Spine Animations
/// </summary>
/// <param name="startsWith">Filters popup results to elements that begin with supplied string.</param>
/// <param name = "fallbackToTextField">If true, and an animation list source can't be found, the field will fall back to a normal text field. If false, it will show an error.</param>
/// <param name="includeNone">If true, the dropdown list will include a "none" option which stored as an empty string.</param>
/// <param name="dataField">If specified, a locally scoped field with the name supplied by in dataField will be used to fill the popup results.
/// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives)
/// If left empty and the script the attribute is applied to is derived from Component, GetComponent<SkeletonRenderer>() will be called as a fallback.
/// </param>
public SpineAnimation (string startsWith = "", string dataField = "", bool includeNone = true, bool fallbackToTextField = false) {
this.startsWith = startsWith;
this.dataField = dataField;
this.includeNone = includeNone;
this.fallbackToTextField = fallbackToTextField;
}
}
public class SpineEvent : SpineAttributeBase {
/// <summary>
/// Smart popup menu for Spine Events (Spine.EventData)
@ -105,24 +150,6 @@ namespace Spine.Unity {
}
}
public class SpinePathConstraint : SpineAttributeBase {
/// <summary>
/// Smart popup menu for Spine Events (Spine.PathConstraint)
/// </summary>
/// <param name="startsWith">Filters popup results to elements that begin with supplied string.</param>
/// <param name = "includeNone">If true, the dropdown list will include a "none" option which stored as an empty string.</param>
/// <param name="dataField">If specified, a locally scoped field with the name supplied by in dataField will be used to fill the popup results.
/// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives).
/// If left empty and the script the attribute is applied to is derived from Component, GetComponent(SkeletonRenderer)() will be called as a fallback.
/// </param>
public SpinePathConstraint (string startsWith = "", string dataField = "", bool includeNone = true, bool fallbackToTextField = false) {
this.startsWith = startsWith;
this.dataField = dataField;
this.includeNone = includeNone;
this.fallbackToTextField = fallbackToTextField;
}
}
public class SpineTransformConstraint : SpineAttributeBase {
/// <summary>
/// Smart popup menu for Spine Transform Constraints (Spine.TransformConstraint)
@ -142,6 +169,24 @@ namespace Spine.Unity {
}
}
public class SpinePathConstraint : SpineAttributeBase {
/// <summary>
/// Smart popup menu for Spine Events (Spine.PathConstraint)
/// </summary>
/// <param name="startsWith">Filters popup results to elements that begin with supplied string.</param>
/// <param name = "includeNone">If true, the dropdown list will include a "none" option which stored as an empty string.</param>
/// <param name="dataField">If specified, a locally scoped field with the name supplied by in dataField will be used to fill the popup results.
/// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives).
/// If left empty and the script the attribute is applied to is derived from Component, GetComponent(SkeletonRenderer)() will be called as a fallback.
/// </param>
public SpinePathConstraint (string startsWith = "", string dataField = "", bool includeNone = true, bool fallbackToTextField = false) {
this.startsWith = startsWith;
this.dataField = dataField;
this.includeNone = includeNone;
this.fallbackToTextField = fallbackToTextField;
}
}
public class SpineSkin : SpineAttributeBase {
/// <summary>
/// Smart popup menu for Spine Skins
@ -166,25 +211,6 @@ namespace Spine.Unity {
}
}
public class SpineAnimation : SpineAttributeBase {
/// <summary>
/// Smart popup menu for Spine Animations
/// </summary>
/// <param name="startsWith">Filters popup results to elements that begin with supplied string.</param>
/// <param name = "fallbackToTextField">If true, and an animation list source can't be found, the field will fall back to a normal text field. If false, it will show an error.</param>
/// <param name="includeNone">If true, the dropdown list will include a "none" option which stored as an empty string.</param>
/// <param name="dataField">If specified, a locally scoped field with the name supplied by in dataField will be used to fill the popup results.
/// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives)
/// If left empty and the script the attribute is applied to is derived from Component, GetComponent<SkeletonRenderer>() will be called as a fallback.
/// </param>
public SpineAnimation (string startsWith = "", string dataField = "", bool includeNone = true, bool fallbackToTextField = false) {
this.startsWith = startsWith;
this.dataField = dataField;
this.includeNone = includeNone;
this.fallbackToTextField = fallbackToTextField;
}
}
public class SpineAttachment : SpineAttributeBase {
public bool returnAttachmentPath = false;
public bool currentSkinOnly = false;
@ -258,34 +284,6 @@ namespace Spine.Unity {
}
}
public class SpineBone : SpineAttributeBase {
/// <summary>
/// Smart popup menu for Spine Bones
/// </summary>
/// <param name="startsWith">Filters popup results to elements that begin with supplied string.</param>
/// <param name="includeNone">If true, the dropdown list will include a "none" option which stored as an empty string.</param>
/// <param name = "fallbackToTextField">If true, and an animation list source can't be found, the field will fall back to a normal text field. If false, it will show an error.</param>
/// <param name="dataField">If specified, a locally scoped field with the name supplied by in dataField will be used to fill the popup results.
/// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives)
/// If left empty and the script the attribute is applied to is derived from Component, GetComponent<SkeletonRenderer>() will be called as a fallback.
/// </param>
public SpineBone (string startsWith = "", string dataField = "", bool includeNone = true, bool fallbackToTextField = false) {
this.startsWith = startsWith;
this.dataField = dataField;
this.includeNone = includeNone;
this.fallbackToTextField = fallbackToTextField;
}
public static Spine.Bone GetBone(string boneName, SkeletonRenderer renderer) {
return renderer.skeleton == null ? null : renderer.skeleton.FindBone(boneName);
}
public static Spine.BoneData GetBoneData(string boneName, SkeletonDataAsset skeletonDataAsset) {
var data = skeletonDataAsset.GetSkeletonData(true);
return data.FindBone(boneName);
}
}
public class SpineAtlasRegion : PropertyAttribute {
public string atlasAssetField;