private void AddTreeNodeAction(NodeAction action) { TreeNode treeNodeAttribute = treeNodeRootActions.Nodes.Add(action.GetTreeText()); treeNodeAttribute.ContextMenuStrip = menuAttributes; treeNodeAttribute.Tag = action; EditorHelper.SetNodeIcon(treeNodeAttribute, ENodeIcon.ListItemAction); treeNodeRootActions.ExpandAll(); }
private void AddNodeAction(NodeAction action) { if (action != null) { dialogueNode.Actions.Add(action); AddTreeNodeAction(action); document.RefreshTreeNode(treeNode); document.SetDirty(); } }
private void RemoveTreeNode(TreeNode node) { if (node == null) { return; } if (selectedTreeNode == treeNodeRootConditions) { RemoveAllConditions(); } else if (selectedTreeNode == treeNodeRootActions) { RemoveAllActions(); } else if (selectedTreeNode == treeNodeRootFlags) { RemoveAllFlags(); } else { NodeCondition condition = node.Tag as NodeCondition; NodeAction action = node.Tag as NodeAction; NodeFlag flag = node.Tag as NodeFlag; var parent = node.Parent; node.Remove(); if (condition != null) { if (parent.Tag is NodeConditionGroup) { ((NodeConditionGroup)parent.Tag).Conditions.Remove(condition); } else { dialogueNode.Conditions.Remove(condition); } } else if (action != null) { dialogueNode.Actions.Remove(action); } else if (flag != null) { dialogueNode.Flags.Remove(flag); } } document.RefreshTreeNode(treeNode); document.SetDirty(); }
private void OnPropertyGridAttributesChanged(object s, PropertyValueChangedEventArgs e) { NodeCondition condition = selectedTreeNode.Tag as NodeCondition; NodeAction action = selectedTreeNode.Tag as NodeAction; NodeFlag flag = selectedTreeNode.Tag as NodeFlag; //Refresh node text if (condition != null) { selectedTreeNode.Text = condition.GetTreeText(); } if (action != null) { selectedTreeNode.Text = action.GetTreeText(); } if (flag != null) { selectedTreeNode.Text = flag.GetTreeText(); } document.RefreshTreeNode(treeNode); document.SetDirty(); }