コード例 #1
0
        internal static int DoMaskField(Rect position, int controlID, int mask, string[] flagNames, int[] flagValues, GUIStyle style)
        {
            int  num;
            bool flag;

            return(MaskFieldGUIDeprecated.DoMaskField(position, controlID, mask, flagNames, flagValues, style, out num, out flag));
        }
コード例 #2
0
 internal static int DoMaskField(Rect position, int controlID, int mask, string[] flagNames, GUIStyle style, out int changedFlags, out bool changedToValue)
 {
     int[] array = new int[flagNames.Length];
     for (int i = 0; i < array.Length; i++)
     {
         array[i] = 1 << i;
     }
     return(MaskFieldGUIDeprecated.DoMaskField(position, controlID, mask, flagNames, array, style, out changedFlags, out changedToValue));
 }
        static Enum EnumMaskFieldInternal(Rect position, Enum enumValue, GUIStyle style)
        {
            Type enumType = enumValue.GetType();

            if (!enumType.IsEnum)
            {
                throw new ArgumentException("Parameter enumValue must be of type System.Enum", "enumValue");
            }

            var names = Enum.GetNames(enumType).Select(ObjectNames.NicifyVariableName).ToArray();
            int flags = MaskFieldGUIDeprecated.DoMaskField(
                IndentedRect(position),
                GUIUtility.GetControlID(s_MaskField, FocusType.Keyboard, position),
                Convert.ToInt32(enumValue),
                names, style);

            return(IntToEnumFlags(enumType, flags));
        }
        static Enum DoEnumMaskField(Rect position, GUIContent label, Enum enumValue, GUIStyle style, out int changedFlags, out bool changedToValue)
        {
            var enumType = enumValue.GetType();

            if (!enumType.IsEnum)
            {
                throw new ArgumentException("Parameter enumValue must be of type System.Enum", "enumValue");
            }

            var id    = GUIUtility.GetControlID(s_MaskField, FocusType.Keyboard, position);
            var names = Enum.GetNames(enumType).Select(ObjectNames.NicifyVariableName).ToArray();
            int flags = MaskFieldGUIDeprecated.DoMaskField(
                PrefixLabel(position, id, label),
                id,
                Convert.ToInt32(enumValue),
                names, style, out changedFlags, out changedToValue);

            return(IntToEnumFlags(enumType, flags));
        }
コード例 #5
0
        static Enum EnumMaskFieldInternal(Rect position, GUIContent label, Enum enumValue, GUIStyle style)
        {
            Type enumType = enumValue.GetType();

            if (!enumType.IsEnum)
            {
                throw new ArgumentException("Parameter enumValue must be of type System.Enum", "enumValue");
            }

            var id        = GUIUtility.GetControlID(s_MaskField, FocusType.Keyboard, position);
            var position2 = EditorGUI.PrefixLabel(position, id, label);

            position.xMax = position2.x;

            var names = Enum.GetNames(enumType).Select(ObjectNames.NicifyVariableName).ToArray();
            int flags = MaskFieldGUIDeprecated.DoMaskField(position2, id, Convert.ToInt32(enumValue), names, style);

            return(EnumDataUtility.IntToEnumFlags(enumType, flags));
        }