/// <summary> /// This method is designed to be called externally by scripts. /// A new flow chart node will be created and registered to the current constructing FlowChartTree. /// If current editing node is a normal node, the newly created one is intended to be its /// succeed node. The link between the new node and the current one will be added immediately, which /// won't be registered as a lazy binding link. /// </summary> /// <param name="name">the name of the new node</param> /// <param name="description">the description of the new node</param> public void RegisterNewNode(string name, string description) { var nextNode = new FlowChartNode(name, description); if (currentNode != null && currentNode.type == FlowChartNodeType.Normal) { currentNode.AddBranch(BranchInformation.Defualt, nextNode); } currentNode = nextNode; // The try block here is to make debug info easier to read try { flowChartTree.AddNode(currentNode); } catch (ArgumentNullException) { throw new ArgumentException("Nova: A label must have a name"); } catch (ArgumentException) { throw new DuplicatedDefinitionException( string.Format("Nova: Multiple definition of the same label {0}", currentNode.name)); } }
/// <summary> /// Create a new flow chart node register it to the current constructing FlowChartTree. /// If the current node is a normal node, the newly created one is intended to be its /// succeeding node. The link between the new node and the current one will be added immediately, which /// will not be registered as a lazy binding link. /// This method is designed to be called externally by scripts. /// </summary> /// <param name="name">Internal name of the new node</param> /// <param name="displayName">Displayed name of the new node</param> public void RegisterNewNode(string name, string displayName) { var nextNode = new FlowChartNode(name); if (currentNode != null && currentNode.type == FlowChartNodeType.Normal) { currentNode.AddBranch(BranchInformation.Default, nextNode); } currentNode = nextNode; flowChartTree.AddNode(currentNode); currentNode.AddLocalizedName(stateLocale, displayName); }