补充v2.1的一些实现,与v3.x版本一致
This commit is contained in:
@@ -29,13 +29,17 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace SpineRuntime21 {
|
namespace SpineRuntime21 {
|
||||||
public class AnimationState {
|
public class AnimationState {
|
||||||
private AnimationStateData data;
|
static readonly Animation EmptyAnimation = new Animation("<empty>", new List<Timeline>(), 0);
|
||||||
private List<TrackEntry> tracks = new List<TrackEntry>();
|
private AnimationStateData data;
|
||||||
|
|
||||||
|
Pool<TrackEntry> trackEntryPool = new Pool<TrackEntry>();
|
||||||
|
private List<TrackEntry> tracks = new List<TrackEntry>();
|
||||||
private List<Event> events = new List<Event>();
|
private List<Event> events = new List<Event>();
|
||||||
private float timeScale = 1;
|
private float timeScale = 1;
|
||||||
|
|
||||||
@@ -43,16 +47,12 @@ namespace SpineRuntime21 {
|
|||||||
public float TimeScale { get { return timeScale; } set { timeScale = value; } }
|
public float TimeScale { get { return timeScale; } set { timeScale = value; } }
|
||||||
public List<TrackEntry> Tracks => tracks;
|
public List<TrackEntry> Tracks => tracks;
|
||||||
|
|
||||||
public delegate void StartEndDelegate(AnimationState state, int trackIndex);
|
public delegate void TrackEntryDelegate(TrackEntry trackEntry);
|
||||||
public event StartEndDelegate Start;
|
public event TrackEntryDelegate Start, End, Complete;
|
||||||
public event StartEndDelegate End;
|
|
||||||
|
|
||||||
public delegate void EventDelegate(AnimationState state, int trackIndex, Event e);
|
public delegate void EventDelegate(AnimationState state, int trackIndex, Event e);
|
||||||
public event EventDelegate Event;
|
public event EventDelegate Event;
|
||||||
|
|
||||||
public delegate void CompleteDelegate(AnimationState state, int trackIndex, int loopCount);
|
|
||||||
public event CompleteDelegate Complete;
|
|
||||||
|
|
||||||
public AnimationState (AnimationStateData data) {
|
public AnimationState (AnimationStateData data) {
|
||||||
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;
|
||||||
@@ -77,8 +77,8 @@ namespace SpineRuntime21 {
|
|||||||
// Check if completed the animation or a loop iteration.
|
// Check if completed the animation or a loop iteration.
|
||||||
if (current.loop ? (current.lastTime % endTime > time % endTime) : (current.lastTime < endTime && time >= endTime)) {
|
if (current.loop ? (current.lastTime % endTime > time % endTime) : (current.lastTime < endTime && time >= endTime)) {
|
||||||
int count = (int)(time / endTime);
|
int count = (int)(time / endTime);
|
||||||
current.OnComplete(this, i, count);
|
current.OnComplete();
|
||||||
if (Complete != null) Complete(this, i, count);
|
if (Complete != null) Complete(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
TrackEntry next = current.next;
|
TrackEntry next = current.next;
|
||||||
@@ -145,10 +145,17 @@ namespace SpineRuntime21 {
|
|||||||
TrackEntry current = tracks[trackIndex];
|
TrackEntry current = tracks[trackIndex];
|
||||||
if (current == null) return;
|
if (current == null) return;
|
||||||
|
|
||||||
current.OnEnd(this, trackIndex);
|
current.OnEnd();
|
||||||
if (End != null) End(this, trackIndex);
|
if (End != null) End(current);
|
||||||
|
|
||||||
tracks[trackIndex] = null;
|
tracks[trackIndex] = null;
|
||||||
|
|
||||||
|
while (current is not null)
|
||||||
|
{
|
||||||
|
var tmp = current.next;
|
||||||
|
trackEntryPool.Free(current);
|
||||||
|
current = tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private TrackEntry ExpandToIndex (int index) {
|
private TrackEntry ExpandToIndex (int index) {
|
||||||
@@ -164,8 +171,8 @@ namespace SpineRuntime21 {
|
|||||||
TrackEntry previous = current.previous;
|
TrackEntry previous = current.previous;
|
||||||
current.previous = null;
|
current.previous = null;
|
||||||
|
|
||||||
current.OnEnd(this, index);
|
current.OnEnd();
|
||||||
if (End != null) End(this, index);
|
if (End != null) End(current);
|
||||||
|
|
||||||
entry.mixDuration = data.GetMix(current.animation, entry.animation);
|
entry.mixDuration = data.GetMix(current.animation, entry.animation);
|
||||||
if (entry.mixDuration > 0) {
|
if (entry.mixDuration > 0) {
|
||||||
@@ -180,8 +187,15 @@ namespace SpineRuntime21 {
|
|||||||
|
|
||||||
tracks[index] = entry;
|
tracks[index] = entry;
|
||||||
|
|
||||||
entry.OnStart(this, index);
|
while (current is not null)
|
||||||
if (Start != null) Start(this, index);
|
{
|
||||||
|
var tmp = current.next;
|
||||||
|
trackEntryPool.Free(current);
|
||||||
|
current = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
entry.OnStart();
|
||||||
|
if (Start != null) Start(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TrackEntry SetAnimation (int trackIndex, String animationName, bool loop) {
|
public TrackEntry SetAnimation (int trackIndex, String animationName, bool loop) {
|
||||||
@@ -193,7 +207,8 @@ namespace SpineRuntime21 {
|
|||||||
/// <summary>Set the current animation. Any queued animations are cleared.</summary>
|
/// <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) {
|
||||||
if (animation == null) throw new ArgumentException("animation cannot be null.");
|
if (animation == null) throw new ArgumentException("animation cannot be null.");
|
||||||
TrackEntry entry = new TrackEntry();
|
TrackEntry entry = trackEntryPool.Obtain();
|
||||||
|
entry.trackIndex = trackIndex;
|
||||||
entry.animation = animation;
|
entry.animation = animation;
|
||||||
entry.loop = loop;
|
entry.loop = loop;
|
||||||
entry.time = 0;
|
entry.time = 0;
|
||||||
@@ -212,8 +227,9 @@ namespace SpineRuntime21 {
|
|||||||
/// <param name="delay">May be <= 0 to use duration of previous animation minus any mix duration plus the negative delay.</param>
|
/// <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) {
|
||||||
if (animation == null) throw new ArgumentException("animation cannot be null.");
|
if (animation == null) throw new ArgumentException("animation cannot be null.");
|
||||||
TrackEntry entry = new TrackEntry();
|
TrackEntry entry = trackEntryPool.Obtain();
|
||||||
entry.animation = animation;
|
entry.trackIndex = trackIndex;
|
||||||
|
entry.animation = animation;
|
||||||
entry.loop = loop;
|
entry.loop = loop;
|
||||||
entry.time = 0;
|
entry.time = 0;
|
||||||
entry.endTime = animation.Duration;
|
entry.endTime = animation.Duration;
|
||||||
@@ -237,8 +253,48 @@ namespace SpineRuntime21 {
|
|||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <returns>May be null.</returns>
|
/// <summary>
|
||||||
public TrackEntry GetCurrent (int trackIndex) {
|
/// Sets an empty animation for a track, discarding any queued animations, and mixes to it over the specified mix duration.</summary>
|
||||||
|
public TrackEntry SetEmptyAnimation(int trackIndex, float mixDuration)
|
||||||
|
{
|
||||||
|
TrackEntry entry = SetAnimation(trackIndex, AnimationState.EmptyAnimation, false);
|
||||||
|
entry.mixDuration = mixDuration;
|
||||||
|
entry.endTime = mixDuration;
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds an empty animation to be played after the current or last queued animation for a track, and mixes to it over the
|
||||||
|
/// specified mix duration.</summary>
|
||||||
|
/// <returns>
|
||||||
|
/// A track entry to allow further customization of animation playback. References to the track entry must not be kept after <see cref="AnimationState.Dispose"/>.
|
||||||
|
/// </returns>
|
||||||
|
/// <param name="trackIndex">Track number.</param>
|
||||||
|
/// <param name="mixDuration">Mix duration.</param>
|
||||||
|
/// <param name="delay">Seconds to begin this animation after the start of the previous animation. May be <= 0 to use the animation
|
||||||
|
/// duration of the previous track minus any mix duration plus the negative delay.</param>
|
||||||
|
public TrackEntry AddEmptyAnimation(int trackIndex, float mixDuration, float delay)
|
||||||
|
{
|
||||||
|
if (delay <= 0) delay -= mixDuration;
|
||||||
|
TrackEntry entry = AddAnimation(trackIndex, AnimationState.EmptyAnimation, false, delay);
|
||||||
|
entry.mixDuration = mixDuration;
|
||||||
|
entry.endTime = mixDuration;
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets an empty animation for every track, discarding any queued animations, and mixes to it over the specified mix duration.</summary>
|
||||||
|
public void SetEmptyAnimations(float mixDuration)
|
||||||
|
{
|
||||||
|
for (int i = 0, n = tracks.Count; i < n; i++)
|
||||||
|
{
|
||||||
|
TrackEntry current = tracks[i];
|
||||||
|
if (current != null) SetEmptyAnimation(i, mixDuration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <returns>May be null.</returns>
|
||||||
|
public TrackEntry GetCurrent (int trackIndex) {
|
||||||
if (trackIndex >= tracks.Count) return null;
|
if (trackIndex >= tracks.Count) return null;
|
||||||
return tracks[trackIndex];
|
return tracks[trackIndex];
|
||||||
}
|
}
|
||||||
@@ -254,16 +310,18 @@ namespace SpineRuntime21 {
|
|||||||
if (buffer.Length == 0) return "<none>";
|
if (buffer.Length == 0) return "<none>";
|
||||||
return buffer.ToString();
|
return buffer.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TrackEntry {
|
public class TrackEntry : Pool<TrackEntry>.IPoolable {
|
||||||
internal TrackEntry next, previous;
|
internal TrackEntry next, previous;
|
||||||
internal Animation animation;
|
internal int trackIndex;
|
||||||
|
internal Animation animation;
|
||||||
internal bool loop;
|
internal bool loop;
|
||||||
internal float delay, time, lastTime = -1, endTime, timeScale = 1;
|
internal float delay, time, lastTime = -1, endTime, timeScale = 1;
|
||||||
internal float mixTime, mixDuration, mix = 1;
|
internal float mixTime, mixDuration, mix = 1;
|
||||||
|
|
||||||
public Animation Animation { get { return animation; } }
|
public int TrackIndex { get { return trackIndex; } }
|
||||||
|
public Animation Animation { get { return animation; } }
|
||||||
public float Delay { get { return delay; } set { delay = value; } }
|
public float Delay { get { return delay; } set { delay = value; } }
|
||||||
public float Time { get { return time; } set { time = value; } }
|
public float Time { get { return time; } set { time = value; } }
|
||||||
public float LastTime { get { return lastTime; } set { lastTime = value; } }
|
public float LastTime { get { return lastTime; } set { lastTime = value; } }
|
||||||
@@ -272,29 +330,110 @@ namespace SpineRuntime21 {
|
|||||||
public float Mix { get { return mix; } set { mix = value; } }
|
public float Mix { get { return mix; } set { mix = value; } }
|
||||||
public bool Loop { get { return loop; } set { loop = value; } }
|
public bool Loop { get { return loop; } set { loop = value; } }
|
||||||
|
|
||||||
public event AnimationState.StartEndDelegate Start;
|
/// <summary>
|
||||||
public event AnimationState.StartEndDelegate End;
|
/// Seconds for mixing from the previous animation to this animation. Defaults to the value provided by
|
||||||
|
/// <see cref="AnimationStateData"/> based on the animation before this animation (if any).
|
||||||
|
///
|
||||||
|
/// The mix duration can be set manually rather than use the value from AnimationStateData.GetMix.
|
||||||
|
/// In that case, the mixDuration must be set before <see cref="AnimationState.Update(float)"/> is next called.
|
||||||
|
/// <para>
|
||||||
|
/// When using <seealso cref="AnimationState.AddAnimation(int, Animation, bool, float)"/> with a
|
||||||
|
/// <code>delay</code> less than or equal to 0, note the <seealso cref="Delay"/> is set using the mix duration from the <see cref=" AnimationStateData"/>
|
||||||
|
/// </para>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public float MixDuration { get { return mixDuration; } set { mixDuration = value; } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The animation queued to start after this animation, or null.</summary>
|
||||||
|
public TrackEntry Next { get { return next; } }
|
||||||
|
|
||||||
|
public event AnimationState.TrackEntryDelegate Start, End, Complete;
|
||||||
public event AnimationState.EventDelegate Event;
|
public event AnimationState.EventDelegate Event;
|
||||||
public event AnimationState.CompleteDelegate Complete;
|
|
||||||
|
|
||||||
internal void OnStart (AnimationState state, int index) {
|
// IPoolable.Reset()
|
||||||
if (Start != null) Start(state, index);
|
public void Reset()
|
||||||
}
|
{
|
||||||
|
next = null;
|
||||||
|
previous = null;
|
||||||
|
animation = null;
|
||||||
|
|
||||||
internal void OnEnd (AnimationState state, int index) {
|
Start = null;
|
||||||
if (End != null) End(state, index);
|
End = null;
|
||||||
}
|
Complete = null;
|
||||||
|
Event = null;
|
||||||
|
}
|
||||||
|
|
||||||
internal void OnEvent (AnimationState state, int index, Event e) {
|
internal void OnStart() { if (Start != null) Start(this); }
|
||||||
|
internal void OnEnd() { if (End != null) End(this); }
|
||||||
|
internal void OnComplete() { if (Complete != null) Complete(this); }
|
||||||
|
|
||||||
|
internal void OnEvent (AnimationState state, int index, Event e) {
|
||||||
if (Event != null) Event(state, index, e);
|
if (Event != null) Event(state, index, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void OnComplete (AnimationState state, int index, int loopCount) {
|
|
||||||
if (Complete != null) Complete(state, index, loopCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
override public String ToString () {
|
override public String ToString () {
|
||||||
return animation == null ? "<none>" : animation.name;
|
return animation == null ? "<none>" : animation.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class Pool<T> where T : class, new()
|
||||||
|
{
|
||||||
|
public readonly int max;
|
||||||
|
readonly Stack<T> freeObjects;
|
||||||
|
|
||||||
|
public int Count { get { return freeObjects.Count; } }
|
||||||
|
public int Peak { get; private set; }
|
||||||
|
|
||||||
|
public Pool(int initialCapacity = 16, int max = int.MaxValue)
|
||||||
|
{
|
||||||
|
freeObjects = new Stack<T>(initialCapacity);
|
||||||
|
this.max = max;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T Obtain()
|
||||||
|
{
|
||||||
|
return freeObjects.Count == 0 ? new T() : freeObjects.Pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Free(T obj)
|
||||||
|
{
|
||||||
|
if (obj == null) throw new ArgumentNullException("obj", "obj cannot be null");
|
||||||
|
if (freeObjects.Count < max)
|
||||||
|
{
|
||||||
|
freeObjects.Push(obj);
|
||||||
|
Peak = Math.Max(Peak, freeObjects.Count);
|
||||||
|
}
|
||||||
|
Reset(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
// protected void FreeAll (List<T> objects) {
|
||||||
|
// if (objects == null) throw new ArgumentNullException("objects", "objects cannot be null.");
|
||||||
|
// var freeObjects = this.freeObjects;
|
||||||
|
// int max = this.max;
|
||||||
|
// for (int i = 0; i < objects.Count; i++) {
|
||||||
|
// T obj = objects[i];
|
||||||
|
// if (obj == null) continue;
|
||||||
|
// if (freeObjects.Count < max) freeObjects.Push(obj);
|
||||||
|
// Reset(obj);
|
||||||
|
// }
|
||||||
|
// Peak = Math.Max(Peak, freeObjects.Count);
|
||||||
|
// }
|
||||||
|
|
||||||
|
public void Clear()
|
||||||
|
{
|
||||||
|
freeObjects.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void Reset(T obj)
|
||||||
|
{
|
||||||
|
var poolable = obj as IPoolable;
|
||||||
|
if (poolable != null) poolable.Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IPoolable
|
||||||
|
{
|
||||||
|
void Reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,14 +32,18 @@ using System;
|
|||||||
|
|
||||||
namespace SpineRuntime21 {
|
namespace SpineRuntime21 {
|
||||||
public class BoneData {
|
public class BoneData {
|
||||||
internal BoneData parent;
|
internal int index;
|
||||||
|
internal BoneData parent;
|
||||||
internal String name;
|
internal String name;
|
||||||
internal float length, x, y, rotation, scaleX = 1, scaleY = 1;
|
internal float length, x, y, rotation, scaleX = 1, scaleY = 1;
|
||||||
internal bool flipX, flipY;
|
internal bool flipX, flipY;
|
||||||
internal bool inheritScale = true, inheritRotation = true;
|
internal bool inheritScale = true, inheritRotation = true;
|
||||||
|
|
||||||
/// <summary>May be null.</summary>
|
/// <summary>The index of the bone in Skeleton.Bones</summary>
|
||||||
public BoneData Parent { get { return parent; } }
|
public int Index { get { return index; } }
|
||||||
|
|
||||||
|
/// <summary>May be null.</summary>
|
||||||
|
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; } }
|
||||||
public float X { get { return x; } set { x = value; } }
|
public float X { get { return x; } set { x = value; } }
|
||||||
@@ -53,9 +57,10 @@ namespace SpineRuntime21 {
|
|||||||
public bool InheritRotation { get { return inheritRotation; } set { inheritRotation = value; } }
|
public bool InheritRotation { get { return inheritRotation; } set { inheritRotation = value; } }
|
||||||
|
|
||||||
/// <param name="parent">May be null.</param>
|
/// <param name="parent">May be null.</param>
|
||||||
public BoneData (String name, BoneData parent) {
|
public BoneData (int index, 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.index = index;
|
||||||
|
this.name = name;
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ namespace SpineRuntime21 {
|
|||||||
BoneData parent = null;
|
BoneData parent = null;
|
||||||
int parentIndex = ReadInt(input, true) - 1;
|
int parentIndex = ReadInt(input, true) - 1;
|
||||||
if (parentIndex != -1) parent = skeletonData.bones[parentIndex];
|
if (parentIndex != -1) parent = skeletonData.bones[parentIndex];
|
||||||
BoneData boneData = new BoneData(name, parent);
|
BoneData boneData = new BoneData(i, name, parent);
|
||||||
boneData.x = ReadFloat(input) * scale;
|
boneData.x = ReadFloat(input) * scale;
|
||||||
boneData.y = ReadFloat(input) * scale;
|
boneData.y = ReadFloat(input) * scale;
|
||||||
boneData.scaleX = ReadFloat(input);
|
boneData.scaleX = ReadFloat(input);
|
||||||
@@ -149,7 +149,7 @@ namespace SpineRuntime21 {
|
|||||||
for (int i = 0, n = ReadInt(input, true); i < n; i++) {
|
for (int i = 0, n = ReadInt(input, true); i < n; i++) {
|
||||||
String slotName = ReadString(input);
|
String slotName = ReadString(input);
|
||||||
BoneData boneData = skeletonData.bones[ReadInt(input, true)];
|
BoneData boneData = skeletonData.bones[ReadInt(input, true)];
|
||||||
SlotData slotData = new SlotData(slotName, boneData);
|
SlotData slotData = new SlotData(i, slotName, boneData);
|
||||||
int color = ReadInt(input);
|
int color = ReadInt(input);
|
||||||
slotData.r = ((color & 0xff000000) >> 24) / 255f;
|
slotData.r = ((color & 0xff000000) >> 24) / 255f;
|
||||||
slotData.g = ((color & 0x00ff0000) >> 16) / 255f;
|
slotData.g = ((color & 0x00ff0000) >> 16) / 255f;
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ namespace SpineRuntime21 {
|
|||||||
if (parent == null)
|
if (parent == null)
|
||||||
throw new Exception("Parent bone not found: " + boneMap["parent"]);
|
throw new Exception("Parent bone not found: " + boneMap["parent"]);
|
||||||
}
|
}
|
||||||
var boneData = new BoneData((String)boneMap["name"], parent);
|
var boneData = new BoneData(skeletonData.Bones.Count, (String)boneMap["name"], parent);
|
||||||
boneData.length = GetFloat(boneMap, "length", 0) * Scale;
|
boneData.length = GetFloat(boneMap, "length", 0) * Scale;
|
||||||
boneData.x = GetFloat(boneMap, "x", 0) * Scale;
|
boneData.x = GetFloat(boneMap, "x", 0) * Scale;
|
||||||
boneData.y = GetFloat(boneMap, "y", 0) * Scale;
|
boneData.y = GetFloat(boneMap, "y", 0) * Scale;
|
||||||
@@ -150,7 +150,7 @@ namespace SpineRuntime21 {
|
|||||||
BoneData boneData = skeletonData.FindBone(boneName);
|
BoneData boneData = skeletonData.FindBone(boneName);
|
||||||
if (boneData == null)
|
if (boneData == null)
|
||||||
throw new Exception("Slot bone not found: " + boneName);
|
throw new Exception("Slot bone not found: " + boneName);
|
||||||
var slotData = new SlotData(slotName, boneData);
|
var slotData = new SlotData(skeletonData.Slots.Count, slotName, boneData);
|
||||||
|
|
||||||
if (slotMap.ContainsKey("color")) {
|
if (slotMap.ContainsKey("color")) {
|
||||||
var color = (String)slotMap["color"];
|
var color = (String)slotMap["color"];
|
||||||
|
|||||||
@@ -32,13 +32,15 @@ using System;
|
|||||||
|
|
||||||
namespace SpineRuntime21 {
|
namespace SpineRuntime21 {
|
||||||
public class SlotData {
|
public class SlotData {
|
||||||
|
internal int index;
|
||||||
internal String name;
|
internal String name;
|
||||||
internal BoneData boneData;
|
internal BoneData boneData;
|
||||||
internal float r = 1, g = 1, b = 1, a = 1;
|
internal float r = 1, g = 1, b = 1, a = 1;
|
||||||
internal String attachmentName;
|
internal String attachmentName;
|
||||||
internal bool additiveBlending;
|
internal bool additiveBlending;
|
||||||
|
|
||||||
public String Name { get { return name; } }
|
public int Index { get { return index; } }
|
||||||
|
public String Name { get { return name; } }
|
||||||
public BoneData BoneData { get { return boneData; } }
|
public BoneData BoneData { get { return boneData; } }
|
||||||
public float R { get { return r; } set { r = value; } }
|
public float R { get { return r; } set { r = value; } }
|
||||||
public float G { get { return g; } set { g = value; } }
|
public float G { get { return g; } set { g = value; } }
|
||||||
@@ -48,9 +50,10 @@ namespace SpineRuntime21 {
|
|||||||
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; } }
|
||||||
|
|
||||||
public SlotData (String name, BoneData boneData) {
|
public SlotData (int index, String name, BoneData boneData) {
|
||||||
if (name == null) throw new ArgumentNullException("name cannot be null.");
|
if (name == null) throw new ArgumentNullException("name cannot be null.");
|
||||||
if (boneData == null) throw new ArgumentNullException("boneData cannot be null.");
|
if (boneData == null) throw new ArgumentNullException("boneData cannot be null.");
|
||||||
|
this.index = index;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.boneData = boneData;
|
this.boneData = boneData;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user