Beispiel #1
0
        /// <summary>
        /// XML CONSTRUCTOR: Should not be called by API Users, used for deserialization
        /// </summary>
        /// <param name="p_TreeNode">XmlTreeNode used for Deserialization</param>
        /// <param name="p_View">NodeGraphView Object that will contain the node</param>
        public IfNode(XmlTreeNode p_TreeNode, NodeGraphView p_View)
            : base(p_TreeNode, p_View)
        {
            this.m_sName = "If condition";
            this.m_Connectors.Add(new NodeGraphConnector("A", this, ConnectorType.InputConnector, 0));
            this.m_Connectors.Add(new NodeGraphConnector("B", this, ConnectorType.InputConnector, 1));
            this.m_Connectors.Add(new NodeGraphConnector("A>B", this, ConnectorType.InputConnector, 2));
            this.m_Connectors.Add(new NodeGraphConnector("A=B", this, ConnectorType.InputConnector, 3));
            this.m_Connectors.Add(new NodeGraphConnector("A<B", this, ConnectorType.InputConnector, 4));
            this.m_Connectors.Add(new NodeGraphConnector("Value", this, ConnectorType.OutputConnector, 0));
            this.Height = 110;

            // Parses XML to get back our values.

            // Since m_eBehavior is an enum, i've stocked it as a string, then use it to compare
            if (p_TreeNode.m_attributes["Behavior"] == "ErrorOnMissingInput")
            {
                this.m_eBehavior = IfNodeBehavior.ErrorOnMissingInput;
            }
            else
            {
                this.m_eBehavior = IfNodeBehavior.ReturnDefaultValue;
            }

            // Float values can be a pain because of the type of the dot. It's always encoded as en-us CultureInfo
            this.m_fDefaultValue = float.Parse(p_TreeNode.m_attributes["DefaultValue"], System.Globalization.CultureInfo.GetCultureInfo("en-us"));
        }
Beispiel #2
0
        /// <summary>
        /// EDITOR CONSTRUCTOR: Builds the node.
        /// </summary>
        /// <param name="p_X">X Position (in the view)</param>
        /// <param name="p_Y">Y Position (in the view)</param>
        /// <param name="p_View">NodeGraphView Object that will contain the node</param>
        /// <param name="p_CanBeSelected">if the node can be selected</param>
        public IfNode(int p_X, int p_Y, NodeGraphView p_View, bool p_CanBeSelected)
            : base(p_X, p_Y, p_View, p_CanBeSelected)
        {
            this.m_sName = "If condition";
            this.m_Connectors.Add(new NodeGraphConnector("A", this, ConnectorType.InputConnector, 0));
            this.m_Connectors.Add(new NodeGraphConnector("B", this, ConnectorType.InputConnector, 1));
            this.m_Connectors.Add(new NodeGraphConnector("A>B", this, ConnectorType.InputConnector, 2));
            this.m_Connectors.Add(new NodeGraphConnector("A=B", this, ConnectorType.InputConnector, 3));
            this.m_Connectors.Add(new NodeGraphConnector("A<B", this, ConnectorType.InputConnector, 4));
            this.m_Connectors.Add(new NodeGraphConnector("Value", this, ConnectorType.OutputConnector, 0));
            this.Height = 110;

            // Sets our members to default values
            this.m_eBehavior     = IfNodeBehavior.ErrorOnMissingInput;
            this.m_fDefaultValue = 0.0f;
        }
Beispiel #3
0
        /// <summary>
        /// EDITOR CONSTRUCTOR: Builds the node.
        /// </summary>
        /// <param name="p_X">X Position (in the view)</param>
        /// <param name="p_Y">Y Position (in the view)</param>
        /// <param name="p_View">NodeGraphView Object that will contain the node</param>
        /// <param name="p_CanBeSelected">if the node can be selected</param>
        public IfNode(int p_X, int p_Y, NodeGraphView p_View, bool p_CanBeSelected)
            : base(p_X, p_Y, p_View, p_CanBeSelected)
        {
            this.m_sName = "If condition";
            this.m_Connectors.Add(new NodeGraphConnector("A", this, ConnectorType.InputConnector, 0));
            this.m_Connectors.Add(new NodeGraphConnector("B", this, ConnectorType.InputConnector, 1));
            this.m_Connectors.Add(new NodeGraphConnector("A>B", this, ConnectorType.InputConnector, 2));
            this.m_Connectors.Add(new NodeGraphConnector("A=B", this, ConnectorType.InputConnector, 3));
            this.m_Connectors.Add(new NodeGraphConnector("A<B", this, ConnectorType.InputConnector, 4));
            this.m_Connectors.Add(new NodeGraphConnector("Value", this, ConnectorType.OutputConnector, 0));
            this.Height = 110;

            // Sets our members to default values
            this.m_eBehavior = IfNodeBehavior.ErrorOnMissingInput;
            this.m_fDefaultValue = 0.0f;

        }
Beispiel #4
0
        /// <summary>
        /// XML CONSTRUCTOR: Should not be called by API Users, used for deserialization
        /// </summary>
        /// <param name="p_TreeNode">XmlTreeNode used for Deserialization</param>
        /// <param name="p_View">NodeGraphView Object that will contain the node</param>
        public IfNode(XmlTreeNode p_TreeNode, NodeGraphView p_View)
            : base(p_TreeNode, p_View)
        {
            this.m_sName = "If condition";
            this.m_Connectors.Add(new NodeGraphConnector("A", this, ConnectorType.InputConnector, 0));
            this.m_Connectors.Add(new NodeGraphConnector("B", this, ConnectorType.InputConnector, 1));
            this.m_Connectors.Add(new NodeGraphConnector("A>B", this, ConnectorType.InputConnector, 2));
            this.m_Connectors.Add(new NodeGraphConnector("A=B", this, ConnectorType.InputConnector, 3));
            this.m_Connectors.Add(new NodeGraphConnector("A<B", this, ConnectorType.InputConnector, 4));
            this.m_Connectors.Add(new NodeGraphConnector("Value", this, ConnectorType.OutputConnector, 0));
            this.Height = 110;

            // Parses XML to get back our values.

                    // Since m_eBehavior is an enum, i've stocked it as a string, then use it to compare
                    if (p_TreeNode.m_attributes["Behavior"] == "ErrorOnMissingInput") this.m_eBehavior = IfNodeBehavior.ErrorOnMissingInput;
                    else this.m_eBehavior = IfNodeBehavior.ReturnDefaultValue;

                    // Float values can be a pain because of the type of the dot. It's always encoded as en-us CultureInfo
                    this.m_fDefaultValue = float.Parse(p_TreeNode.m_attributes["DefaultValue"], System.Globalization.CultureInfo.GetCultureInfo("en-us"));

        }