Exemplo n.º 1
0
    /// <summary>
    /// Use this function to set when witch fields should be visible.
    /// </summary>
    /// <param name='conditionMemberName'>
    /// The name of the Bool field.
    /// </param>
    /// <param name='conditionValue'>
    /// When the Bool 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 bool value is set.
    /// </param>
    protected void ShowOnBool(string conditionMemberName, bool conditionValue, string showingFieldName)
    {
        BoolFieldCondition newFieldCondition = new BoolFieldCondition(conditionMemberName, conditionValue, showingFieldName);

        if (!newFieldCondition.Validate(target, ToString()))
        {
            Debug.LogError(newFieldCondition.Error);
            return;
        }
        AddFieldCondition(showingFieldName, newFieldCondition);
    }
Exemplo n.º 2
0
    /// <summary>
    /// Use this function to set when witch fields should be visible.
    /// </summary>
    /// <param name='conditionFieldName'>
    /// The name of the Bool field.
    /// </param>
    /// <param name='conditionValue'>
    /// When the Bool 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 bool value is set.
    /// </param>
    protected void ShowOnBool(string conditionFieldName, bool conditionValue, string showingFieldName)
    {
        BoolFieldCondition newFieldCondition = new BoolFieldCondition()
        {
            conditionFieldName = conditionFieldName,
            conditionValue     = conditionValue,
            showingFieldName   = showingFieldName,
            isValid            = true
        };

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