Ejemplo n.º 1
0
        static bool GetIsValid(ShowToggleAttribute toggle, SerializedProperty property)
        {
            if (toggle.IsEnum)
            {
                return(GetIsValidEnum(toggle, property));
            }

            return(GetIsValidBool(toggle, property));
        }
Ejemplo n.º 2
0
        static bool GetIsValidEnum(ShowToggleAttribute toggle, SerializedProperty property)
        {
            var propertyPath  = property.propertyPath;
            var conditionPath = propertyPath.Replace(property.name, toggle.fieldName);
            var condition     = property.serializedObject.FindProperty(conditionPath);

            if (condition != null)
            {
                return(toggle.requiredEnumValue.Contains(condition.enumValueIndex));
            }

            Debug.LogWarningFormat("[ShowToggle] could not find attribute {0}", toggle.fieldName);

            return(true);
        }
Ejemplo n.º 3
0
        static ShowToggleDisplay GetDisplay(ShowToggleAttribute toggle, SerializedProperty property)
        {
            var isValid = GetIsValid(toggle, property);

            return(isValid ? toggle.validDisplay : toggle.invalidDisplay);
        }