public Anim.AnimationChain ToAnimationChain(string contentManagerName, TimeMeasurementUnit timeMeasurementUnit, TextureCoordinateType coordinateType) { if (!string.IsNullOrEmpty(ParentFile)) { #if !WINDOWS_8 && !UWP && !DESKTOP_GL FlatRedBall.Graphics.Animation.AnimationChain animationChain = FlatRedBall.Graphics.Animation.AnimationChain.FromGif( ParentFile, contentManagerName); animationChain.Name = Name; animationChain.ParentGifFileName = ParentFile; if (animationChain.Count == this.Frames.Count) { for (int i = 0; i < animationChain.Count; i++) { animationChain[i].FlipHorizontal = Frames[i].FlipHorizontal; animationChain[i].FlipVertical = Frames[i].FlipVertical; animationChain[i].FrameLength = Frames[i].FrameLength; animationChain[i].RelativeX = Frames[i].RelativeX; animationChain[i].RelativeY = Frames[i].RelativeY; animationChain[i].TopCoordinate = Frames[i].TopCoordinate; animationChain[i].BottomCoordinate = Frames[i].BottomCoordinate; animationChain[i].LeftCoordinate = Frames[i].LeftCoordinate; animationChain[i].RightCoordinate = Frames[i].RightCoordinate; } } return(animationChain); #else throw new NotImplementedException(); #endif } else { Anim.AnimationChain animationChain = new Anim.AnimationChain(); animationChain.Name = Name; float divisor = 1; if (timeMeasurementUnit == TimeMeasurementUnit.Millisecond) { divisor = 1000; } foreach (AnimationFrameSave save in Frames) { // process the AnimationFrame and add it to the newly-created AnimationChain AnimationFrame frame = null; bool loadTexture = true; frame = save.ToAnimationFrame(contentManagerName, loadTexture, coordinateType); frame.FrameLength /= divisor; animationChain.Add(frame); } return(animationChain); } }
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); }
//public Anim.AnimationChain ToAnimationChain(Graphics.Texture.TextureAtlas textureAtlas, TimeMeasurementUnit timeMeasurementUnit) //{ // return ToAnimationChain(null, textureAtlas, timeMeasurementUnit, TextureCoordinateType.UV); //} public Anim.AnimationChain ToAnimationChain(string contentManagerName, TimeMeasurementUnit timeMeasurementUnit) { return(ToAnimationChain(contentManagerName, timeMeasurementUnit, TextureCoordinateType.UV)); }
public Gum.Graphics.Animation.AnimationChain ToAnimationChain(string contentManagerName, TimeMeasurementUnit timeMeasurementUnit, TextureCoordinateType coordinateType) { if (!string.IsNullOrEmpty(ParentFile)) { throw new NotImplementedException(); } else { Gum.Graphics.Animation.AnimationChain animationChain = new Gum.Graphics.Animation.AnimationChain(); animationChain.Name = Name; float divisor = 1; if (timeMeasurementUnit == TimeMeasurementUnit.Millisecond) { divisor = 1000; } foreach (AnimationFrameSave save in Frames) { // process the AnimationFrame and add it to the newly-created AnimationChain AnimationFrame frame = null; bool loadTexture = true; frame = save.ToAnimationFrame(contentManagerName, loadTexture, coordinateType); frame.FrameLength /= divisor; animationChain.Add(frame); } return(animationChain); } }