private static bool GetInitialValue(fiLogicalOperator op)
 {
     switch (op) {
         case fiLogicalOperator.AND:
             return true;
         case fiLogicalOperator.OR:
             return false;
     }
     throw new NotImplementedException();
 }
 private static bool Combine(fiLogicalOperator op, bool a, bool b)
 {
     switch (op) {
         case fiLogicalOperator.AND:
             return a && b;
         case fiLogicalOperator.OR:
             return a || b;
     }
     throw new NotImplementedException();
 }
示例#3
0
        private static bool Combine(fiLogicalOperator op, bool a, bool b)
        {
            switch (op)
            {
            case fiLogicalOperator.AND:
                return(a && b);

            case fiLogicalOperator.OR:
                return(a || b);
            }
            throw new NotImplementedException();
        }
示例#4
0
        private static bool GetInitialValue(fiLogicalOperator op)
        {
            switch (op)
            {
            case fiLogicalOperator.AND:
                return(true);

            case fiLogicalOperator.OR:
                return(false);
            }
            throw new NotImplementedException();
        }
        public static bool ComputeValue(fiLogicalOperator op, string[] memberNames, object element)
        {
            bool finalValue = GetInitialValue(op);

            for (int i = 0; i < memberNames.Length; ++i) {
                string memberName = memberNames[i];
                bool result = fiRuntimeReflectionUtility.GetBooleanReflectedMember(
                    element.GetType(), element, memberName, /*defaultValue:*/true);
                finalValue = Combine(op, finalValue, result);
            }

            return finalValue;
        }
示例#6
0
        public static bool ComputeValue(fiLogicalOperator op, string[] memberNames, object element)
        {
            bool finalValue = GetInitialValue(op);

            for (int i = 0; i < memberNames.Length; ++i)
            {
                string memberName = memberNames[i];
                bool   result     = fiRuntimeReflectionUtility.GetBooleanReflectedMember(
                    element.GetType(), element, memberName, /*defaultValue:*/ true);
                finalValue = Combine(op, finalValue, result);
            }

            return(finalValue);
        }
 public InspectorDisabledIfAttribute(fiLogicalOperator op, params string[] memberNames)
 {
     Operator = op;
     ConditionalMemberNames = memberNames;
 }
 /// <summary>
 /// This allows a member to be conditionally shown in the inspector depending upon the
 /// state of other variables in object. This does *not* change serialization behavior,
 /// only display behavior.
 /// </summary>
 /// <param name="conditionalMemberNames">The names of the members to use as a condition.
 /// You can control how these members are combined using the LogicalOperator Operator parameter.
 ///
 /// Each conditional needs to either be a boolean field, a boolean property with a
 /// getter, or a no-argument method that returns a boolean.
 /// </param>
 /// <param name="op">Determines how multiple boolean values are combined to determine if
 /// the property is hidden.</param>
 public InspectorShowIfAttribute(fiLogicalOperator op, params string[] conditionalMemberNames)
 {
     Operator = op;
     ConditionalMemberNames = conditionalMemberNames;
 }
 /// <summary>
 /// This allows a member to be conditionally hidden in the inspector depending upon the
 /// state of other variables in object. This does *not* change serialization behavior,
 /// only display behavior.
 /// </summary>
 /// <param name="conditionalMemberName">The name of the member to use as a condition.
 /// The conditional needs to either be a boolean field, a boolean property with a
 /// getter, or a no-argument method that returns a boolean.
 /// </param>
 public InspectorShowIfAttribute(string conditionalMemberName)
 {
     Operator = fiLogicalOperator.AND;
     ConditionalMemberName = conditionalMemberName;
 }
 /// <summary>
 /// This allows a member to be conditionally hidden in the inspector depending upon the
 /// state of other variables in object. This does *not* change serialization behavior,
 /// only display behavior.
 /// </summary>
 /// <param name="conditionalMemberNames">The names of the members to use as a condition.
 /// You can control how these members are combined using the LogicalOperator Operator parameter.
 ///
 /// Each conditional needs to either be a boolean field, a boolean property with a
 /// getter, or a no-argument method that returns a boolean.
 /// </param>
 /// <param name="op">Determines how multiple boolean values are combined to determine if
 /// the property is hidden.</param>
 public InspectorHideIfAttribute(fiLogicalOperator op, params string[] conditionalMemberNames)
 {
     Operator = op;
     ConditionalMemberNames = conditionalMemberNames;
 }
 /// <summary>
 /// This allows a member to be conditionally hidden in the inspector depending upon the
 /// state of other variables in object. This does *not* change serialization behavior,
 /// only display behavior.
 /// </summary>
 /// <param name="conditionalMemberName">The name of the member to use as a condition.
 /// The conditional needs to either be a boolean field, a boolean property with a
 /// getter, or a no-argument method that returns a boolean.
 /// </param>
 public InspectorHideIfAttribute(string conditionalMemberName)
 {
     Operator = fiLogicalOperator.AND;
     ConditionalMemberName = conditionalMemberName;
 }
示例#12
0
 public InspectorDisabledIfAttribute(fiLogicalOperator op, params string[] memberNames)
 {
     Operator = op;
     ConditionalMemberNames = memberNames;
 }