Example #1
0
        /// <summary>
        /// Load function that unpacks <see cref="Rule"/> from corresponding <see cref="SerializedProperty"/>.
        /// </summary>
        private void LoadRule(bool inSet)
        {
            if (inSet)
            {
                string setName   = SubjectRule.propertyPath.Remove(SubjectRule.propertyPath.IndexOf(".Array")).Replace("Profile.", "");
                int    ruleIndex = int.Parse(SubjectRule.propertyPath.Substring(SubjectRule.propertyPath.IndexOf("[") + 1).Replace("]", ""));

                deserializedRule = RuleSystemUtil.DeserializeRule(SubjectRule, setName, ruleIndex);
            }
            else
            {
                deserializedRule = RuleSystemUtil.DeserializeRule(SubjectRule);
            }
            rootNode = RuleCreator.CreateRoot(deserializedRule.RootGridPosition, OnNodePortContact, OnUpdateRootRequest, OnRemoveAThread, deserializedRule.MandatoryId, deserializedRule.QualityId, deserializedRule.MyAction, NodeSkin);
            if (deserializedRule.MyAction != null)
            {
                actionNode = RuleCreator.CreateActionNode(deserializedRule.ActionGridPosition, OnNodePortContact, OnUpdateActionRequest, OnRemoveNode, OnRemoveAThread, deserializedRule.MyAction, NodeSkin);
            }
            foreach (Decision decision in deserializedRule.MyDecisions)
            {
                ruleDecisions.Add(decision);
                NodeShell rawNode = RuleCreator.CreateNewDecisionNode(decision.identifier, decision.Operator, OnUpdateRuleRequest, OnNodePortContact, OnRemoveNode, OnRemoveAThread, NodeSkin);
                rawNode.Container = new NodeShell.Data
                {
                    FloatValue = decision.FlatValue
                };
                rawNode.Inputs        = decision.inputID;
                rawNode.Rect.position = decision.GridPosition;
                rawNode.activated     = true;
                ruleNodes.Add(rawNode);
            }
        }
Example #2
0
 /// <summary>
 /// Action-event handles <see cref="NodeShell"/> instantiation. Used specificly for <see cref="Decision"/> nodes.
 /// </summary>
 /// <param name="statement"><see cref="Statement"/> requesting node. </param>
 private void OnRequestDecisionNode(Statement statement)
 {
     createdDecision            = new Decision();
     createdDecision.identifier = GenerateDecisionId();
     createdDecision.Operator   = statement;
     createdNode = RuleCreator.CreateNewDecisionNode(createdDecision.identifier, statement, OnUpdateRuleRequest, OnNodePortContact, OnRemoveNode, OnRemoveAThread, NodeSkin);
     createdNode.Rect.position = mousePos;
 }
Example #3
0
 /// <summary>
 /// Action-event handles <see cref="ActionShell"/> instantiation.
 /// </summary>
 /// <param name="action"><see cref="Action"/> that needs a node. </param>
 private void OnRequestActionNode(Action action)
 {
     createdActionNode = RuleCreator.CreateActionNode(deserializedRule.ActionGridPosition, OnNodePortContact, OnUpdateActionRequest, OnRemoveNode, OnRemoveAThread, action, NodeSkin);
     createdActionNode.Rect.position = mousePos;
 }