예제 #1
0
        static void AddRequiredAtlasRegionsFromBinary(string skeletonDataPath, List <string> requiredPaths, string _animDir, int limitCount)
        {
            SkeletonBinary_Xiimoon binary = new SkeletonBinary_Xiimoon(new SpineEditorUtilities.AtlasRequirementLoader(requiredPaths));
            TextAsset    data             = (TextAsset)AssetDatabase.LoadAssetAtPath(skeletonDataPath, typeof(TextAsset));
            MemoryStream input            = new MemoryStream(data.bytes);

            binary.ReadSkeletonData(input, skeletonDataPath, _animDir, limitCount);
            binary = null;
        }
예제 #2
0
        // --- Animations.
        /// <returns>May be null.</returns>
        public Animation FindAnimation(String animationName)
        {
            if (animationName == null)
            {
                throw new ArgumentNullException("animationName", "animationName cannot be null.");
            }
            ExposedList <Animation> animations = this.animations;

            for (int i = 0, n = animations.Count; i < n; i++)
            {
                Animation animation = animations.Items[i];
                if (animation.name == animationName)
                {
                    return(animation);
                }
            }

            if (AnimationNames.Contains(animationName))
            {
                //Load ???
                string    _path  = string.Format("{0}/{1}", animPath, animationName);
                TextAsset _asset = null;
                _asset = AssetBundleManager.Instance.InstantiatePrefab <TextAsset>(_path); // 临时资源包,5秒后释放

                //LoadPoolMgr._.Load<TextAsset>(_path, CacheType.Temporary);//Resources.Load(_path) as TextAsset;
                Animation _ani = null;
                if (_asset == null)
                {
                    return(_ani);
                }
                using (MemoryStream _input = new MemoryStream(_asset.bytes))
                {
                    _ani = SkeletonBinary_Xiimoon.ReadAnimation(animationName, _input, this);
                    _input.Close();
                    _input.Dispose();
                }
                _asset = null;
                return(_ani);
            }

            return(null);
        }