/// <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(); } } }
protected virtual void OnEmitterCloned(CloneEmitterEventArgs e) { Trace.WriteLine("User requires cloning an emitter...", "UI"); using (new TraceIndenter()) { Trace.WriteLine("Prototype: " + e.Prototype.Name); } using (new HourglassCursor()) { var handler = Interlocked.CompareExchange(ref this.EmitterCloned, null, null); if (handler != null) { handler.Invoke(this, e); } } this.AssertOperationOK(e.Result); }
/// <summary> /// Handles the EmitterCloned event of the Interface. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="ProjectMercury.EffectEditor.CloneEmitterEventArgs"/> instance containing the event data.</param> public void Interface_EmitterCloned(object sender, CloneEmitterEventArgs e) { Trace.WriteLine("Cloning emitter...", "CORE"); try { Emitter clone = e.Prototype.DeepCopy(); clone.Initialise(); clone.ParticleTexture = e.Prototype.ParticleTexture; this.ParticleEffect.Add(clone); e.AddedEmitter = clone; e.Result = CoreOperationResult.OK; } catch (Exception error) { e.Result = new CoreOperationResult(error); } }
protected virtual void OnEmitterCloned(CloneEmitterEventArgs e) { Trace.WriteLine("User requires cloning an emitter...", "UI"); using (new TraceIndenter()) { Trace.WriteLine("Prototype: " + e.Prototype.Name); } using (new HourglassCursor()) { var handler = Interlocked.CompareExchange(ref this.EmitterCloned, null, null); if (handler != null) handler.Invoke(this, e); } this.AssertOperationOK(e.Result); }
/// <summary> /// Handles the EmitterCloned event of the Interface. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="ProjectMercury.EffectEditor.CloneEmitterEventArgs"/> instance containing the event data.</param> public void Interface_EmitterCloned(Object sender, CloneEmitterEventArgs e) { Trace.WriteLine("Cloning emitter...", "CORE"); try { AbstractEmitter clone = e.Prototype.DeepCopy(); clone.Initialise(); clone.ParticleTexture = e.Prototype.ParticleTexture; this.ParticleEffect.Emitters.Add(clone); e.AddedEmitter = clone; e.Result = CoreOperationResult.OK; } catch (Exception error) { e.Result = new CoreOperationResult(error); } }
protected virtual void OnEmitterCloned(CloneEmitterEventArgs e) { if (this.EmitterCloned != null) this.EmitterCloned(this, e); }
/// <summary> /// Handles the EmitterCloned event of the Interface. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="ProjectMercury.EffectEditor.CloneEmitterEventArgs"/> instance containing the event data.</param> public void Interface_EmitterCloned(object sender, CloneEmitterEventArgs e) { Emitter clone = e.Prototype.DeepCopy(); clone.Initialise(); clone.ParticleTexture = e.Prototype.ParticleTexture; this.ParticleEffect.Add(clone); e.AddedEmitter = clone; }