mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-25 22:23:42 +08:00
C# style method and class docs.
closes 127
This commit is contained in:
parent
325babbb3b
commit
832b0f02aa
@ -52,14 +52,14 @@ namespace Spine {
|
|||||||
this.duration = duration;
|
this.duration = duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated */
|
[Obsolete]
|
||||||
public void Apply (Skeleton skeleton, float time, bool loop) {
|
public void Apply (Skeleton skeleton, float time, bool loop) {
|
||||||
Apply(skeleton, time, time, loop, null);
|
Apply(skeleton, time, time, loop, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Poses the skeleton at the specified time for this animation.
|
/// <summary>Poses the skeleton at the specified time for this animation.</summary>
|
||||||
* @param lastTime The last time the animation was applied. Can be equal to time if events shouldn't be fired.
|
/// <param name="lastTime The last time the animation was applied. Can be equal to time if events shouldn't be fired.</param>
|
||||||
* @param events Any triggered events are added. May be null if lastTime is known to not cause any events to trigger. */
|
/// <param name="events Any triggered events are added. May be null if lastTime is known to not cause any events to trigger.</param>
|
||||||
public void Apply (Skeleton skeleton, float lastTime, float time, bool loop, List<Event> events) {
|
public void Apply (Skeleton skeleton, float lastTime, float time, bool loop, List<Event> events) {
|
||||||
if (skeleton == null) throw new ArgumentNullException("skeleton cannot be null.");
|
if (skeleton == null) throw new ArgumentNullException("skeleton cannot be null.");
|
||||||
|
|
||||||
@ -73,15 +73,15 @@ namespace Spine {
|
|||||||
timelines[i].Apply(skeleton, lastTime, time, events, 1);
|
timelines[i].Apply(skeleton, lastTime, time, events, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated */
|
[Obsolete]
|
||||||
public void Mix (Skeleton skeleton, float time, bool loop, float alpha) {
|
public void Mix (Skeleton skeleton, float time, bool loop, float alpha) {
|
||||||
Mix(skeleton, time, time, loop, null, alpha);
|
Mix(skeleton, time, time, loop, null, alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Poses the skeleton at the specified time for this animation mixed with the current pose.
|
/// <summary>Poses the skeleton at the specified time for this animation mixed with the current pose.</summary>
|
||||||
* @param lastTime The last time the animation was applied. Can be equal to time if events shouldn't be fired.
|
/// <param name="lastTime The last time the animation was applied. Can be equal to time if events shouldn't be fired.</param>
|
||||||
* @param events Any triggered events are added. May be null if lastTime is known to not cause any events to trigger.
|
/// <param name="events Any triggered events are added. May be null if lastTime is known to not cause any events to trigger.</param>
|
||||||
* @param alpha The amount of this animation that affects the current pose. */
|
/// <param name="alpha The amount of this animation that affects the current pose.</param>
|
||||||
public void Mix (Skeleton skeleton, float lastTime, float time, bool loop, List<Event> events, float alpha) {
|
public void Mix (Skeleton skeleton, float lastTime, float time, bool loop, List<Event> events, float alpha) {
|
||||||
if (skeleton == null) throw new ArgumentNullException("skeleton cannot be null.");
|
if (skeleton == null) throw new ArgumentNullException("skeleton cannot be null.");
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ namespace Spine {
|
|||||||
timelines[i].Apply(skeleton, lastTime, time, events, alpha);
|
timelines[i].Apply(skeleton, lastTime, time, events, alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param target After the first and before the last entry. */
|
/// <param name="target">After the first and before the last entry.</param>
|
||||||
internal static int binarySearch (float[] values, float target, int step) {
|
internal static int binarySearch (float[] values, float target, int step) {
|
||||||
int low = 0;
|
int low = 0;
|
||||||
int high = values.Length / step - 2;
|
int high = values.Length / step - 2;
|
||||||
@ -119,11 +119,11 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public interface Timeline {
|
public interface Timeline {
|
||||||
/** Sets the value(s) for the specified time. */
|
/// <summary>Sets the value(s) for the specified time.</summary>
|
||||||
void Apply (Skeleton skeleton, float lastTime, float time, List<Event> firedEvents, float alpha);
|
void Apply (Skeleton skeleton, float lastTime, float time, List<Event> firedEvents, float alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Base class for frames that use an interpolation bezier curve. */
|
/// <summary>Base class for frames that use an interpolation bezier curve.</summary>
|
||||||
abstract public class CurveTimeline : Timeline {
|
abstract public class CurveTimeline : Timeline {
|
||||||
static protected float LINEAR = 0;
|
static protected float LINEAR = 0;
|
||||||
static protected float STEPPED = -1;
|
static protected float STEPPED = -1;
|
||||||
@ -146,9 +146,9 @@ namespace Spine {
|
|||||||
curves[frameIndex * 6] = STEPPED;
|
curves[frameIndex * 6] = STEPPED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the control handle positions for an interpolation bezier curve used to transition from this keyframe to the next.
|
/// <summary>Sets the control handle positions for an interpolation bezier curve used to transition from this keyframe to the next.
|
||||||
* cx1 and cx2 are from 0 to 1, representing the percent of time between the two keyframes. cy1 and cy2 are the percent of
|
/// cx1 and cx2 are from 0 to 1, representing the percent of time between the two keyframes. cy1 and cy2 are the percent of
|
||||||
* the difference between the keyframe's values. */
|
/// the difference between the keyframe's values.</summary>
|
||||||
public void SetCurve (int frameIndex, float cx1, float cy1, float cx2, float cy2) {
|
public void SetCurve (int frameIndex, float cx1, float cy1, float cx2, float cy2) {
|
||||||
float subdiv_step = 1f / BEZIER_SEGMENTS;
|
float subdiv_step = 1f / BEZIER_SEGMENTS;
|
||||||
float subdiv_step2 = subdiv_step * subdiv_step;
|
float subdiv_step2 = subdiv_step * subdiv_step;
|
||||||
@ -218,7 +218,7 @@ namespace Spine {
|
|||||||
frames = new float[frameCount * 2];
|
frames = new float[frameCount * 2];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the time and value of the specified keyframe. */
|
/// <summary>Sets the time and value of the specified keyframe.</summary>
|
||||||
public void SetFrame (int frameIndex, float time, float angle) {
|
public void SetFrame (int frameIndex, float time, float angle) {
|
||||||
frameIndex *= 2;
|
frameIndex *= 2;
|
||||||
frames[frameIndex] = time;
|
frames[frameIndex] = time;
|
||||||
@ -280,7 +280,7 @@ namespace Spine {
|
|||||||
frames = new float[frameCount * 3];
|
frames = new float[frameCount * 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the time and value of the specified keyframe. */
|
/// <summary>Sets the time and value of the specified keyframe.</summary>
|
||||||
public void SetFrame (int frameIndex, float time, float x, float y) {
|
public void SetFrame (int frameIndex, float time, float x, float y) {
|
||||||
frameIndex *= 3;
|
frameIndex *= 3;
|
||||||
frames[frameIndex] = time;
|
frames[frameIndex] = time;
|
||||||
@ -360,7 +360,7 @@ namespace Spine {
|
|||||||
frames = new float[frameCount * 5];
|
frames = new float[frameCount * 5];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the time and value of the specified keyframe. */
|
/// <summary>Sets the time and value of the specified keyframe.</summary>
|
||||||
public void setFrame (int frameIndex, float time, float r, float g, float b, float a) {
|
public void setFrame (int frameIndex, float time, float r, float g, float b, float a) {
|
||||||
frameIndex *= 5;
|
frameIndex *= 5;
|
||||||
frames[frameIndex] = time;
|
frames[frameIndex] = time;
|
||||||
@ -428,7 +428,7 @@ namespace Spine {
|
|||||||
attachmentNames = new String[frameCount];
|
attachmentNames = new String[frameCount];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the time and value of the specified keyframe. */
|
/// <summary>Sets the time and value of the specified keyframe.</summary>
|
||||||
public void setFrame (int frameIndex, float time, String attachmentName) {
|
public void setFrame (int frameIndex, float time, String attachmentName) {
|
||||||
frames[frameIndex] = time;
|
frames[frameIndex] = time;
|
||||||
attachmentNames[frameIndex] = attachmentName;
|
attachmentNames[frameIndex] = attachmentName;
|
||||||
@ -463,7 +463,7 @@ namespace Spine {
|
|||||||
events = new Event[frameCount];
|
events = new Event[frameCount];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the time and value of the specified keyframe. */
|
/// <summary>Sets the time and value of the specified keyframe.</summary>
|
||||||
public void setFrame (int frameIndex, float time, Event e) {
|
public void setFrame (int frameIndex, float time, Event e) {
|
||||||
frames[frameIndex] = time;
|
frames[frameIndex] = time;
|
||||||
events[frameIndex] = e;
|
events[frameIndex] = e;
|
||||||
@ -513,8 +513,8 @@ namespace Spine {
|
|||||||
drawOrders = new int[frameCount][];
|
drawOrders = new int[frameCount][];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the time and value of the specified keyframe.
|
/// <summary>Sets the time and value of the specified keyframe.</summary>
|
||||||
* @param drawOrder May be null to use bind pose draw order. */
|
/// <param name="drawOrder">May be null to use bind pose draw order.</param>
|
||||||
public void setFrame (int frameIndex, float time, int[] drawOrder) {
|
public void setFrame (int frameIndex, float time, int[] drawOrder) {
|
||||||
frames[frameIndex] = time;
|
frames[frameIndex] = time;
|
||||||
drawOrders[frameIndex] = drawOrder;
|
drawOrders[frameIndex] = drawOrder;
|
||||||
|
|||||||
@ -167,7 +167,7 @@ namespace Spine {
|
|||||||
return SetAnimation(trackIndex, animation, loop);
|
return SetAnimation(trackIndex, animation, loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set the current animation. Any queued animations are cleared. */
|
/// <summary>Set the current animation. Any queued animations are cleared.</summary>
|
||||||
public TrackEntry SetAnimation (int trackIndex, Animation animation, bool loop) {
|
public TrackEntry SetAnimation (int trackIndex, Animation animation, bool loop) {
|
||||||
TrackEntry entry = new TrackEntry();
|
TrackEntry entry = new TrackEntry();
|
||||||
entry.animation = animation;
|
entry.animation = animation;
|
||||||
@ -184,8 +184,8 @@ namespace Spine {
|
|||||||
return AddAnimation(trackIndex, animation, loop, delay);
|
return AddAnimation(trackIndex, animation, loop, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Adds an animation to be played delay seconds after the current or last queued animation.
|
/// <summary>Adds an animation to be played delay seconds after the current or last queued animation.</summary>
|
||||||
* @param delay May be <= 0 to use duration of previous animation minus any mix duration plus the negative delay. */
|
/// <param name="delay">May be <= 0 to use duration of previous animation minus any mix duration plus the negative delay.</param>
|
||||||
public TrackEntry AddAnimation (int trackIndex, Animation animation, bool loop, float delay) {
|
public TrackEntry AddAnimation (int trackIndex, Animation animation, bool loop, float delay) {
|
||||||
TrackEntry entry = new TrackEntry();
|
TrackEntry entry = new TrackEntry();
|
||||||
entry.animation = animation;
|
entry.animation = animation;
|
||||||
@ -213,7 +213,7 @@ namespace Spine {
|
|||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return May be null. */
|
/// <returns>May be null.</returns>
|
||||||
public TrackEntry GetCurrent (int trackIndex) {
|
public TrackEntry GetCurrent (int trackIndex) {
|
||||||
if (trackIndex >= tracks.Count) return null;
|
if (trackIndex >= tracks.Count) return null;
|
||||||
return tracks[trackIndex];
|
return tracks[trackIndex];
|
||||||
|
|||||||
@ -175,7 +175,7 @@ namespace Spine {
|
|||||||
return line.Substring(colon + 1).Trim();
|
return line.Substring(colon + 1).Trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the number of tuple values read (2 or 4). */
|
/// <summary>Returns the number of tuple values read (2 or 4).</summary>
|
||||||
static int readTuple (TextReader reader, String[] tuple) {
|
static int readTuple (TextReader reader, String[] tuple) {
|
||||||
String line = reader.ReadLine();
|
String line = reader.ReadLine();
|
||||||
int colon = line.IndexOf(':');
|
int colon = line.IndexOf(':');
|
||||||
@ -194,9 +194,9 @@ namespace Spine {
|
|||||||
return i + 1;
|
return i + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the first region found with the specified name. This method uses string comparison to find the region, so the result
|
/// <summary>Returns the first region found with the specified name. This method uses string comparison to find the region, so the result
|
||||||
* should be cached rather than calling this method multiple times.
|
/// should be cached rather than calling this method multiple times.</summary>
|
||||||
* @return The region, or null. */
|
/// <returns>The region, or null.</returns>
|
||||||
public AtlasRegion FindRegion (String name) {
|
public AtlasRegion FindRegion (String name) {
|
||||||
for (int i = 0, n = regions.Count; i < n; i++)
|
for (int i = 0, n = regions.Count; i < n; i++)
|
||||||
if (regions[i].name == name) return regions[i];
|
if (regions[i].name == name) return regions[i];
|
||||||
|
|||||||
@ -35,7 +35,7 @@ using System;
|
|||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
public interface AttachmentLoader {
|
public interface AttachmentLoader {
|
||||||
/** @return May be null to not load any attachment. */
|
/// <return>May be null to not load any attachment.</return>
|
||||||
Attachment NewAttachment (Skin skin, AttachmentType type, String name);
|
Attachment NewAttachment (Skin skin, AttachmentType type, String name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
/** Attachment that has a polygon for bounds checking. */
|
/// <summary>Attachment that has a polygon for bounds checking.</summary>
|
||||||
public class BoundingBoxAttachment : Attachment {
|
public class BoundingBoxAttachment : Attachment {
|
||||||
public float[] Vertices { get; set; }
|
public float[] Vertices { get; set; }
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ namespace Spine {
|
|||||||
: base(name) {
|
: base(name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param worldVertices Must have at least the same length as this attachment's vertices. */
|
/// <param name="worldVertices">Must have at least the same length as this attachment's vertices.</param>
|
||||||
public void ComputeWorldVertices (float x, float y, Bone bone, float[] worldVertices) {
|
public void ComputeWorldVertices (float x, float y, Bone bone, float[] worldVertices) {
|
||||||
x += bone.worldX;
|
x += bone.worldX;
|
||||||
y += bone.worldY;
|
y += bone.worldY;
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
/** Attachment that displays a texture region. */
|
/// <summary>Attachment that displays a texture region.</summary>
|
||||||
public class RegionAttachment : Attachment {
|
public class RegionAttachment : Attachment {
|
||||||
public const int X1 = 0;
|
public const int X1 = 0;
|
||||||
public const int Y1 = 1;
|
public const int Y1 = 1;
|
||||||
|
|||||||
@ -61,7 +61,7 @@ namespace Spine {
|
|||||||
public float WorldScaleX { get { return worldScaleX; } }
|
public float WorldScaleX { get { return worldScaleX; } }
|
||||||
public float WorldScaleY { get { return worldScaleY; } }
|
public float WorldScaleY { get { return worldScaleY; } }
|
||||||
|
|
||||||
/** @param parent May be null. */
|
/// <param name="parent">May be null.</param>
|
||||||
public Bone (BoneData data, Bone parent) {
|
public Bone (BoneData data, Bone parent) {
|
||||||
if (data == null) throw new ArgumentNullException("data cannot be null.");
|
if (data == null) throw new ArgumentNullException("data cannot be null.");
|
||||||
this.data = data;
|
this.data = data;
|
||||||
@ -69,7 +69,7 @@ namespace Spine {
|
|||||||
SetToSetupPose();
|
SetToSetupPose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Computes the world SRT using the parent bone and the local SRT. */
|
/// <summary>Computes the world SRT using the parent bone and the local SRT.</summary>
|
||||||
public void UpdateWorldTransform (bool flipX, bool flipY) {
|
public void UpdateWorldTransform (bool flipX, bool flipY) {
|
||||||
Bone parent = this.parent;
|
Bone parent = this.parent;
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
|
|||||||
@ -40,7 +40,7 @@ namespace Spine {
|
|||||||
internal float length, x, y, rotation, scaleX = 1, scaleY = 1;
|
internal float length, x, y, rotation, scaleX = 1, scaleY = 1;
|
||||||
internal bool inheritScale, inheritRotation;
|
internal bool inheritScale, inheritRotation;
|
||||||
|
|
||||||
/** May be null. */
|
/// <summary>May be null.</summary>
|
||||||
public BoneData Parent { get { return parent; } }
|
public BoneData Parent { get { return parent; } }
|
||||||
public String Name { get { return name; } }
|
public String Name { get { return name; } }
|
||||||
public float Length { get { return length; } set { length = value; } }
|
public float Length { get { return length; } set { length = value; } }
|
||||||
@ -52,7 +52,7 @@ namespace Spine {
|
|||||||
public bool InheritScale { get { return inheritScale; } set { inheritScale = value; } }
|
public bool InheritScale { get { return inheritScale; } set { inheritScale = value; } }
|
||||||
public bool InheritRotation { get { return inheritRotation; } set { inheritRotation = value; } }
|
public bool InheritRotation { get { return inheritRotation; } set { inheritRotation = value; } }
|
||||||
|
|
||||||
/** @param parent May be null. */
|
/// <param name="parent">May be null.</param>
|
||||||
public BoneData (String name, BoneData parent) {
|
public BoneData (String name, BoneData parent) {
|
||||||
if (name == null) throw new ArgumentNullException("name cannot be null.");
|
if (name == null) throw new ArgumentNullException("name cannot be null.");
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|||||||
@ -87,7 +87,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Updates the world transform for each bone. */
|
/// <summary>Updates the world transform for each bone.</summary>
|
||||||
public void UpdateWorldTransform () {
|
public void UpdateWorldTransform () {
|
||||||
bool flipX = this.flipX;
|
bool flipX = this.flipX;
|
||||||
bool flipY = this.flipY;
|
bool flipY = this.flipY;
|
||||||
@ -96,7 +96,7 @@ namespace Spine {
|
|||||||
bones[i].UpdateWorldTransform(flipX, flipY);
|
bones[i].UpdateWorldTransform(flipX, flipY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the bones and slots to their setup pose values. */
|
/// <summary>Sets the bones and slots to their setup pose values.</summary>
|
||||||
public void SetToSetupPose () {
|
public void SetToSetupPose () {
|
||||||
SetBonesToSetupPose();
|
SetBonesToSetupPose();
|
||||||
SetSlotsToSetupPose();
|
SetSlotsToSetupPose();
|
||||||
@ -116,7 +116,7 @@ namespace Spine {
|
|||||||
slots[i].SetToSetupPose(i);
|
slots[i].SetToSetupPose(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return May be null. */
|
/// <returns>May be null.</returns>
|
||||||
public Bone FindBone (String boneName) {
|
public Bone FindBone (String boneName) {
|
||||||
if (boneName == null) throw new ArgumentNullException("boneName cannot be null.");
|
if (boneName == null) throw new ArgumentNullException("boneName cannot be null.");
|
||||||
List<Bone> bones = this.bones;
|
List<Bone> bones = this.bones;
|
||||||
@ -127,7 +127,7 @@ namespace Spine {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return -1 if the bone was not found. */
|
/// <returns>-1 if the bone was not found.</returns>
|
||||||
public int FindBoneIndex (String boneName) {
|
public int FindBoneIndex (String boneName) {
|
||||||
if (boneName == null) throw new ArgumentNullException("boneName cannot be null.");
|
if (boneName == null) throw new ArgumentNullException("boneName cannot be null.");
|
||||||
List<Bone> bones = this.bones;
|
List<Bone> bones = this.bones;
|
||||||
@ -136,7 +136,7 @@ namespace Spine {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return May be null. */
|
/// <returns>May be null.</returns>
|
||||||
public Slot FindSlot (String slotName) {
|
public Slot FindSlot (String slotName) {
|
||||||
if (slotName == null) throw new ArgumentNullException("slotName cannot be null.");
|
if (slotName == null) throw new ArgumentNullException("slotName cannot be null.");
|
||||||
List<Slot> slots = this.slots;
|
List<Slot> slots = this.slots;
|
||||||
@ -147,7 +147,7 @@ namespace Spine {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return -1 if the bone was not found. */
|
/// <returns>-1 if the bone was not found.</returns>
|
||||||
public int FindSlotIndex (String slotName) {
|
public int FindSlotIndex (String slotName) {
|
||||||
if (slotName == null) throw new ArgumentNullException("slotName cannot be null.");
|
if (slotName == null) throw new ArgumentNullException("slotName cannot be null.");
|
||||||
List<Slot> slots = this.slots;
|
List<Slot> slots = this.slots;
|
||||||
@ -156,28 +156,27 @@ namespace Spine {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets a skin by name.
|
/// <summary>Sets a skin by name (see setSkin).</summary>
|
||||||
* @see #setSkin(Skin) */
|
|
||||||
public void SetSkin (String skinName) {
|
public void SetSkin (String skinName) {
|
||||||
Skin skin = data.FindSkin(skinName);
|
Skin skin = data.FindSkin(skinName);
|
||||||
if (skin == null) throw new ArgumentException("Skin not found: " + skinName);
|
if (skin == null) throw new ArgumentException("Skin not found: " + skinName);
|
||||||
SetSkin(skin);
|
SetSkin(skin);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the skin used to look up attachments not found in the {@link SkeletonData#getDefaultSkin() default skin}. Attachments
|
/// <summary>Sets the skin used to look up attachments not found in the {@link SkeletonData#getDefaultSkin() default skin}. Attachments
|
||||||
* from the new skin are attached if the corresponding attachment from the old skin was attached.
|
/// from the new skin are attached if the corresponding attachment from the old skin was attached.</summary>
|
||||||
* @param newSkin May be null. */
|
/// <param name="newSkin">May be null.</param>
|
||||||
public void SetSkin (Skin newSkin) {
|
public void SetSkin (Skin newSkin) {
|
||||||
if (skin != null && newSkin != null) newSkin.AttachAll(this, skin);
|
if (skin != null && newSkin != null) newSkin.AttachAll(this, skin);
|
||||||
skin = newSkin;
|
skin = newSkin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return May be null. */
|
/// <returns>May be null.</returns>
|
||||||
public Attachment GetAttachment (String slotName, String attachmentName) {
|
public Attachment GetAttachment (String slotName, String attachmentName) {
|
||||||
return GetAttachment(data.FindSlotIndex(slotName), attachmentName);
|
return GetAttachment(data.FindSlotIndex(slotName), attachmentName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return May be null. */
|
/// <returns>May be null.</returns>
|
||||||
public Attachment GetAttachment (int slotIndex, String attachmentName) {
|
public Attachment GetAttachment (int slotIndex, String attachmentName) {
|
||||||
if (attachmentName == null) throw new ArgumentNullException("attachmentName cannot be null.");
|
if (attachmentName == null) throw new ArgumentNullException("attachmentName cannot be null.");
|
||||||
if (skin != null) {
|
if (skin != null) {
|
||||||
@ -188,7 +187,7 @@ namespace Spine {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param attachmentName May be null. */
|
/// <param name="attachmentName">May be null.</param>
|
||||||
public void SetAttachment (String slotName, String attachmentName) {
|
public void SetAttachment (String slotName, String attachmentName) {
|
||||||
if (slotName == null) throw new ArgumentNullException("slotName cannot be null.");
|
if (slotName == null) throw new ArgumentNullException("slotName cannot be null.");
|
||||||
List<Slot> slots = this.slots;
|
List<Slot> slots = this.slots;
|
||||||
|
|||||||
@ -111,12 +111,12 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Returns true if the axis aligned bounding box contains the point. */
|
/// <summary>Returns true if the axis aligned bounding box contains the point.</summary>
|
||||||
public bool AabbContainsPoint (float x, float y) {
|
public bool AabbContainsPoint (float x, float y) {
|
||||||
return x >= minX && x <= maxX && y >= minY && y <= maxY;
|
return x >= minX && x <= maxX && y >= minY && y <= maxY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns true if the axis aligned bounding box intersects the line segment. */
|
/// <summary>Returns true if the axis aligned bounding box intersects the line segment.</summary>
|
||||||
public bool AabbIntersectsSegment (float x1, float y1, float x2, float y2) {
|
public bool AabbIntersectsSegment (float x1, float y1, float x2, float y2) {
|
||||||
float minX = this.minX;
|
float minX = this.minX;
|
||||||
float minY = this.minY;
|
float minY = this.minY;
|
||||||
@ -136,12 +136,12 @@ namespace Spine {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */
|
/// <summary>Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds.</summary>
|
||||||
public bool AabbIntersectsSkeleton (SkeletonBounds bounds) {
|
public bool AabbIntersectsSkeleton (SkeletonBounds bounds) {
|
||||||
return minX < bounds.maxX && maxX > bounds.minX && minY < bounds.maxY && maxY > bounds.minY;
|
return minX < bounds.maxX && maxX > bounds.minX && minY < bounds.maxY && maxY > bounds.minY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns true if the polygon contains the point. */
|
/// <summary>Returns true if the polygon contains the point.</summary>
|
||||||
public bool ContainsPoint (Polygon polygon, float x, float y) {
|
public bool ContainsPoint (Polygon polygon, float x, float y) {
|
||||||
float[] vertices = polygon.Vertices;
|
float[] vertices = polygon.Vertices;
|
||||||
int nn = polygon.Count;
|
int nn = polygon.Count;
|
||||||
@ -160,8 +160,8 @@ namespace Spine {
|
|||||||
return inside;
|
return inside;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more
|
/// <summary>Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more
|
||||||
* efficient to only call this method if {@link #aabbContainsPoint(float, float)} returns true. */
|
/// efficient to only call this method if {@link #aabbContainsPoint(float, float)} returns true.</summary>
|
||||||
public BoundingBoxAttachment ContainsPoint (float x, float y) {
|
public BoundingBoxAttachment ContainsPoint (float x, float y) {
|
||||||
List<Polygon> polygons = Polygons;
|
List<Polygon> polygons = Polygons;
|
||||||
for (int i = 0, n = polygons.Count; i < n; i++)
|
for (int i = 0, n = polygons.Count; i < n; i++)
|
||||||
@ -169,8 +169,8 @@ namespace Spine {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the first bounding box attachment that contains the line segment, or null. When doing many checks, it is usually
|
/// <summary>Returns the first bounding box attachment that contains the line segment, or null. When doing many checks, it is usually
|
||||||
* more efficient to only call this method if {@link #aabbIntersectsSegment(float, float, float, float)} returns true. */
|
/// more efficient to only call this method if {@link #aabbIntersectsSegment(float, float, float, float)} returns true.</summary>
|
||||||
public BoundingBoxAttachment IntersectsSegment (float x1, float y1, float x2, float y2) {
|
public BoundingBoxAttachment IntersectsSegment (float x1, float y1, float x2, float y2) {
|
||||||
List<Polygon> polygons = Polygons;
|
List<Polygon> polygons = Polygons;
|
||||||
for (int i = 0, n = polygons.Count; i < n; i++)
|
for (int i = 0, n = polygons.Count; i < n; i++)
|
||||||
@ -178,7 +178,7 @@ namespace Spine {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns true if the polygon contains the line segment. */
|
/// <summary>Returns true if the polygon contains the line segment.</summary>
|
||||||
public bool IntersectsSegment (Polygon polygon, float x1, float y1, float x2, float y2) {
|
public bool IntersectsSegment (Polygon polygon, float x1, float y1, float x2, float y2) {
|
||||||
float[] vertices = polygon.Vertices;
|
float[] vertices = polygon.Vertices;
|
||||||
int nn = polygon.Count;
|
int nn = polygon.Count;
|
||||||
|
|||||||
@ -48,7 +48,7 @@ namespace Spine {
|
|||||||
public List<BoneData> Bones { get { return bones; } } // Ordered parents first.
|
public List<BoneData> Bones { get { return bones; } } // Ordered parents first.
|
||||||
public List<SlotData> Slots { get { return slots; } } // Setup pose draw order.
|
public List<SlotData> Slots { get { return slots; } } // Setup pose draw order.
|
||||||
public List<Skin> Skins { get { return skins; } set { skins = value; } }
|
public List<Skin> Skins { get { return skins; } set { skins = value; } }
|
||||||
/** May be null. */
|
/// <summary>May be null.</summary>
|
||||||
public Skin DefaultSkin { get { return defaultSkin; } set { defaultSkin = value; } }
|
public Skin DefaultSkin { get { return defaultSkin; } set { defaultSkin = value; } }
|
||||||
public List<EventData> Events { get { return events; } set { events = value; } }
|
public List<EventData> Events { get { return events; } set { events = value; } }
|
||||||
public List<Animation> Animations { get { return animations; } set { animations = value; } }
|
public List<Animation> Animations { get { return animations; } set { animations = value; } }
|
||||||
@ -61,7 +61,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** @return May be null. */
|
/// <returns>May be null.</returns>
|
||||||
public BoneData FindBone (String boneName) {
|
public BoneData FindBone (String boneName) {
|
||||||
if (boneName == null) throw new ArgumentNullException("boneName cannot be null.");
|
if (boneName == null) throw new ArgumentNullException("boneName cannot be null.");
|
||||||
List<BoneData> bones = this.bones;
|
List<BoneData> bones = this.bones;
|
||||||
@ -72,7 +72,7 @@ namespace Spine {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return -1 if the bone was not found. */
|
/// <returns>-1 if the bone was not found.</returns>
|
||||||
public int FindBoneIndex (String boneName) {
|
public int FindBoneIndex (String boneName) {
|
||||||
if (boneName == null) throw new ArgumentNullException("boneName cannot be null.");
|
if (boneName == null) throw new ArgumentNullException("boneName cannot be null.");
|
||||||
List<BoneData> bones = this.bones;
|
List<BoneData> bones = this.bones;
|
||||||
@ -88,7 +88,7 @@ namespace Spine {
|
|||||||
slots.Add(slot);
|
slots.Add(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return May be null. */
|
/// <returns>May be null.</returns>
|
||||||
public SlotData FindSlot (String slotName) {
|
public SlotData FindSlot (String slotName) {
|
||||||
if (slotName == null) throw new ArgumentNullException("slotName cannot be null.");
|
if (slotName == null) throw new ArgumentNullException("slotName cannot be null.");
|
||||||
List<SlotData> slots = this.slots;
|
List<SlotData> slots = this.slots;
|
||||||
@ -99,7 +99,7 @@ namespace Spine {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return -1 if the bone was not found. */
|
/// <returns>-1 if the bone was not found.</returns>
|
||||||
public int FindSlotIndex (String slotName) {
|
public int FindSlotIndex (String slotName) {
|
||||||
if (slotName == null) throw new ArgumentNullException("slotName cannot be null.");
|
if (slotName == null) throw new ArgumentNullException("slotName cannot be null.");
|
||||||
List<SlotData> slots = this.slots;
|
List<SlotData> slots = this.slots;
|
||||||
@ -115,7 +115,7 @@ namespace Spine {
|
|||||||
skins.Add(skin);
|
skins.Add(skin);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return May be null. */
|
/// <returns>May be null.</returns>
|
||||||
public Skin FindSkin (String skinName) {
|
public Skin FindSkin (String skinName) {
|
||||||
if (skinName == null) throw new ArgumentNullException("skinName cannot be null.");
|
if (skinName == null) throw new ArgumentNullException("skinName cannot be null.");
|
||||||
foreach (Skin skin in skins)
|
foreach (Skin skin in skins)
|
||||||
@ -130,7 +130,7 @@ namespace Spine {
|
|||||||
events.Add(eventData);
|
events.Add(eventData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return May be null. */
|
/// <returns>May be null.</returns>
|
||||||
public EventData findEvent (String eventDataName) {
|
public EventData findEvent (String eventDataName) {
|
||||||
if (eventDataName == null) throw new ArgumentNullException("eventDataName cannot be null.");
|
if (eventDataName == null) throw new ArgumentNullException("eventDataName cannot be null.");
|
||||||
foreach (EventData eventData in events)
|
foreach (EventData eventData in events)
|
||||||
@ -145,7 +145,7 @@ namespace Spine {
|
|||||||
animations.Add(animation);
|
animations.Add(animation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return May be null. */
|
/// <returns>May be null.</returns>
|
||||||
public Animation FindAnimation (String animationName) {
|
public Animation FindAnimation (String animationName) {
|
||||||
if (animationName == null) throw new ArgumentNullException("animationName cannot be null.");
|
if (animationName == null) throw new ArgumentNullException("animationName cannot be null.");
|
||||||
List<Animation> animations = this.animations;
|
List<Animation> animations = this.animations;
|
||||||
|
|||||||
@ -35,7 +35,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
/** Stores attachments by slot index and attachment name. */
|
/// <summary>Stores attachments by slot index and attachment name.</summary>
|
||||||
public class Skin {
|
public class Skin {
|
||||||
internal String name;
|
internal String name;
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ namespace Spine {
|
|||||||
attachments.Add(new KeyValuePair<int, String>(slotIndex, name), attachment);
|
attachments.Add(new KeyValuePair<int, String>(slotIndex, name), attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return May be null. */
|
/// <returns>May be null.</returns>
|
||||||
public Attachment GetAttachment (int slotIndex, String name) {
|
public Attachment GetAttachment (int slotIndex, String name) {
|
||||||
Attachment attachment;
|
Attachment attachment;
|
||||||
attachments.TryGetValue(new KeyValuePair<int, String>(slotIndex, name), out attachment);
|
attachments.TryGetValue(new KeyValuePair<int, String>(slotIndex, name), out attachment);
|
||||||
@ -75,7 +75,7 @@ namespace Spine {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Attach all attachments from this skin if the corresponding attachment from the old skin is currently attached. */
|
/// <summary>Attach all attachments from this skin if the corresponding attachment from the old skin is currently attached.</summary>
|
||||||
internal void AttachAll (Skeleton skeleton, Skin oldSkin) {
|
internal void AttachAll (Skeleton skeleton, Skin oldSkin) {
|
||||||
foreach (KeyValuePair<KeyValuePair<int, String>, Attachment> entry in oldSkin.attachments) {
|
foreach (KeyValuePair<KeyValuePair<int, String>, Attachment> entry in oldSkin.attachments) {
|
||||||
int slotIndex = entry.Key.Key;
|
int slotIndex = entry.Key.Key;
|
||||||
|
|||||||
@ -50,7 +50,7 @@ namespace Spine {
|
|||||||
public float B { get { return b; } set { b = value; } }
|
public float B { get { return b; } set { b = value; } }
|
||||||
public float A { get { return a; } set { a = value; } }
|
public float A { get { return a; } set { a = value; } }
|
||||||
|
|
||||||
/** May be null. */
|
/// <summary>May be null.</summary>
|
||||||
public Attachment Attachment {
|
public Attachment Attachment {
|
||||||
get {
|
get {
|
||||||
return attachment;
|
return attachment;
|
||||||
|
|||||||
@ -47,7 +47,7 @@ namespace Spine {
|
|||||||
public float G { get { return g; } set { g = value; } }
|
public float G { get { return g; } set { g = value; } }
|
||||||
public float B { get { return b; } set { b = value; } }
|
public float B { get { return b; } set { b = value; } }
|
||||||
public float A { get { return a; } set { a = value; } }
|
public float A { get { return a; } set { a = value; } }
|
||||||
/** @param attachmentName May be null. */
|
/// <summary>May be null.</summary>
|
||||||
public String AttachmentName { get { return attachmentName; } set { attachmentName = value; } }
|
public String AttachmentName { get { return attachmentName; } set { attachmentName = value; } }
|
||||||
public bool AdditiveBlending { get { return additiveBlending; } set { additiveBlending = value; } }
|
public bool AdditiveBlending { get { return additiveBlending; } set { additiveBlending = value; } }
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user