public AnimationStateData(Spine.SkeletonData skeletonData)
 {
     if (skeletonData == null)
     {
         throw new ArgumentException("skeletonData cannot be null.", "skeletonData");
     }
     this.skeletonData = skeletonData;
 }
예제 #2
0
        public static Spine.Attachment GetAttachment(string attachmentPath, Spine.SkeletonData skeletonData)
        {
            var hierarchy = SpineAttachment.GetHierarchy(attachmentPath);

            if (hierarchy.name == "")
            {
                return(null);
            }

            return(skeletonData.FindSkin(hierarchy.skin).GetAttachment(skeletonData.FindSlotIndex(hierarchy.slot), hierarchy.name));
        }
예제 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="asset"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        public void SetSpine(SkeletonDataAsset asset, int width, int height, Vector2 anchor)
        {
            if (_spineAnimation != null)
            {
                FreeSpine();
            }

            _spineAnimation = SkeletonRenderer.NewSpineGameObject <SkeletonAnimation>(asset);
            Spine.SkeletonData dat = asset.GetSkeletonData(false);
            _spineAnimation.gameObject.transform.localScale    = new Vector3(100, 100, 1);
            _spineAnimation.gameObject.transform.localPosition = new Vector3(anchor.x, -anchor.y, 0);
            SetWrapTarget(_spineAnimation.gameObject, false, width, height);

            OnChangeSpine(null);
        }
예제 #4
0
        public static Spine.Attachment GetAttachment(string attachmentPath, Spine.SkeletonData skeletonData)
        {
            var hierarchy = SpineAttachment.GetHierarchy(attachmentPath);

            if (string.IsNullOrEmpty(hierarchy.name))
            {
                return(null);
            }

            SlotData slot = skeletonData.FindSlot(hierarchy.slot);

            if (slot == null)
            {
                return(null);
            }
            return(skeletonData.FindSkin(hierarchy.skin).GetAttachment(slot.Index, hierarchy.name));
        }
예제 #5
0
        public static Spine.Attachment GetAttachment(string attachmentPath, Spine.SkeletonData skeletonData)
        {
            var hierarchy = SpineAttachment.GetHierarchy(attachmentPath);

            if (hierarchy.name == "")
            {
                return(null);
            }

            Skin skin = skeletonData.FindSkin(hierarchy.skin);

            if (skin == null)
            {
                Debug.LogErrorFormat("null skin attachmentPath={0}; skeletonData:{1}", attachmentPath, skeletonData.name);
            }
            int index = skeletonData.FindSlotIndex(hierarchy.slot);

            return(skin.GetAttachment(index, hierarchy.name));
        }
예제 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="asset"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="anchor"></param>
        /// <param name="cloneMaterial"></param>
        public void SetSpine(SkeletonDataAsset asset, int width, int height, Vector2 anchor, bool cloneMaterial)
        {
            if (_spineAnimation != null)
            {
                FreeSpine();
            }

            _spineAnimation = SkeletonRenderer.NewSpineGameObject <SkeletonAnimation>(asset);
            _spineAnimation.gameObject.name = asset.name;
            Spine.SkeletonData dat = asset.GetSkeletonData(false);
            _spineAnimation.gameObject.transform.localScale    = new Vector3(1 / asset.scale, 1 / asset.scale, 1);
            _spineAnimation.gameObject.transform.localPosition = new Vector3(anchor.x, -anchor.y, 0);
            SetWrapTarget(_spineAnimation.gameObject, cloneMaterial, width, height);

            _spineAnimation.skeleton.R = _color.r;
            _spineAnimation.skeleton.G = _color.g;
            _spineAnimation.skeleton.B = _color.b;

            OnChangeSpine(null);
        }
예제 #7
0
        public static Spine.Attachment GetAttachment(string attachmentPath, Spine.SkeletonData skeletonData)
        {
            var hierarchy = SpineAttachment.GetHierarchy(attachmentPath);

            return(string.IsNullOrEmpty(hierarchy.name) ? null : skeletonData.FindSkin(hierarchy.skin).GetAttachment(skeletonData.FindSlotIndex(hierarchy.slot), hierarchy.name));
        }