public static AnimationChainSave ReadAnimationChainSave(ContentReader input) { FlatRedBall.Content.AnimationChain.AnimationChainSave newObject = new FlatRedBall.Content.AnimationChain.AnimationChainSave(); newObject.Name = input.ReadString(); newObject.ParentFile = input.ReadString(); int FramesCount = input.ReadInt32(); for (int i = 0; i < FramesCount; i++) { newObject.Frames.Add(ObjectReader.ReadObject <FlatRedBall.Content.AnimationChain.AnimationFrameSave>(input)); } return(newObject); }
internal static AnimationChainSave FromAnimationChain(Anim.AnimationChain animationChain, TimeMeasurementUnit timeMeasurementUnit) { AnimationChainSave animationChainSave = new AnimationChainSave(); animationChainSave.Frames = new List <AnimationFrameSave>(); animationChainSave.Name = animationChain.Name; foreach (Anim.AnimationFrame frame in animationChain) { AnimationFrameSave save = new AnimationFrameSave(frame); animationChainSave.Frames.Add(save); } if (!string.IsNullOrEmpty(animationChain.ParentGifFileName)) { animationChainSave.ParentFile = animationChain.ParentGifFileName; } return(animationChainSave); }
internal static AnimationChainSave FromXElement(System.Xml.Linq.XElement element) { AnimationChainSave toReturn = new AnimationChainSave(); foreach (var subElement in element.Elements()) { switch (subElement.Name.LocalName) { case "Name": toReturn.Name = subElement.Value; break; case "Frame": toReturn.Frames.Add(AnimationFrameSave.FromXElement(subElement)); break; } } return(toReturn); }
/// <summary> /// look at all of the textures in each frame and convert them into external references /// </summary> public override AnimationChainListSave Process(AnimationChainListSave input, ContentProcessorContext context) { string directory = System.IO.Path.GetDirectoryName(input.FileName) + @"\"; for (int i = 0; i < input.AnimationChains.Count; i++) { AnimationChainSave ach = input.AnimationChains[i]; List <AnimationFrame> newFrames = new List <AnimationFrame>(ach.Frames.Count); for (int j = 0; j < ach.Frames.Count; j++) { AnimationFrameSave frameSave = new AnimationFrameSave(ach.Frames[j]); frameSave.TextureReference = BitmapTextureProcessor.BuildTexture( directory + frameSave.TextureName, context); newFrames.Add(frameSave); } ach.Frames = newFrames; } return(input); }