/// <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();
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="EmitterTreeNode"/> class.
        /// </summary>
        /// <param name="emitter">The emitter.</param>
        public EmitterTreeNode(Emitter emitter) : base()
        {
            Guard.ArgumentNull("emitter", emitter);

            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 (Modifier modifier in emitter.Modifiers)
            {
                ModifierTreeNode node = new ModifierTreeNode(modifier);

                this.Nodes.Add(node);
            }

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

            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 (Modifier modifier in emitter.Modifiers)
            {
                ModifierTreeNode node = new ModifierTreeNode(modifier);

                this.Nodes.Add(node);
            }

            if (emitter.Enabled)
            {
                this.Expand();
            }
        }
예제 #4
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();
            }
        }
예제 #5
0
        /// <summary>
        /// Handles the DropDownItemClicked event of the uxAddModifierMenuItem 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 uxAddModifierMenuItem_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            try
            {
                EmitterTreeNode parentNode = this.uxEffectTree.SelectedNode as EmitterTreeNode;

                IModifierPlugin plugin = e.ClickedItem.Tag as IModifierPlugin;

                AbstractEmitter parent = parentNode.Emitter;

                var args = new NewModifierEventArgs(parent, plugin);

                this.OnModifierAdded(args);

                if (args.AddedModifier != null)
                {
                    AbstractModifier modifier = args.AddedModifier;

                    ModifierTreeNode node = new ModifierTreeNode(modifier);

                    parentNode.Nodes.Add(node);

                    node.EnsureVisible();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #6
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();
                }
            }
        }