GetAttachment() public method

public GetAttachment ( String slotName, String attachmentName ) : Attachment
slotName String
attachmentName String
return Attachment
コード例 #1
0
        public void Apply(Skeleton skeleton, float lastTime, float time, List <Event> firedEvents, float alpha)
        {
            float[] frames = this.frames;
            if (time < frames[0])
            {
                if (lastTime > time)
                {
                    Apply(skeleton, lastTime, int.MaxValue, null, 0);
                }
                return;
            }
            else if (lastTime > time)               //
            {
                lastTime = -1;
            }

            int frameIndex = time >= frames[frames.Length - 1] ? frames.Length - 1 : Animation.binarySearch(frames, time) - 1;

            if (frames[frameIndex] <= lastTime)
            {
                return;
            }

            String attachmentName = attachmentNames[frameIndex];

            skeleton.slots[slotIndex].Attachment =
                attachmentName == null ? null : skeleton.GetAttachment(slotIndex, attachmentName);
        }
コード例 #2
0
    static int GetAttachment(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 3 && TypeChecker.CheckTypes <int, string>(L, 2))
            {
                Spine.Skeleton   obj  = (Spine.Skeleton)ToLua.CheckObject <Spine.Skeleton>(L, 1);
                int              arg0 = (int)LuaDLL.lua_tonumber(L, 2);
                string           arg1 = ToLua.ToString(L, 3);
                Spine.Attachment o    = obj.GetAttachment(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes <string, string>(L, 2))
            {
                Spine.Skeleton   obj  = (Spine.Skeleton)ToLua.CheckObject <Spine.Skeleton>(L, 1);
                string           arg0 = ToLua.ToString(L, 2);
                string           arg1 = ToLua.ToString(L, 3);
                Spine.Attachment o    = obj.GetAttachment(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: Spine.Skeleton.GetAttachment"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #3
0
        /// <summary>Resets the attachment of slot at a given slotIndex to setup pose. This is faster than Slot.SetAttachmentToSetupPose.</summary>
        public static void SetSlotAttachmentToSetupPose(this Skeleton skeleton, int slotIndex)
        {
            var slot       = skeleton.slots.Items[slotIndex];
            var attachment = skeleton.GetAttachment(slotIndex, slot.data.attachmentName);

            slot.Attachment = attachment;
        }
コード例 #4
0
ファイル: Animation.cs プロジェクト: KittyMac/spine-runtimes
        public void Apply(Skeleton skeleton, float lastTime, float time, ExposedList <Event> firedEvents, float alpha)
        {
            if (alpha < 0.5f)
            {
                return;
            }
            float[] frames = this.frames;
            if (time < frames[0])
            {
                return;                               // Time is before first frame.
            }
            int frameIndex;

            if (time >= frames[frames.Length - 1])             // Time is after last frame.
            {
                frameIndex = frames.Length - 1;
            }
            else
            {
                frameIndex = Animation.binarySearch(frames, time, 1) - 1;
            }

            String attachmentName = attachmentNames[frameIndex];

            skeleton.slots.Items[slotIndex]
            .Attachment = attachmentName == null ? null : skeleton.GetAttachment(slotIndex, attachmentName);
        }
コード例 #5
0
        public void Apply(Skeleton skeleton, float lastTime, float time, ExposedList <Event> firedEvents, float alpha)
        {
            float[] array = this.frames;
            if (time < array[0])
            {
                if (lastTime > time)
                {
                    this.Apply(skeleton, lastTime, 2.14748365E+09f, null, 0f);
                }
                return;
            }
            if (lastTime > time)
            {
                lastTime = -1f;
            }
            int num = ((time < array[array.Length - 1]) ? Animation.binarySearch(array, time) : array.Length) - 1;

            if (array[num] < lastTime)
            {
                return;
            }
            string text = this.attachmentNames[num];

            skeleton.slots.Items[this.slotIndex].Attachment = ((text != null) ? skeleton.GetAttachment(this.slotIndex, text) : null);
        }
コード例 #6
0
ファイル: Slot.cs プロジェクト: craftworkgames/Spine.Portable
 internal void SetToSetupPose(int slotIndex)
 {
     r          = data.r;
     g          = data.g;
     b          = data.b;
     a          = data.a;
     Attachment = data.attachmentName == null ? null : skeleton.GetAttachment(slotIndex, data.attachmentName);
 }
コード例 #7
0
 internal void SetToSetupPose(int slotIndex)
 {
     R          = Data.R;
     G          = Data.G;
     B          = Data.B;
     A          = Data.A;
     Attachment = Data.AttachmentName == null ? null : Skeleton.GetAttachment(slotIndex, Data.AttachmentName);
 }
コード例 #8
0
        /// <summary>Resets all the slots on the skeleton to their Setup Pose attachments but does not reset slot colors.</summary>
        public static void SetSlotAttachmentsToSetupPose(this Skeleton skeleton)
        {
            var slotsItems = skeleton.slots.Items;

            for (int i = 0; i < skeleton.slots.Count; i++)
            {
                Slot   slot           = slotsItems[i];
                string attachmentName = slot.data.attachmentName;
                slot.Attachment = string.IsNullOrEmpty(attachmentName) ? null : skeleton.GetAttachment(i, attachmentName);
            }
        }
コード例 #9
0
        public static void SetSlotAttachmentToSetupPose(this Skeleton skeleton, int slotIndex)
        {
            Slot   slot           = skeleton.slots.Items[slotIndex];
            string attachmentName = slot.data.attachmentName;

            if (string.IsNullOrEmpty(attachmentName))
            {
                slot.Attachment = null;
            }
            else
            {
                Attachment attachment2 = slot.Attachment = skeleton.GetAttachment(slotIndex, attachmentName);
            }
        }
コード例 #10
0
ファイル: SkeletonExtensions.cs プロジェクト: mrdivdiz/bpvita
        public static void SetSlotAttachmentToSetupPose(this Skeleton skeleton, int slotIndex)
        {
            Slot slot = skeleton.slots.Items[slotIndex];

            if (slot.data.attachmentName == null)
            {
                slot.Attachment = null;
            }
            else
            {
                slot.attachment = null;
                slot.Attachment = skeleton.GetAttachment(slotIndex, slot.data.attachmentName);
            }
        }
コード例 #11
0
        public void Apply(Skeleton skeleton, float lastTime, float time, ExposedList <Event> firedEvents, float alpha, MixPose pose, MixDirection direction)
        {
            string attachmentName;
            Slot   slot = skeleton.slots.Items[this.slotIndex];

            if ((direction == MixDirection.Out) && (pose == MixPose.Setup))
            {
                attachmentName  = slot.data.attachmentName;
                slot.Attachment = (attachmentName != null) ? skeleton.GetAttachment(this.slotIndex, attachmentName) : null;
            }
            else
            {
                float[] frames = this.frames;
                if (time < frames[0])
                {
                    if (pose == MixPose.Setup)
                    {
                        attachmentName  = slot.data.attachmentName;
                        slot.Attachment = (attachmentName != null) ? skeleton.GetAttachment(this.slotIndex, attachmentName) : null;
                    }
                }
                else
                {
                    int num;
                    if (time >= frames[frames.Length - 1])
                    {
                        num = frames.Length - 1;
                    }
                    else
                    {
                        num = Animation.BinarySearch(frames, time, 1) - 1;
                    }
                    attachmentName  = this.attachmentNames[num];
                    slot.Attachment = (attachmentName != null) ? skeleton.GetAttachment(this.slotIndex, attachmentName) : null;
                }
            }
        }
コード例 #12
0
ファイル: Animation.cs プロジェクト: zzorn/spine-runtimes
        public void Apply(Skeleton skeleton, float time, float alpha)
        {
            float[] frames = Frames;
            if (time < frames[0])
            {
                return;                               // Time is before first frame.
            }
            int frameIndex;

            if (time >= frames[frames.Length - 1])             // Time is after last frame.
            {
                frameIndex = frames.Length - 1;
            }
            else
            {
                frameIndex = Animation.binarySearch(frames, time, 1) - 1;
            }

            String attachmentName = AttachmentNames[frameIndex];

            skeleton.Slots[SlotIndex].Attachment =
                attachmentName == null ? null : skeleton.GetAttachment(SlotIndex, attachmentName);
        }
コード例 #13
0
ファイル: Animation.cs プロジェクト: xinwei2016/test
        public void Apply(Skeleton skeleton, float lastTime, float time, List<Event> firedEvents, float alpha)
        {
            float[] frames = this.frames;
            if (time < frames[0]) {
                if (lastTime > time) Apply(skeleton, lastTime, int.MaxValue, null, 0);
                return;
            } else if (lastTime > time) //
                lastTime = -1;

            int frameIndex = (time >= frames[frames.Length - 1] ? frames.Length : Animation.binarySearch(frames, time)) - 1;
            if (frames[frameIndex] < lastTime) return;

            String attachmentName = attachmentNames[frameIndex];
            skeleton.slots[slotIndex].Attachment =
                 attachmentName == null ? null : skeleton.GetAttachment(slotIndex, attachmentName);
        }
コード例 #14
0
ファイル: Animation.cs プロジェクト: D021/ink
		public void Apply (Skeleton skeleton, float lastTime, float time, List<Event> firedEvents, float alpha) {
			float[] frames = this.frames;
			if (time < frames[0]) return; // Time is before first frame.

			int frameIndex;
			if (time >= frames[frames.Length - 1]) // Time is after last frame.
				frameIndex = frames.Length - 1;
			else
				frameIndex = Animation.binarySearch(frames, time, 1) - 1;

			String attachmentName = attachmentNames[frameIndex];
			skeleton.slots[slotIndex].Attachment =
				 attachmentName == null ? null : skeleton.GetAttachment(slotIndex, attachmentName);
		}
コード例 #15
0
		public void Apply (Skeleton skeleton, float lastTime, float time, ExposedList<Event> firedEvents, float alpha, bool setupPose, bool mixingOut) {
			string attachmentName;
			Slot slot = skeleton.slots.Items[slotIndex];
			if (mixingOut && setupPose) {
				attachmentName = slot.data.attachmentName;
				slot.Attachment = attachmentName == null ? null : skeleton.GetAttachment(slotIndex, attachmentName);
				return;
			}

			float[] frames = this.frames;
			if (time < frames[0]) { // Time is before first frame.
				if (setupPose) {
					attachmentName = slot.data.attachmentName;
					slot.Attachment = attachmentName == null ? null : skeleton.GetAttachment(slotIndex, attachmentName);
				}
				return;
			}

			int frameIndex;
			if (time >= frames[frames.Length - 1]) // Time is after last frame.
				frameIndex = frames.Length - 1;
			else
				frameIndex = Animation.BinarySearch(frames, time, 1) - 1;

			attachmentName = attachmentNames[frameIndex];
			slot.Attachment = attachmentName == null ? null : skeleton.GetAttachment(slotIndex, attachmentName);
		}
コード例 #16
0
ファイル: Animation.cs プロジェクト: SirFelolis/Snot-Ninja
		public void Apply (Skeleton skeleton, float lastTime, float time, ExposedList<Event> firedEvents, float alpha) {
			float[] frames = this.frames;
			if (time < frames[0]) {
				if (lastTime > time) Apply(skeleton, lastTime, int.MaxValue, null, 0);
				return;
			} else if (lastTime > time) //
				lastTime = -1;

			int frameIndex = (time >= frames[frames.Length - 1] ? frames.Length : Animation.binarySearch(frames, time)) - 1;
//			if (frames[frameIndex] < lastTime) return;
            const float alphaThreshold = 0.5f; // don't set the attachment below 0.5 alpha.
            if (alpha < alphaThreshold) return;

            String attachmentName = attachmentNames[frameIndex];
			skeleton.slots.Items[slotIndex].Attachment =
				attachmentName == null ? null : skeleton.GetAttachment(slotIndex, attachmentName);
		}