Beispiel #1
0
        /// <summary>
        /// Handles the ModifierAdded event of the Interface.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ProjectMercury.EffectEditor.NewModifierEventArgs"/> instance containing the event data.</param>
        public void Interface_ModifierAdded(object sender, NewModifierEventArgs e)
        {
            Trace.WriteLine("Adding modifier...", "CORE");

            using (new TraceIndenter())
            {
                Trace.WriteLine("Using plugin: " + e.Plugin.Name);
            }

            try
            {
                foreach (Emitter emitter in this.ParticleEffect)
                {
                    if (Object.ReferenceEquals(emitter, e.ParentEmitter))
                    {
                        Modifier modifier = e.Plugin.CreateDefaultInstance();

                        emitter.Modifiers.Add(modifier);

                        e.AddedModifier = modifier;

                        e.Result = CoreOperationResult.OK;

                        return;
                    }
                }

                e.Result = new CoreOperationResult(new Exception("Could not find the specified Emitter."));
            }
            catch (Exception error)
            {
                e.Result = new CoreOperationResult(error);
            }
        }
Beispiel #2
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;

                Emitter parent = parentNode.Emitter;

                var args = new NewModifierEventArgs(parent, plugin);

                this.OnModifierAdded(args);

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

                    ModifierTreeNode node = new ModifierTreeNode(modifier);

                    parentNode.Nodes.Add(node);

                    node.EnsureVisible();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #3
0
        protected virtual void OnModifierAdded(NewModifierEventArgs e)
        {
            Trace.WriteLine("User requires adding a modifier...", "UI");

            using (new TraceIndenter())
            {
                Trace.WriteLine("Emitter: " + e.ParentEmitter.Name);
            }

            using (new HourglassCursor())
            {
                var handler = Interlocked.CompareExchange(ref this.ModifierAdded, null, null);

                if (handler != null)
                {
                    handler.Invoke(this, e);
                }
            }

            this.AssertOperationOK(e.Result);
        }
Beispiel #4
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);
            }
        }
Beispiel #5
0
        protected virtual void OnModifierAdded(NewModifierEventArgs e)
        {
            Trace.WriteLine("User requires adding a modifier...", "UI");

            using (new TraceIndenter())
            {
                Trace.WriteLine("Emitter: " + e.ParentEmitter.Name);
            }

            using (new HourglassCursor())
            {
                var handler = Interlocked.CompareExchange(ref this.ModifierAdded, null, null);

                if (handler != null)
                    handler.Invoke(this, e);
            }

            this.AssertOperationOK(e.Result);
        }
Beispiel #6
0
        /// <summary>
        /// Handles the ModifierAdded event of the Interface.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ProjectMercury.EffectEditor.NewModifierEventArgs"/> instance containing the event data.</param>
        public void Interface_ModifierAdded(Object sender, NewModifierEventArgs e)
        {
            Trace.WriteLine("Adding modifier...", "CORE");

            using (new TraceIndenter())
            {
                Trace.WriteLine("Using plugin: " + e.Plugin.Name);
            }

            try
            {
                foreach (AbstractEmitter emitter in this.ParticleEffect.Emitters)
                {
                    if (Object.ReferenceEquals(emitter, e.ParentEmitter))
                    {
                        AbstractModifier modifier = e.Plugin.ConstructInstance();

                        emitter.Modifiers.Add(modifier);

                        e.AddedModifier = modifier;

                        e.Result = CoreOperationResult.OK;

                        return;
                    }
                }

                e.Result = new CoreOperationResult(new Exception("Could not find the specified Emitter."));
            }
            catch (Exception error)
            {
                e.Result = new CoreOperationResult(error);
            }
        }
 protected virtual void OnModifierAdded(NewModifierEventArgs e)
 {
     if (this.ModifierAdded != null)
         this.ModifierAdded(this, e);
 }
Beispiel #8
0
        /// <summary>
        /// Handles the ModifierAdded event of the Interface.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ProjectMercury.EffectEditor.NewModifierEventArgs"/> instance containing the event data.</param>
        public void Interface_ModifierAdded(object sender, NewModifierEventArgs e)
        {
            foreach (Emitter emitter in this.ParticleEffect)
            {
                if (Object.ReferenceEquals(emitter, e.ParentEmitter))
                {
                    Modifier modifier = e.Plugin.CreateDefaultInstance();

                    emitter.Modifiers.Add(modifier);

                    e.AddedModifier = modifier;

                    return;
                }
            }

            throw new ApplicationException("Could not find the specified Emitter.");
        }