Ejemplo n.º 1
0
        /// <summary>
        /// Set the current node as an end node
        /// This method is designed to be called externally by scripts.
        /// </summary>
        /// <remarks>
        /// While a flow chart can have multiple endings, each name of endings should be unique among other endings,
        /// and a node can only have one end name.
        /// </remarks>
        /// <param name="name">The name of the ending</param>
        /// <exception cref="ArgumentException">
        /// ArgumentException will been thrown if is_end is called when the label is not defined.
        /// </exception>
        public void SetCurrentAsEnd(string name)
        {
            if (currentNode == null)
            {
                throw new ArgumentException(
                          string.Format("Nova: is_end({0}) should be called after the definition of a label", name));
            }

            // Set the current node type as end
            currentNode.type = FlowChartNodeType.End;

            // Add the node as an end
            if (name == null)
            {
                name = currentNode.name;
            }

            flowChartTree.AddEnd(name, currentNode);

            // null the current node, is_end will indicates the end of a label
            currentNode = null;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Set the current node as an end node.
        /// This method is designed to be called externally by scripts.
        /// </summary>
        /// <remarks>
        /// A flow chart tree can have multiple end points.
        /// A name can be assigned to an end point, which can differ from the node name.
        /// The name should be unique among all end point names.
        /// </remarks>
        /// <param name="name">
        /// Name of the end point.
        /// If no name is given, the name of the current node will be used.
        /// </param>
        /// <exception cref="ArgumentException">
        /// ArgumentException will be thrown if called without registering the current node.
        /// </exception>
        public void SetCurrentAsEnd(string name)
        {
            if (currentNode == null)
            {
                throw new ArgumentException(
                          $"Nova: SetCurrentAsEnd({name}) should be called after registering the current node.");
            }

            // Set the current node type as End
            currentNode.type = FlowChartNodeType.End;

            // Add the node as an end
            if (name == null)
            {
                name = currentNode.name;
            }

            flowChartTree.AddEnd(name, currentNode);

            // Null the current node, because SetCurrentAsEnd() indicates the end of a node
            currentNode = null;
        }