/// <summary>
        /// Initializes a new instance of the <see cref="EmitterTreeNode"/> class.
        /// </summary>
        /// <param name="emitter">The emitter.</param>
        public EmitterTreeNode(AbstractEmitter emitter) : base()
        {
            this.Emitter = emitter;

            this.ForeColor = emitter.Enabled ? SystemColors.WindowText : Color.Gray;

            this.Text = emitter.Enabled ? emitter.Name : String.Format("{0} (Disabled)", emitter.Name);

            this.Emitter.NameChanged += (o, s) => this.Text = this.Emitter.Name;

            this.Tag = emitter;

            foreach (AbstractModifier modifier in emitter.Modifiers)
            {
                ModifierTreeNode node = new ModifierTreeNode(modifier);

                this.Nodes.Add(node);
            }

            foreach (AbstractController controller in emitter.Controllers)
            {
                ControllerTreeNode node = new ControllerTreeNode(controller);

                this.Nodes.Add(node);
            }

            if (emitter.Enabled)
            {
                this.Expand();
            }
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EmitterTreeNode"/> class.
        /// </summary>
        /// <param name="emitter">The emitter.</param>
        public EmitterTreeNode(AbstractEmitter emitter) : base()
        {
            this.Emitter = emitter;

            this.ForeColor = emitter.Enabled ? SystemColors.WindowText : Color.Gray;

            this.Text = emitter.Enabled ? emitter.Name : String.Format("{0} (Disabled)", emitter.Name);

            this.Emitter.NameChanged += (o, s) => this.Text = this.Emitter.Name;

            this.Tag = emitter;

            foreach (AbstractModifier modifier in emitter.Modifiers)
            {
                ModifierTreeNode node = new ModifierTreeNode(modifier);

                this.Nodes.Add(node);
            }

            foreach (AbstractController controller in emitter.Controllers)
            {
                ControllerTreeNode node = new ControllerTreeNode(controller);

                this.Nodes.Add(node);
            }

            if (emitter.Enabled)
            {
                this.Expand();
            }
        }
Exemple #3
0
        /// <summary>
        /// Handles the Click event of the uxCloneMenuItem control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void uxCloneMenuItem_Click(object sender, EventArgs e)
        {
            var selectedNode = this.uxEffectTree.SelectedNode;

            if (selectedNode is EmitterTreeNode)
            {
                CloneEmitterEventArgs args = new CloneEmitterEventArgs((selectedNode as EmitterTreeNode).Emitter);

                this.OnEmitterCloned(args);

                if (args.AddedEmitter != null)
                {
                    EmitterTreeNode newNode = new EmitterTreeNode(args.AddedEmitter);

                    selectedNode.Parent.Nodes.Add(newNode);

                    newNode.Expand();

                    newNode.EnsureVisible();
                }
            }
            else if (selectedNode is ModifierTreeNode)
            {
                CloneModifierEventArgs args = new CloneModifierEventArgs((selectedNode as ModifierTreeNode).Modifier);

                this.OnModifierCloned(args);

                if (args.AddedModifier != null)
                {
                    ModifierTreeNode newNode = new ModifierTreeNode(args.AddedModifier);

                    selectedNode.Parent.Nodes.Add(newNode);

                    newNode.EnsureVisible();
                }
            }
            else if (selectedNode is ControllerTreeNode)
            {
                var args = new CloneControllerEventArgs((selectedNode as ControllerTreeNode).Controller);

                this.OnControllerCloned(args);

                if (args.AddedController != null)
                {
                    ControllerTreeNode newNode = new ControllerTreeNode(args.AddedController);

                    selectedNode.Parent.Nodes.Add(newNode);

                    newNode.Expand();

                    newNode.EnsureVisible();
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// Handles the DropDownItemClicked event of the uxAddControllerMenuItem control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.ToolStripItemClickedEventArgs"/> instance containing the event data.</param>
        private void uxAddControllerMenuItem_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            try
            {
                EmitterTreeNode parentNode = this.uxEffectTree.SelectedNode as EmitterTreeNode;

                IControllerPlugin plugin = e.ClickedItem.Tag as IControllerPlugin;

                AbstractEmitter parent = parentNode.Emitter;

                var args = new NewControllerEventArgs(parent, plugin);

                this.OnControllerAdded(args);

                if (args.AddedController!= null)
                {
                    AbstractController controller = args.AddedController;

                    ControllerTreeNode node = new ControllerTreeNode(controller);

                    parentNode.Nodes.Add(node);

                    node.EnsureVisible();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }