Example #1
0
    /// <summary>
    /// Use this function to set when witch fields should be visible.
    /// </summary>
    /// <param name='conditionMemberName'>
    /// The name of the Int field.
    /// </param>
    /// <param name='conditionValue'>
    /// When the Int value is this in the editor, the field is visible.
    /// </param>
    /// <param name='showingFieldName'>
    /// The Field name that should only be visible when the chosen int value is set.
    /// </param>
    protected void ShowOnInt(string conditionMemberName, int conditionValue, string showingFieldName)
    {
        IntFieldCondition newFieldCondition = new IntFieldCondition(conditionMemberName, conditionValue, showingFieldName);

        if (!newFieldCondition.Validate(target, ToString()))
        {
            Debug.LogError(newFieldCondition.Error);
            return;
        }
        AddFieldCondition(showingFieldName, newFieldCondition);
    }
Example #2
0
    /// <summary>
    /// Use this function to set when witch fields should be visible.
    /// </summary>
    /// <param name='conditionFieldName'>
    /// The name of the Int field.
    /// </param>
    /// <param name='conditionValue'>
    /// When the Int value is this in the editor, the field is visible.
    /// </param>
    /// <param name='showingFieldName'>
    /// The Field name that should only be visible when the chosen int value is set.
    /// </param>
    protected void ShowOnInt(string conditionFieldName, int conditionValue, string showingFieldName)
    {
        IntFieldCondition newFieldCondition = new IntFieldCondition()
        {
            conditionFieldName = conditionFieldName,
            conditionValue     = conditionValue,
            showingFieldName   = showingFieldName,
            isValid            = true
        };

        newFieldCondition.Validate(target, ToString());
        fieldConditions.Add(newFieldCondition);
    }