Ejemplo n.º 1
0
        void MenuItemEditEmitterName_Click(object sender, EventArgs e)
        {
            TreeNode node = treeView1.SelectedNode;

            if (node == null)
            {
                return;
            }

            if ((ParticleEditorPageEnum)node.Tag != ParticleEditorPageEnum.eEmitter)
            {
                return;
            }

            int index = node.Index;

            if (index < 0 || index >= mEffect.Emitters.Count)
            {
                return;
            }

            NameEdit nameEditControl = new NameEdit();

            nameEditControl.NameText = mEffect.Emitters[index].Name;
            DialogResult result;

            result = nameEditControl.ShowDialog();
            if (result == DialogResult.OK)
            {
                mEffect.Emitters[index].Name = nameEditControl.NameText;
                node.Text = nameEditControl.NameText;
            }
        }
Ejemplo n.º 2
0
        void MenuItemEditMagnetName_Click(object sender, EventArgs e)
        {
            TreeNode node = treeView1.SelectedNode;

            if (node == null)
            {
                return;
            }

            if ((ParticleEditorPageEnum)node.Tag != ParticleEditorPageEnum.eMagnet)
            {
                return;
            }

            int emitterIndex = node.Parent.Index;

            if ((ParticleEditorPageEnum)node.Parent.Tag != ParticleEditorPageEnum.eEmitter)
            {
                return;
            }

            if (emitterIndex < 0 || emitterIndex >= mEffect.Emitters.Count)
            {
                return;
            }

            int magnetIndex = node.Index - (int)ParticleEditorPageEnum.eEmitterPropertyTotal;

            NameEdit nameEditControl = new NameEdit();

            nameEditControl.NameText = mEffect.Emitters[emitterIndex].Magnets[magnetIndex].Name;
            DialogResult result;

            result = nameEditControl.ShowDialog();
            if (result == DialogResult.OK)
            {
                mEffect.Emitters[emitterIndex].Magnets[magnetIndex].Name = nameEditControl.NameText;
                node.Text = nameEditControl.NameText;
            }
        }