private void btnDone_Click(object sender, EventArgs e) { if (newEv == null) //No changes were made. { btnCancel_Click(sender, e); return; } status = DialogResult.OK; int index = origEvent.Index; MoveDefActionNode action = origEvent.Parent as MoveDefActionNode; action.InsertChild(newEvent, true, index); origEvent.Remove(); if (p != null) { p.SelectedObject = _oldSelectedObject; p.scriptEditor1.MakeScript(); } else if (Completed != null) { Completed(this, null); } }
private void btnDone_Click(object sender, EventArgs e) { if (newEv == null) //No changes were made. { btnCancel_Click(sender, e); return; } status = DialogResult.OK; int index = origEvent.Index; MoveDefActionNode action = origEvent.Parent as MoveDefActionNode; origEvent.Remove(); action.InsertChild(newEvent, true, index); Completed?.Invoke(this, null); }
public void NewActionGroup() { MoveDefActionNode node = new MoveDefActionNode("SubRoutine" + _resource.Children.Count, true, _resource); _resource.AddChild(node); _resource.Name = "[" + _resource.Children.Count + "] SubRoutines"; if (!shown) { MessageBox.Show("Be sure to actually use this subroutine using an event with an offset or it will be removed after you save.\nThis message will not be shown again."); shown = true; } BaseWrapper res = this.FindResource(node, false); res.EnsureVisible(); res.TreeView.SelectedNode = res; }
public void NewActionGroup() { ResourceNode node = null; if ((node = _resource.Parent) is MoveDefArticleNode || (node = _resource.Parent.Parent) is MoveDefArticleNode) { MoveDefArticleNode article = node as MoveDefArticleNode; if (_resource.Children[0] is MoveDefSubActionGroupNode) { node = new MoveDefSubActionGroupNode() { Name = "SubAction" + _resource.Children.Count }; node.AddChild(new MoveDefActionNode("Main", true, _resource)); node.AddChild(new MoveDefActionNode("GFX", true, _resource)); node.AddChild(new MoveDefActionNode("SFX", true, _resource)); } else if (_resource.Children[0] is MoveDefActionGroupNode || _resource.Children[0] is MoveDefActionNode) { if (article.pikmin) { node = new MoveDefActionGroupNode() { Name = "Action" + (_resource.Children.Count) }; node.AddChild(new MoveDefActionNode("Entry", true, _resource)); node.AddChild(new MoveDefActionNode("Exit", true, _resource)); } else node = new MoveDefActionNode("Action" + (_resource.Children.Count), true, _resource); article.actionFlags.AddChild(new MoveDefActionFlagsEntryNode() { Name = "Action" + article.actionFlags.Children.Count }); } } else if (_resource.Children[0] is MoveDefSubActionGroupNode) { node = new MoveDefSubActionGroupNode() { Name = "SubAction" + _resource.Children.Count }; node.AddChild(new MoveDefActionNode("Main", true, _resource)); node.AddChild(new MoveDefActionNode("GFX", true, _resource)); node.AddChild(new MoveDefActionNode("SFX", true, _resource)); node.AddChild(new MoveDefActionNode("Other", true, _resource)); } else if (_resource.Children[0] is MoveDefActionGroupNode) { node = new MoveDefActionGroupNode() { Name = "Action" + (_resource.Children.Count + 274) }; node.AddChild(new MoveDefActionNode("Entry", true, _resource)); node.AddChild(new MoveDefActionNode("Exit", true, _resource)); (_resource as MoveDefEntryNode).Root.data.actionFlags.AddChild(new MoveDefActionFlagsEntryNode() { Name = "Action" + ((_resource as MoveDefEntryNode).Root.data.actionFlags.Children.Count + 274) }); (_resource as MoveDefEntryNode).Root.data.actionPre.AddChild(new MoveDefActionPreEntryNode() { Name = "Action" + ((_resource as MoveDefEntryNode).Root.data.actionPre.Children.Count) }); } _resource.AddChild(node); BaseWrapper res = this.FindResource(node, false); res.EnsureVisible(); res.TreeView.SelectedNode = res; }