public KeyValuePair <AMTFrame, byte[]> GetNextFrame() { if (CurrentFrame > Action.Frames.Count - 1) { CurrentFrame = 0; } if (CurrentFrame == Action.Frames.Count - 1) { LoopTimes++; } AMTFrame f = Action.Frames[CurrentFrame++]; Package.SwitchResource(f.Resource); return(new KeyValuePair <AMTFrame, byte[]>(f, Package.CurrentResource.Frames[f.FrameRef])); }
private void lbAssets_SelectedIndexChanged(object sender, EventArgs e) { if (lbAssets.SelectedIndex != -1) { if (Package.CurrentResource == null) { Package.SwitchResource(Package.Resources[lbAssets.SelectedIndex].Value); } if (Package.Resources[lbAssets.SelectedIndex].Value != Package.CurrentResource.Name) { Package.SwitchResource(Package.Resources[lbAssets.SelectedIndex].Value); } PopulateAssetFrames(); } }
/// <summary> /// /// </summary> /// <param name="Package"></param> /// <param name="Frames"></param> /// <param name="DefaultDelay"></param> public static void InitAnimation(AMTPackage Package, string ResourceName, int DefaultDelay = 100) { Package.PackageState = State.LOADED; Package.Animation = new AMTAnimation(); Package.Animation.Manifest.ActionFileName.Add(AMTConfig.DefaultAction); Package.Animation.Manifest.DefaultAction = AMTConfig.DefaultAction; Package.Animation.Actions.Add(new AMTAction()); Package.Animation.Actions[0].Name = AMTConfig.DefaultAction; Package.Animation.Actions[0].Frames.Add(new AMTFrame()); Package.Animation.Actions[0].Frames[0].Resource = ResourceName; Package.Animation.Actions[0].Frames[0].Delay = DefaultDelay; Package.Animation.Actions[0].Frames[0].FrameRef = 0; Package.Animation.Actions[0].Frames[0].Tags.Add("null"); if (Package.CurrentResource.Name != ResourceName) { Package.SwitchResource(ResourceName); } Package.Animation.Actions[0].Frames[0].MD5 = ImageMD5(BytesToImage(Package.CurrentResource.Frames[0])); Package.SavePackage(); Package.PackageState = State.READY; }