/// <summary>
 /// Gets whether this step is visible.
 /// </summary>
 /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param>
 /// <returns><c>true</c> if this step is visible, given the current state;
 /// <c>false</c> otherwise.</returns>
 public bool GetIsVisible(ConditionStateManager p_csmStateManager)
 {
     if (VisibilityCondition == null)
     {
         return(true);
     }
     return(VisibilityCondition.GetIsFulfilled(p_csmStateManager));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets whether this step is visible.
 /// </summary>
 /// <param name="coreDelegates">The Core delegates component.</param>
 /// <returns><c>true</c> if this step is visible, given the current state;
 /// <c>false</c> otherwise.</returns>
 public bool GetIsVisible(ConditionStateManager csmState, CoreDelegates coreDelegates)
 {
     if (VisibilityCondition == null)
     {
         return(true);
     }
     return(VisibilityCondition.GetIsFulfilled(csmState, coreDelegates));
 }
Ejemplo n.º 3
0
        public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
        {
            var visibilityConditions = VisibilityCondition.ParseFromString(ConditionalAttribute.visibleConditions);

            var isVisible = VisibilityCondition.CheckConditions(visibilityConditions, property);

            // If the target field passes the check or we're just disabling the field - return the actual height
            if (isVisible)
            {
                return(EditorGUI.GetPropertyHeight(property, label));
            }

            // Invisible property; Remove the default spacing
            return(-EditorGUIUtility.standardVerticalSpacing);
        }
Ejemplo n.º 4
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var visibilityConditions = VisibilityCondition.ParseFromString(ConditionalAttribute.visibleConditions);
            var enabledConditions    = VisibilityCondition.ParseFromString(ConditionalAttribute.enableConditions);

            var isVisible = VisibilityCondition.CheckConditions(visibilityConditions, property);
            var isEnabled = VisibilityCondition.CheckConditions(enabledConditions, property);

            var guiEnabled = GUI.enabled;

            GUI.enabled = isEnabled;

            if (isVisible)
            {
                EditorGUI.PropertyField(position, property, label, true);
            }

            GUI.enabled = guiEnabled;
        }
Ejemplo n.º 5
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            foreach (var conditionalLabel in ConditionalAttribute.conditionalLabels)
            {
                var conditions = VisibilityCondition.ParseFromString(conditionalLabel.Value);

                var isVisible = VisibilityCondition.CheckConditions(conditions, property);

                if (!isVisible)
                {
                    continue;
                }

                label.text = conditionalLabel.Key;
                break;
            }

            EditorGUI.PropertyField(position, property, label);
        }
Ejemplo n.º 6
0
 public void Init()
 {
     instance = new VisibilityCondition();
 }