예제 #1
0
        /// <summary>
        /// Check is field can be displayed.
        /// </summary>
        /// <param name="info">Field info.</param>
        /// <returns>true if field can be displayed; otherwise false.</returns>
        protected bool CanShow(ConditionalFieldInfo info)
        {
            foreach (var condition in info.Conditions)
            {
                var field = SerizalizedProperties[condition.Key];
                if (!condition.Value(field))
                {
                    return(false);
                }
            }

            return(true);
        }
예제 #2
0
        /// <summary>
        /// Check is field can be displayed.
        /// </summary>
        /// <param name="info">Field info.</param>
        /// <param name="property">Property data.</param>
        /// <returns>true if field can be displayed; otherwise false.</returns>
        protected static bool CanShow(ConditionalFieldInfo info, SerializedProperty property)
        {
            var p = property.FindPropertyRelative(info.Name);

            if (p == null)
            {
                Debug.LogWarning("Field with name '" + info.Name + "' not found");
                return(false);
            }

            foreach (var condition in info.Conditions)
            {
                var field = property.FindPropertyRelative(condition.Key);
                if (!condition.Value(field))
                {
                    return(false);
                }
            }

            return(true);
        }