/// <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); } }
/// <summary> /// Handles the DropDownItemClicked event of the uxAddEmitterMenuItem 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 uxAddEmitterMenuItem_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { try { using (NewEmitterDialog dialog = new NewEmitterDialog()) { if (dialog.ShowDialog() == DialogResult.OK) { IEmitterPlugin plugin = e.ClickedItem.Tag as IEmitterPlugin; var args = new NewEmitterEventArgs(plugin, dialog.EmitterBudget, dialog.EmitterTerm); this.OnEmitterAdded(args); if (args.AddedEmitter != null) { Emitter emitter = args.AddedEmitter; EmitterTreeNode node = new EmitterTreeNode(emitter); this.uxEffectTree.Nodes[0].Nodes.Add(node); node.EnsureVisible(); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <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(); } } }
/// <summary> /// Handles the Click event of the uxReinitialiseEmitter 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 uxReinitialiseEmitter_Click(object sender, EventArgs e) { EmitterTreeNode node = this.uxEffectTree.SelectedNode as EmitterTreeNode; using (NewEmitterDialog dialog = new NewEmitterDialog(node.Emitter.Budget, node.Emitter.Term)) { if (dialog.ShowDialog() == DialogResult.OK) { var args = new EmitterReinitialisedEventArgs(node.Emitter, dialog.EmitterBudget, dialog.EmitterTerm); this.OnEmitterReinitialised(args); } } }
/// <summary> /// Handles the Click event of the uxSelectTexture 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 uxSelectTexture_Click(object sender, EventArgs e) { using (TextureReferenceBrowser browser = new TextureReferenceBrowser(this.TextureReferences, this.TextureReferenceAdded)) { if (browser.ShowDialog() == DialogResult.OK) { EmitterTreeNode node = this.uxEffectTree.SelectedNode as EmitterTreeNode; var args = new TextureReferenceChangedEventArgs(node.Emitter, browser.SelectedReference); this.OnTextureReferenceChanged(args); this.uxPropertyBrowser.Refresh(); } } }