Exemplo n.º 1
0
    /// <summary>
    /// Implementation and operations to remove concept from the class instance attached to this inspector
    /// </summary>
    private void RemoveConceptFromTargetList()
    {
        if (_selectedConcept >= target.ConceptList.Count || _selectedConcept < 0)
        {
            throw new System.Exception("@Fuzzy Editor Exception - Index out of range");
        }

        _conditionDisplayer.RemoveConceptName(_conditionDisplayer.GetConceptByIndex(_selectedConcept));

        if (target.ConditionList.Count <= 1)
        {
            //Clears the conditions because there is no available concepts
            target.RemoveCondition();
            _conditionDisplayer.RemoveCondition();

            //Removes the concept
            target.ConceptList.RemoveAt(_selectedConcept);
        }
        else
        {
            //Resets expressions with using the selected concept
            _conditionDisplayer.ResetExpressionsUsingConcept(_selectedConcept);

            //Removes the concept
            target.ConceptList.RemoveAt(_selectedConcept);
        }

        _selectedConcept = -1;
    }
Exemplo n.º 2
0
    private void CreateConditionFunctionality()
    {
        if (target.ConceptList.Count <= 0)
        {
            return;
        }

        if (GUILayout.Button("Create contition"))
        {
            target.CreateCondition(displayer.conceptDictionary[0],
                                   displayer.conceptDictionary[0].Functions[0],
                                   Operator.EQUALS);

            if (target.Config)
            {
                target.Config.GetNewColor();
                EditorUtility.SetDirty(target.Config);
            }

            displayer.ReloadConditions();
            displayer.DisplayConditions = true;

            EditorUtility.SetDirty(target);
        }

        if (GUILayout.Button("Remove condition"))
        {
            displayer.RemoveCondition();
            target.RemoveCondition();

            displayer.ReloadConditions();
            EditorUtility.SetDirty(target);

            target.Config.ColorList.RemoveAt(target.Config.ColorList.Count - 1);
            EditorUtility.SetDirty(target.Config);
        }
    }