Esempio n. 1
0
        public bool GetAnimNameAndFile(AnimGroup group, AnimIndex anim, ref string animName, ref string fileName)
        {
            if (anim == AnimIndex.None)
            {
                return(false);
            }

            if (group == AnimGroup.None)
            {
                return(false);
            }

            if (null == this.Definition || string.IsNullOrEmpty(this.Definition.AnimGroupName))
            {
                return(false);
            }

            var animGroup = AnimationGroup.Get(this.Definition.AnimGroupName, group);

            if (null == animGroup)
            {
                return(false);
            }

            animName = animGroup [anim];
            fileName = animGroup.FileName;

            return(true);
        }
Esempio n. 2
0
        private AnimationState LoadAnim(AnimGroup group, AnimIndex anim)
        {
            if (anim == AnimIndex.None)
            {
                return(null);
            }

            var animGroup = AnimationGroup.Get(Definition.AnimGroupName, group);
            var animName  = animGroup[anim];

            AnimationState state;

            if (!_loadedAnims.ContainsKey(animName))
            {
                var clip = Importing.Conversion.Animation.Load(animGroup.FileName, animName, _frames);
                _loadedAnims.Add(animName, clip);
                _anim.AddClip(clip.Clip, animName);
                state = _anim[animName];
            }
            else
            {
                state = _anim[animName];
            }

            return(state);
        }
Esempio n. 3
0
        public Anim GetAnim(AnimGroup group, AnimIndex anim)
        {
            var animGroup = AnimationGroup.Get(Definition.AnimGroupName, group);

            Anim result;

            return(_loadedAnims.TryGetValue(animGroup[anim], out result) ? result : null);
        }
        private AnimationState LoadAnim(AnimGroup group, AnimIndex anim)
        {
            if (anim == AnimIndex.None)
            {
                return(null);
            }
            //	if ("" == anim)
            //		return null;

            if (group == AnimGroup.None)
            {
                return(null);
            }

            if (Definition == null || string.IsNullOrEmpty(Definition.AnimGroupName))
            {
                return(null);
            }

            var animGroup = AnimationGroup.Get(Definition.AnimGroupName, group);

            if (null == animGroup)
            {
                return(null);
            }

            var animName = animGroup[anim];
            //	var animName = anim ;
            //	if (!animGroup.HasAnimation (animName))
            //		return null;

            AnimationState state;

            if (!_loadedAnims.ContainsKey(animName))
            {
                var importedAnim = Anim.Load(animGroup.FileName, animName, _frames);
                if (importedAnim != null && importedAnim.Clip != null)
                {
                    _loadedAnims.Add(animName, importedAnim);
                    _anim.AddClip(importedAnim.Clip, animName);
                    state = _anim[animName];
                }
                else
                {
                    state = null;
                    Debug.LogWarningFormat("Failed to load anim - file: {0}, anim name: {1}", animGroup.FileName, animName);
                }
            }
            else
            {
                state = _anim[animName];
            }

            return(state);
        }
        private AnimationState LoadAnim(AnimGroup group, AnimIndex anim)
        {
            if (anim == AnimIndex.None)
            {
                return(null);
            }
            //	if ("" == anim)
            //		return null;

            if (group == AnimGroup.None)
            {
                return(null);
            }

            if (Definition == null || (Definition != null && string.IsNullOrEmpty(Definition.AnimGroupName)))
            {
                return(null);
            }
            var animGroup = AnimationGroup.Get(Definition.AnimGroupName, group);

            if (null == animGroup)
            {
                return(null);
            }
            var animName = animGroup[anim];
            //	var animName = anim ;
            //	if (!animGroup.HasAnimation (animName))
            //		return null;

            AnimationState state;

            if (!_loadedAnims.ContainsKey(animName))
            {
                var clip = Anim.Load(animGroup.FileName, animName, _frames);
                if (clip.Clip != null)
                {
                    _loadedAnims.Add(animName, clip);
                    _anim.AddClip(clip.Clip, animName);
                    state = _anim[animName];
                }
                else
                {
                    state = null;
                    Debug.LogWarning(string.Format("File '{0}' doesn't exists!", animGroup.FileName));
                }
            }
            else
            {
                state = _anim[animName];
            }

            return(state);
        }
        public string GetAnimName(AnimGroup group, AnimIndex anim)
        {
            var animGroup = AnimationGroup.Get(Definition.AnimGroupName, group);

            return(animGroup[anim]);
        }