private void createToolStripMenuItem_Click(object sender, EventArgs e) { try { var dialog = new AddAnimationDialog(this._animation); if (dialog.ShowDialog() != DialogResult.OK) { return; } var eachDuration = dialog.duration / (float)dialog.checkedSpriteNames.Length; var animateAction = new AnimateAction(dialog.name, dialog.isLoop); foreach (var spriteName in dialog.checkedSpriteNames) { var animateFrame = new AnimateFrame(spriteName, new Point(), eachDuration); animateAction.animateFrames.Add(animateFrame); } this._animation.animateActions.Add(dialog.name, animateAction); this.updateAnimateActionsView(); } catch (Exception exc) { MessageBox.Show(this, exc.Message); } }
public static AnimateAction load(BinaryReader reader) { var name = reader.ReadString(); var isLoop = reader.ReadBoolean(); var animateAction = new AnimateAction(name, isLoop); var count = reader.ReadInt32(); for (var i = 0; i < count; i++) { animateAction.animateFrames.Add(AnimateFrame.load(reader)); } return(animateAction); }