Exemple #1
0
    /// <summary>
    /// Metod that implements the logic of addition and removal of expressions from the condtiitons
    /// </summary>
    /// <param name="conditionIndex"></param>
    private void AddRemoveExpressionFunctionality(int conditionIndex)
    {
        if (GUILayout.Button("+", GUILayout.Width(50)))
        {
            int      __funcIndex        = 0;
            int      __concIndex        = 0;
            Operator __selectedOperator = target.ConditionList[conditionIndex].ExpressionList.Count <= 0 ?
                                          Operator.EQUALS : Operator.END;

            //Adds the condition expression to the current condition
            target.ConditionList[conditionIndex].AddExpression(new ConditionExpression(
                                                                   _conditionDisplayer.GetConceptByIndex(__concIndex),
                                                                   _conditionDisplayer.GetFunctionFromConceptByIndex(_conditionDisplayer.CurrentConcept, __funcIndex),
                                                                   __selectedOperator));

            //Adds the current concept and function INDEX to the SLECTED concept and function list
            _conditionDisplayer.AddConceptInCurrentConditionExpressionList(conditionIndex, __concIndex);
            _conditionDisplayer.AddFunctionInCurrentConditionExpressionList(conditionIndex, __funcIndex);
            _conditionDisplayer.AddOperatorInCurrentConditionExpressionList(conditionIndex, __selectedOperator);
        }
        else if (GUILayout.Button("-", GUILayout.Width(50)))
        {
            if (target.ConditionList[conditionIndex].ExpressionList.Count > 0)
            {
                _conditionDisplayer.RemoveConditionExpression(conditionIndex);
                target.ConditionList[conditionIndex].RemoveExpression();
            }
        }
    }
Exemple #2
0
    private void AddRemoveExpressionFunctionality(int cndIndx)
    {
        if (GUILayout.Button("+", GUILayout.Width(50)))
        {
            int      __funcIndex        = 0;
            int      __concIndex        = 0;
            Operator __selectedOperator = Operator.END;

            //Adds the condition expression to the current condition

            ConditionExpression exp = new ConditionExpression(
                displayer.GetConceptByIndex(__concIndex),
                displayer.GetFunctionFromConceptByIndex(displayer.CurrentConcept, __funcIndex),
                __selectedOperator);

            target.ConditionList[cndIndx].AddExpression(exp);

            //if(target.Config != null) target.Config.ConditionList[cndIndx].AddExpression(exp);

            //Adds the current concept and function INDEX to the SELECTED concept and function list
            displayer.AddConceptInCurrentConditionExpressionList(cndIndx, __concIndex);
            displayer.AddFunctionInCurrentConditionExpressionList(cndIndx, __funcIndex);
            displayer.AddOperatorInCurrentConditionExpressionList(cndIndx, __selectedOperator);

            EditorUtility.SetDirty(target);
        }

        else if (GUILayout.Button("-", GUILayout.Width(50)))
        {
            if (target.ConditionList[cndIndx].ExpressionList.Count > 0)
            {
                displayer.RemoveConditionExpression(cndIndx);
                target.ConditionList[cndIndx].RemoveExpression();

                EditorUtility.SetDirty(target);
            }
            else
            {
                Debug.LogWarning("@FuzzyBehaviourEditor - Cannot delete inicial condition expression. Delete condition instead");
            }
        }
    }