mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Merge branch '3.6-beta' of https://github.com/esotericsoftware/spine-runtimes into 3.6-beta
This commit is contained in:
commit
10a11fd74b
@ -565,15 +565,15 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override public int PropertyId {
|
||||||
|
get { return ((int)TimelineType.TwoColor << 24) + slotIndex; }
|
||||||
|
}
|
||||||
|
|
||||||
public TwoColorTimeline (int frameCount) :
|
public TwoColorTimeline (int frameCount) :
|
||||||
base(frameCount) {
|
base(frameCount) {
|
||||||
frames = new float[frameCount * ENTRIES];
|
frames = new float[frameCount * ENTRIES];
|
||||||
}
|
}
|
||||||
|
|
||||||
override public int PropertyId {
|
|
||||||
get { return ((int)TimelineType.TwoColor << 24) + slotIndex; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Sets the time and value of the specified keyframe.</summary>
|
/// <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, float r2, float g2, float b2) {
|
public void SetFrame (int frameIndex, float time, float r, float g, float b, float a, float r2, float g2, float b2) {
|
||||||
frameIndex *= ENTRIES;
|
frameIndex *= ENTRIES;
|
||||||
|
|||||||
@ -65,19 +65,49 @@ namespace Spine {
|
|||||||
public ExposedList<Bone> Children { get { return children; } }
|
public ExposedList<Bone> Children { get { return children; } }
|
||||||
/// <summary>The local X translation.</summary>
|
/// <summary>The local X translation.</summary>
|
||||||
public float X { get { return x; } set { x = value; } }
|
public float X { get { return x; } set { x = value; } }
|
||||||
|
/// <summary>The local Y translation.</summary>
|
||||||
public float Y { get { return y; } set { y = value; } }
|
public float Y { get { return y; } set { y = value; } }
|
||||||
|
/// <summary>The local rotation.</summary>
|
||||||
public float Rotation { get { return rotation; } set { rotation = value; } }
|
public float Rotation { get { return rotation; } set { rotation = value; } }
|
||||||
|
|
||||||
|
/// <summary>The local scaleX.</summary>
|
||||||
|
public float ScaleX { get { return scaleX; } set { scaleX = value; } }
|
||||||
|
|
||||||
|
/// <summary>The local scaleY.</summary>
|
||||||
|
public float ScaleY { get { return scaleY; } set { scaleY = value; } }
|
||||||
|
|
||||||
|
/// <summary>The local shearX.</summary>
|
||||||
|
public float ShearX { get { return shearX; } set { shearX = value; } }
|
||||||
|
|
||||||
|
/// <summary>The local shearY.</summary>
|
||||||
|
public float ShearY { get { return shearY; } set { shearY = value; } }
|
||||||
|
|
||||||
/// <summary>The rotation, as calculated by any constraints.</summary>
|
/// <summary>The rotation, as calculated by any constraints.</summary>
|
||||||
public float AppliedRotation { get { return arotation; } set { arotation = value; } }
|
public float AppliedRotation { get { return arotation; } set { arotation = value; } }
|
||||||
public float ScaleX { get { return scaleX; } set { scaleX = value; } }
|
|
||||||
public float ScaleY { get { return scaleY; } set { scaleY = value; } }
|
/// <summary>The applied local x translation.</summary>
|
||||||
public float ShearX { get { return shearX; } set { shearX = value; } }
|
public float AX { get { return ax; } set { ax = value; } }
|
||||||
public float ShearY { get { return shearY; } set { shearY = value; } }
|
|
||||||
|
/// <summary>The applied local y translation.</summary>
|
||||||
|
public float AY { get { return ay; } set { ay = value; } }
|
||||||
|
|
||||||
|
/// <summary>The applied local scaleX.</summary>
|
||||||
|
public float AScaleX { get { return ascaleX; } set { ascaleX = value; } }
|
||||||
|
|
||||||
|
/// <summary>The applied local scaleY.</summary>
|
||||||
|
public float AScaleY { get { return ascaleY; } set { ascaleY = value; } }
|
||||||
|
|
||||||
|
/// <summary>The applied local shearX.</summary>
|
||||||
|
public float AShearX { get { return ashearX; } set { ashearX = value; } }
|
||||||
|
|
||||||
|
/// <summary>The applied local shearY.</summary>
|
||||||
|
public float AShearY { get { return ashearY; } set { ashearY = value; } }
|
||||||
|
|
||||||
public float A { get { return a; } }
|
public float A { get { return a; } }
|
||||||
public float B { get { return b; } }
|
public float B { get { return b; } }
|
||||||
public float C { get { return c; } }
|
public float C { get { return c; } }
|
||||||
public float D { get { return d; } }
|
public float D { get { return d; } }
|
||||||
|
|
||||||
public float WorldX { get { return worldX; } }
|
public float WorldX { get { return worldX; } }
|
||||||
public float WorldY { get { return worldY; } }
|
public float WorldY { get { return worldY; } }
|
||||||
public float WorldRotationX { get { return MathUtils.Atan2(c, a) * MathUtils.RadDeg; } }
|
public float WorldRotationX { get { return MathUtils.Atan2(c, a) * MathUtils.RadDeg; } }
|
||||||
@ -337,6 +367,10 @@ namespace Spine {
|
|||||||
return MathUtils.Atan2(cos * c + sin * d, cos * a + sin * b) * MathUtils.RadDeg;
|
return MathUtils.Atan2(cos * c + sin * d, cos * a + sin * b) * MathUtils.RadDeg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Rotates the world transform the specified amount and sets isAppliedValid to false.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="degrees">Degrees.</param>
|
||||||
public void RotateWorld (float degrees) {
|
public void RotateWorld (float degrees) {
|
||||||
float a = this.a, b = this.b, c = this.c, d = this.d;
|
float a = this.a, b = this.b, c = this.c, d = this.d;
|
||||||
float cos = MathUtils.CosDeg(degrees), sin = MathUtils.SinDeg(degrees);
|
float cos = MathUtils.CosDeg(degrees), sin = MathUtils.SinDeg(degrees);
|
||||||
@ -347,7 +381,7 @@ namespace Spine {
|
|||||||
appliedValid = false;
|
appliedValid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
override public String ToString () {
|
override public string ToString () {
|
||||||
return data.name;
|
return data.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,32 +33,49 @@ using System;
|
|||||||
namespace Spine {
|
namespace Spine {
|
||||||
public class BoneData {
|
public class BoneData {
|
||||||
internal int index;
|
internal int index;
|
||||||
internal String name;
|
internal string name;
|
||||||
internal BoneData parent;
|
internal BoneData parent;
|
||||||
internal float length;
|
internal float length;
|
||||||
internal float x, y, rotation, scaleX = 1, scaleY = 1, shearX, shearY;
|
internal float x, y, rotation, scaleX = 1, scaleY = 1, shearX, shearY;
|
||||||
internal TransformMode transformMode = TransformMode.Normal;
|
internal TransformMode transformMode = TransformMode.Normal;
|
||||||
//internal bool inheritRotation = true, inheritScale = true;
|
|
||||||
|
/// <summary>The index of the bone in Skeleton.Bones</summary>
|
||||||
|
public int Index { get { return index; } }
|
||||||
|
|
||||||
|
/// <summary>The name of the bone, which is unique within the skeleton.</summary>
|
||||||
|
public string Name { get { return name; } }
|
||||||
|
|
||||||
/// <summary>May be null.</summary>
|
/// <summary>May be null.</summary>
|
||||||
public int Index { get { return index; } }
|
|
||||||
public String Name { get { return name; } }
|
|
||||||
public BoneData Parent { get { return parent; } }
|
public BoneData Parent { get { return parent; } }
|
||||||
public float Length { get { return length; } set { length = value; } }
|
|
||||||
public float X { get { return x; } set { x = value; } }
|
|
||||||
public float Y { get { return y; } set { y = value; } }
|
|
||||||
public float Rotation { get { return rotation; } set { rotation = value; } }
|
|
||||||
public float ScaleX { get { return scaleX; } set { scaleX = value; } }
|
|
||||||
public float ScaleY { get { return scaleY; } set { scaleY = value; } }
|
|
||||||
public float ShearX { get { return shearX; } set { shearX = value; } }
|
|
||||||
public float ShearY { get { return shearY; } set { shearY = value; } }
|
|
||||||
public TransformMode TransformMode { get { return transformMode; } set { transformMode = value; } }
|
|
||||||
// public bool InheritRotation { get { return inheritRotation; } set { inheritRotation = value; } }
|
|
||||||
// public bool InheritScale { get { return inheritScale; } set { inheritScale = value; } }
|
|
||||||
|
|
||||||
|
public float Length { get { return length; } set { length = value; } }
|
||||||
|
|
||||||
|
/// <summary>Local X translation.</summary>
|
||||||
|
public float X { get { return x; } set { x = value; } }
|
||||||
|
|
||||||
|
/// <summary>Local Y translation.</summary>
|
||||||
|
public float Y { get { return y; } set { y = value; } }
|
||||||
|
|
||||||
|
/// <summary>Local rotation.</summary>
|
||||||
|
public float Rotation { get { return rotation; } set { rotation = value; } }
|
||||||
|
|
||||||
|
/// <summary>Local scaleX.</summary>
|
||||||
|
public float ScaleX { get { return scaleX; } set { scaleX = value; } }
|
||||||
|
|
||||||
|
/// <summary>Local scaleY.</summary>
|
||||||
|
public float ScaleY { get { return scaleY; } set { scaleY = value; } }
|
||||||
|
|
||||||
|
/// <summary>Local shearX.</summary>
|
||||||
|
public float ShearX { get { return shearX; } set { shearX = value; } }
|
||||||
|
|
||||||
|
/// <summary>Local shearY.</summary>
|
||||||
|
public float ShearY { get { return shearY; } set { shearY = value; } }
|
||||||
|
|
||||||
|
/// <summary>The transform mode for how parent world transforms affect this bone.</summary>
|
||||||
|
public TransformMode TransformMode { get { return transformMode; } set { transformMode = value; } }
|
||||||
|
|
||||||
/// <param name="parent">May be null.</param>
|
/// <param name="parent">May be null.</param>
|
||||||
public BoneData (int index, String name, BoneData parent) {
|
public BoneData (int index, string name, BoneData parent) {
|
||||||
if (index < 0) throw new ArgumentException("index must be >= 0", "index");
|
if (index < 0) throw new ArgumentException("index must be >= 0", "index");
|
||||||
if (name == null) throw new ArgumentNullException("name", "name cannot be null.");
|
if (name == null) throw new ArgumentNullException("name", "name cannot be null.");
|
||||||
this.index = index;
|
this.index = index;
|
||||||
@ -66,14 +83,14 @@ namespace Spine {
|
|||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
override public String ToString () {
|
override public string ToString () {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum TransformMode {
|
public enum TransformMode {
|
||||||
//0000 0FSR
|
//0000 0 Flip Scale Rotation
|
||||||
Normal = 0, // 0000
|
Normal = 0, // 0000
|
||||||
OnlyTranslation = 7, // 0111
|
OnlyTranslation = 7, // 0111
|
||||||
NoRotationOrReflection = 1, // 0001
|
NoRotationOrReflection = 1, // 0001
|
||||||
|
|||||||
@ -339,7 +339,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <returns>May be null.</returns>
|
/// <returns>May be null.</returns>
|
||||||
public Bone FindBone (String boneName) {
|
public Bone FindBone (string boneName) {
|
||||||
if (boneName == null) throw new ArgumentNullException("boneName", "boneName cannot be null.");
|
if (boneName == null) throw new ArgumentNullException("boneName", "boneName cannot be null.");
|
||||||
var bones = this.bones;
|
var bones = this.bones;
|
||||||
var bonesItems = bones.Items;
|
var bonesItems = bones.Items;
|
||||||
@ -351,7 +351,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <returns>-1 if the bone was not found.</returns>
|
/// <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", "boneName cannot be null.");
|
if (boneName == null) throw new ArgumentNullException("boneName", "boneName cannot be null.");
|
||||||
var bones = this.bones;
|
var bones = this.bones;
|
||||||
var bonesItems = bones.Items;
|
var bonesItems = bones.Items;
|
||||||
@ -361,7 +361,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <returns>May be null.</returns>
|
/// <returns>May be null.</returns>
|
||||||
public Slot FindSlot (String slotName) {
|
public Slot FindSlot (string slotName) {
|
||||||
if (slotName == null) throw new ArgumentNullException("slotName", "slotName cannot be null.");
|
if (slotName == null) throw new ArgumentNullException("slotName", "slotName cannot be null.");
|
||||||
var slots = this.slots;
|
var slots = this.slots;
|
||||||
var slotsItems = slots.Items;
|
var slotsItems = slots.Items;
|
||||||
@ -373,7 +373,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <returns>-1 if the bone was not found.</returns>
|
/// <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", "slotName cannot be null.");
|
if (slotName == null) throw new ArgumentNullException("slotName", "slotName cannot be null.");
|
||||||
var slots = this.slots;
|
var slots = this.slots;
|
||||||
var slotsItems = slots.Items;
|
var slotsItems = slots.Items;
|
||||||
@ -383,7 +383,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Sets a skin by name (see SetSkin).</summary>
|
/// <summary>Sets a skin by name (see SetSkin).</summary>
|
||||||
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, "skinName");
|
if (skin == null) throw new ArgumentException("Skin not found: " + skinName, "skinName");
|
||||||
SetSkin(skin);
|
SetSkin(skin);
|
||||||
@ -401,7 +401,7 @@ namespace Spine {
|
|||||||
ExposedList<Slot> slots = this.slots;
|
ExposedList<Slot> slots = this.slots;
|
||||||
for (int i = 0, n = slots.Count; i < n; i++) {
|
for (int i = 0, n = slots.Count; i < n; i++) {
|
||||||
Slot slot = slots.Items[i];
|
Slot slot = slots.Items[i];
|
||||||
String name = slot.data.attachmentName;
|
string name = slot.data.attachmentName;
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
Attachment attachment = newSkin.GetAttachment(i, name);
|
Attachment attachment = newSkin.GetAttachment(i, name);
|
||||||
if (attachment != null) slot.Attachment = attachment;
|
if (attachment != null) slot.Attachment = attachment;
|
||||||
@ -413,12 +413,12 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <returns>May be null.</returns>
|
/// <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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <returns>May be null.</returns>
|
/// <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", "attachmentName cannot be null.");
|
if (attachmentName == null) throw new ArgumentNullException("attachmentName", "attachmentName cannot be null.");
|
||||||
if (skin != null) {
|
if (skin != null) {
|
||||||
Attachment attachment = skin.GetAttachment(slotIndex, attachmentName);
|
Attachment attachment = skin.GetAttachment(slotIndex, attachmentName);
|
||||||
@ -429,7 +429,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <param name="attachmentName">May be null.</param>
|
/// <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", "slotName cannot be null.");
|
if (slotName == null) throw new ArgumentNullException("slotName", "slotName cannot be null.");
|
||||||
ExposedList<Slot> slots = this.slots;
|
ExposedList<Slot> slots = this.slots;
|
||||||
for (int i = 0, n = slots.Count; i < n; i++) {
|
for (int i = 0, n = slots.Count; i < n; i++) {
|
||||||
@ -448,7 +448,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <returns>May be null.</returns>
|
/// <returns>May be null.</returns>
|
||||||
public IkConstraint FindIkConstraint (String constraintName) {
|
public IkConstraint FindIkConstraint (string constraintName) {
|
||||||
if (constraintName == null) throw new ArgumentNullException("constraintName", "constraintName cannot be null.");
|
if (constraintName == null) throw new ArgumentNullException("constraintName", "constraintName cannot be null.");
|
||||||
ExposedList<IkConstraint> ikConstraints = this.ikConstraints;
|
ExposedList<IkConstraint> ikConstraints = this.ikConstraints;
|
||||||
for (int i = 0, n = ikConstraints.Count; i < n; i++) {
|
for (int i = 0, n = ikConstraints.Count; i < n; i++) {
|
||||||
@ -459,7 +459,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <returns>May be null.</returns>
|
/// <returns>May be null.</returns>
|
||||||
public TransformConstraint FindTransformConstraint (String constraintName) {
|
public TransformConstraint FindTransformConstraint (string constraintName) {
|
||||||
if (constraintName == null) throw new ArgumentNullException("constraintName", "constraintName cannot be null.");
|
if (constraintName == null) throw new ArgumentNullException("constraintName", "constraintName cannot be null.");
|
||||||
ExposedList<TransformConstraint> transformConstraints = this.transformConstraints;
|
ExposedList<TransformConstraint> transformConstraints = this.transformConstraints;
|
||||||
for (int i = 0, n = transformConstraints.Count; i < n; i++) {
|
for (int i = 0, n = transformConstraints.Count; i < n; i++) {
|
||||||
@ -470,7 +470,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <returns>May be null.</returns>
|
/// <returns>May be null.</returns>
|
||||||
public PathConstraint FindPathConstraint (String constraintName) {
|
public PathConstraint FindPathConstraint (string constraintName) {
|
||||||
if (constraintName == null) throw new ArgumentNullException("constraintName", "constraintName cannot be null.");
|
if (constraintName == null) throw new ArgumentNullException("constraintName", "constraintName cannot be null.");
|
||||||
ExposedList<PathConstraint> pathConstraints = this.pathConstraints;
|
ExposedList<PathConstraint> pathConstraints = this.pathConstraints;
|
||||||
for (int i = 0, n = pathConstraints.Count; i < n; i++) {
|
for (int i = 0, n = pathConstraints.Count; i < n; i++) {
|
||||||
@ -493,10 +493,10 @@ namespace Spine {
|
|||||||
public void GetBounds (out float x, out float y, out float width, out float height, ref float[] vertexBuffer) {
|
public void GetBounds (out float x, out float y, out float width, out float height, ref float[] vertexBuffer) {
|
||||||
float[] temp = vertexBuffer;
|
float[] temp = vertexBuffer;
|
||||||
temp = temp ?? new float[8];
|
temp = temp ?? new float[8];
|
||||||
var drawOrder = this.drawOrder;
|
var drawOrderItems = this.drawOrder.Items;
|
||||||
float minX = int.MaxValue, minY = int.MaxValue, maxX = int.MinValue, maxY = int.MinValue;
|
float minX = int.MaxValue, minY = int.MaxValue, maxX = int.MinValue, maxY = int.MinValue;
|
||||||
for (int i = 0, n = drawOrder.Count; i < n; i++) {
|
for (int i = 0, n = this.drawOrder.Count; i < n; i++) {
|
||||||
Slot slot = drawOrder.Items[i];
|
Slot slot = drawOrderItems[i];
|
||||||
int verticesLength = 0;
|
int verticesLength = 0;
|
||||||
float[] vertices = null;
|
float[] vertices = null;
|
||||||
Attachment attachment = slot.attachment;
|
Attachment attachment = slot.attachment;
|
||||||
@ -504,7 +504,7 @@ namespace Spine {
|
|||||||
if (regionAttachment != null) {
|
if (regionAttachment != null) {
|
||||||
verticesLength = 8;
|
verticesLength = 8;
|
||||||
if (temp.Length < 8) temp = new float[8];
|
if (temp.Length < 8) temp = new float[8];
|
||||||
regionAttachment.ComputeWorldVertices(slot.bone, temp);
|
regionAttachment.ComputeWorldVertices(slot.bone, temp, 0);
|
||||||
} else {
|
} else {
|
||||||
var meshAttachment = attachment as MeshAttachment;
|
var meshAttachment = attachment as MeshAttachment;
|
||||||
if (meshAttachment != null) {
|
if (meshAttachment != null) {
|
||||||
|
|||||||
@ -480,9 +480,9 @@ namespace Spine {
|
|||||||
timeline.slotIndex = slotIndex;
|
timeline.slotIndex = slotIndex;
|
||||||
|
|
||||||
int frameIndex = 0;
|
int frameIndex = 0;
|
||||||
foreach (Dictionary<String, Object> valueMap in values) {
|
foreach (Dictionary<string, Object> valueMap in values) {
|
||||||
float time = (float)valueMap["time"];
|
float time = (float)valueMap["time"];
|
||||||
String c = (String)valueMap["color"];
|
string c = (string)valueMap["color"];
|
||||||
timeline.SetFrame(frameIndex, time, ToColor(c, 0), ToColor(c, 1), ToColor(c, 2), ToColor(c, 3));
|
timeline.SetFrame(frameIndex, time, ToColor(c, 0), ToColor(c, 1), ToColor(c, 2), ToColor(c, 3));
|
||||||
ReadCurve(valueMap, timeline, frameIndex);
|
ReadCurve(valueMap, timeline, frameIndex);
|
||||||
frameIndex++;
|
frameIndex++;
|
||||||
@ -495,17 +495,17 @@ namespace Spine {
|
|||||||
timeline.slotIndex = slotIndex;
|
timeline.slotIndex = slotIndex;
|
||||||
|
|
||||||
int frameIndex = 0;
|
int frameIndex = 0;
|
||||||
foreach (Dictionary<String, Object> valueMap in values) {
|
foreach (Dictionary<string, Object> valueMap in values) {
|
||||||
float time = (float)valueMap["time"];
|
float time = (float)valueMap["time"];
|
||||||
String c = (String)valueMap["light"];
|
string light = (string)valueMap["light"];
|
||||||
String c2 = (String)valueMap["dark"];
|
string dark = (string)valueMap["dark"];
|
||||||
timeline.SetFrame(frameIndex, time, ToColor(c, 0), ToColor(c, 1), ToColor(c, 2), ToColor(c, 3),
|
timeline.SetFrame(frameIndex, time, ToColor(light, 0), ToColor(light, 1), ToColor(light, 2), ToColor(light, 3),
|
||||||
ToColor(c2, 0), ToColor(c2, 1), ToColor(c2, 2));
|
ToColor(dark, 0), ToColor(dark, 1), ToColor(dark, 2));
|
||||||
ReadCurve(valueMap, timeline, frameIndex);
|
ReadCurve(valueMap, timeline, frameIndex);
|
||||||
frameIndex++;
|
frameIndex++;
|
||||||
}
|
}
|
||||||
timelines.Add(timeline);
|
timelines.Add(timeline);
|
||||||
duration = Math.Max(duration, timeline.frames[(timeline.FrameCount - 1) * ColorTimeline.ENTRIES]);
|
duration = Math.Max(duration, timeline.frames[(timeline.FrameCount - 1) * TwoColorTimeline.ENTRIES]);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
throw new Exception("Invalid timeline type for a slot: " + timelineName + " (" + slotName + ")");
|
throw new Exception("Invalid timeline type for a slot: " + timelineName + " (" + slotName + ")");
|
||||||
|
|||||||
@ -37,7 +37,7 @@ namespace Spine {
|
|||||||
/// <a href="http://esotericsoftware.com/spine-runtime-skins">Runtime skins</a> in the Spine Runtimes Guide.</para>
|
/// <a href="http://esotericsoftware.com/spine-runtime-skins">Runtime skins</a> in the Spine Runtimes Guide.</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Skin {
|
public class Skin {
|
||||||
internal String name;
|
internal string name;
|
||||||
private Dictionary<AttachmentKeyTuple, Attachment> attachments =
|
private Dictionary<AttachmentKeyTuple, Attachment> attachments =
|
||||||
new Dictionary<AttachmentKeyTuple, Attachment>(AttachmentKeyTupleComparer.Instance);
|
new Dictionary<AttachmentKeyTuple, Attachment>(AttachmentKeyTupleComparer.Instance);
|
||||||
|
|
||||||
@ -49,11 +49,13 @@ namespace Spine {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Adds an attachment to the skin for the specified slot index and name.</summary>
|
||||||
public void AddAttachment (int slotIndex, string name, Attachment attachment) {
|
public void AddAttachment (int slotIndex, string name, Attachment attachment) {
|
||||||
if (attachment == null) throw new ArgumentNullException("attachment", "attachment cannot be null.");
|
if (attachment == null) throw new ArgumentNullException("attachment", "attachment cannot be null.");
|
||||||
attachments[new AttachmentKeyTuple(slotIndex, name)] = attachment;
|
attachments[new AttachmentKeyTuple(slotIndex, name)] = attachment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Returns the attachment for the specified slot index and name, or null.</summary>
|
||||||
/// <returns>May be null.</returns>
|
/// <returns>May be null.</returns>
|
||||||
public Attachment GetAttachment (int slotIndex, string name) {
|
public Attachment GetAttachment (int slotIndex, string name) {
|
||||||
Attachment attachment;
|
Attachment attachment;
|
||||||
@ -79,7 +81,7 @@ namespace Spine {
|
|||||||
if (entry.Key.slotIndex == slotIndex) attachments.Add(entry.Value);
|
if (entry.Key.slotIndex == slotIndex) attachments.Add(entry.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
override public String ToString () {
|
override public string ToString () {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user