コード例 #1
0
        internal static bool GetConditionsFlag(List <bool> conditionValues, EConditionOperator conditionOperator, bool invert)
        {
            bool flag;

            if (conditionOperator == EConditionOperator.And)
            {
                flag = true;
                foreach (var value in conditionValues)
                {
                    flag = flag && value;
                }
            }
            else
            {
                flag = false;
                foreach (var value in conditionValues)
                {
                    flag = flag || value;
                }
            }

            if (invert)
            {
                flag = !flag;
            }

            return(flag);
        }
コード例 #2
0
        private static bool GetConditionsFlag(List <bool> conditionValues, EConditionOperator conditionOperator, bool invert)
        {
            bool flag;

            switch (conditionOperator)
            {
            case EConditionOperator.And:
            {
                flag = true;
                foreach (var value in conditionValues)
                {
                    flag = flag && value;
                }
                return(invert ? !flag : flag);
            }

            case EConditionOperator.Or:
            {
                flag = false;
                foreach (var value in conditionValues)
                {
                    flag = flag || value;
                }
                return(invert ? !flag : flag);
            }

            default:
                throw new InvalidOperationException($"Unknown conditional operator {conditionOperator}");
            }
        }
コード例 #3
0
 public HideIfAttribute(EConditionOperator conditionOperator, params string[] conditions)
     : base(conditionOperator, conditions)
 {
     Inverted = true;
 }
コード例 #4
0
 public ShowIfAttributeBase(EConditionOperator conditionOperator, params string[] conditions)
 {
     ConditionOperator = conditionOperator;
     Conditions        = conditions;
 }
コード例 #5
0
 public ShowIfAttribute(EConditionOperator conditionOperator, params string[] conditions)
     : base(conditionOperator, conditions)
 {
     Inverted = false;
 }