コード例 #1
0
        private void animationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (projectTree.SelectedNode.Tag is SpriteSheet)
            {
                SpriteSheet s = (SpriteSheet)projectTree.SelectedNode.Tag;
                Animation   a = new Animation();

                using (AnimationDialog ad = new AnimationDialog(s, a))
                {
                    if (ad.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        a.Framerate = ad.Framerate;
                        a.Name      = ad.AnimationName;
                        TreeNode animationNode = new TreeNode(a.Name);
                        animationNode.Name = "AnimationNode";
                        animationNode.Tag  = a;

                        animationNode.SelectedImageKey = animationNode.ImageKey = "anim.png";

                        s.Animations.Add(a);

                        projectTree.SelectedNode.Nodes.Add(animationNode);
                        main.Project.Saved = false;
                    }
                }
            }
        }
コード例 #2
0
        private void editToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SpriteSheet s = (SpriteSheet)projectTree.SelectedNode.Parent.Tag;
            Animation   a = (Animation)projectTree.SelectedNode.Tag;

            using (AnimationDialog ad = new AnimationDialog(s, a))
            {
                if (ad.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    projectTree.SelectedNode.Text = ad.AnimationName;
                    a.Name             = ad.AnimationName;
                    a.Framerate        = ad.Framerate;
                    main.Project.Saved = false;
                }
            }
        }