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); } }
public AnimationChainList ToAnimationChainList(string contentManagerName, bool throwError) { mToRuntimeErrors.Clear(); AnimationChainList list = new AnimationChainList(); list.FileRelativeTextures = FileRelativeTextures; list.TimeMeasurementUnit = TimeMeasurementUnit; list.Name = mFileName; string oldRelativeDirectory = FileManager.RelativeDirectory; try { if (this.FileRelativeTextures) { FileManager.RelativeDirectory = FileManager.GetDirectory(mFileName); } foreach (AnimationChainSave animationChain in this.AnimationChains) { try { Gum.Graphics.Animation.AnimationChain newChain = null; newChain = animationChain.ToAnimationChain(contentManagerName, this.TimeMeasurementUnit, this.CoordinateType); newChain.mIndexInLoadedAchx = list.Count; newChain.ParentAchxFileName = mFileName; list.Add(newChain); } catch (Exception e) { mToRuntimeErrors.Add(e.ToString()); if (throwError) { throw new Exception("Error loading AnimationChain", e); } } } } finally { FileManager.RelativeDirectory = oldRelativeDirectory; } return(list); }
bool IEquatable <AnimationChain> .Equals(AnimationChain other) { return(this == other); }