123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- using System;
- namespace Spine
- {
- public class Slot
- {
- public Slot(SlotData data, Bone bone)
- {
- if (data == null)
- {
- throw new ArgumentNullException("data cannot be null.");
- }
- if (bone == null)
- {
- throw new ArgumentNullException("bone cannot be null.");
- }
- this.data = data;
- this.bone = bone;
- this.SetToSetupPose();
- }
- public SlotData Data
- {
- get
- {
- return this.data;
- }
- }
- public Bone Bone
- {
- get
- {
- return this.bone;
- }
- }
- public Skeleton Skeleton
- {
- get
- {
- return this.bone.skeleton;
- }
- }
- public float R
- {
- get
- {
- return this.r;
- }
- set
- {
- this.r = value;
- }
- }
- public float G
- {
- get
- {
- return this.g;
- }
- set
- {
- this.g = value;
- }
- }
- public float B
- {
- get
- {
- return this.b;
- }
- set
- {
- this.b = value;
- }
- }
- public float A
- {
- get
- {
- return this.a;
- }
- set
- {
- this.a = value;
- }
- }
- public Attachment Attachment
- {
- get
- {
- return this.attachment;
- }
- set
- {
- this.attachment = value;
- this.attachmentTime = this.bone.skeleton.time;
- this.attachmentVerticesCount = 0;
- }
- }
- public float AttachmentTime
- {
- get
- {
- return this.bone.skeleton.time - this.attachmentTime;
- }
- set
- {
- this.attachmentTime = this.bone.skeleton.time - value;
- }
- }
- public float[] AttachmentVertices
- {
- get
- {
- return this.attachmentVertices;
- }
- set
- {
- this.attachmentVertices = value;
- }
- }
- public int AttachmentVerticesCount
- {
- get
- {
- return this.attachmentVerticesCount;
- }
- set
- {
- this.attachmentVerticesCount = value;
- }
- }
- internal void SetToSetupPose(int slotIndex)
- {
- this.r = this.data.r;
- this.g = this.data.g;
- this.b = this.data.b;
- this.a = this.data.a;
- this.Attachment = ((this.data.attachmentName != null) ? this.bone.skeleton.GetAttachment(slotIndex, this.data.attachmentName) : null);
- }
- public void SetToSetupPose()
- {
- this.SetToSetupPose(this.bone.skeleton.data.slots.IndexOf(this.data));
- }
- public override string ToString()
- {
- return this.data.name;
- }
- internal SlotData data;
- internal Bone bone;
- internal float r;
- internal float g;
- internal float b;
- internal float a;
- internal Attachment attachment;
- internal float attachmentTime;
- internal float[] attachmentVertices = new float[0];
- internal int attachmentVerticesCount;
- }
- }
|