public static Dictionary <string, FrameAnimation> CreateWithFile(string plist, string textureType) { string path = Path.GetDirectoryName(plist) + "/" + Path.GetFileNameWithoutExtension(plist); Debug.Log("CreateWithFile: " + path); List <SpriteFrame> lstSpriteFrame = SpriteFrameMgr.AddSpriteFrameWithPlist(path, textureType); if (lstSpriteFrame == null || lstSpriteFrame.Count == 0) { Debug.LogError("frames is empty:" + path); return(null); } Dictionary <string, FrameAnimation> animations = new Dictionary <string, FrameAnimation>(); foreach (SpriteFrame spriteFrame in lstSpriteFrame) { string animationName = GetAnimationName(spriteFrame.name); if (!animations.ContainsKey(animationName)) { FrameAnimation animation = new FrameAnimation(); animation.name = animationName; animation.spriteFrames.Add(spriteFrame); animations[animationName] = animation; } else { FrameAnimation animation = animations[animationName]; animation.spriteFrames.Add(spriteFrame); } } return(animations); }
// deepcopy public FrameAnimation DeepClone() { FrameAnimation frameAnimation = new FrameAnimation(); frameAnimation.currentframe = this.currentframe; frameAnimation.name = this.name; frameAnimation.Image = null; frameAnimation.delay = delay; frameAnimation.updateTime = updateTime; frameAnimation.spriteFrames = spriteFrames; frameAnimation.updateAction = updateAction; return(frameAnimation); }