コード例 #1
0
        public static void MaskField(Rect position, GUIContent label, Type type, int value, Action <int> action, bool showExtraOptions = true, GUIStyle style = null)
        {
            if (style == null)
            {
                style = EditorStyles.popup;
            }

            if (GUI.Button(position, label, style))
            {
                var popupWindow = new FunctioningMaskField(type, value, showExtraOptions, action);
                PopupWindow.Show(position, popupWindow);
            }
        }
コード例 #2
0
        public static void EnumFlagsField(GUIContent label, SerializedProperty property, Type type, GUIStyle style, params GUILayoutOption[] options)
        {
#if UNITY_2017_3_OR_ABOVE
            var enumValue = (Enum)Enum.ToObject(type, property.intValue);
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.EnumFlagsField
            if (EditorGUI.EndChangeCheck())
            {
                property.intValue = (int)Enum.ToObject(type, result);
            }
#else
            var position     = EditorGUILayout.GetControlRect();
            int controlID    = EditorGUIUtility.GetControlID(EnumFieldsHashCode, FocusType.Keyboard, position);
            var propertyRect = EditorGUI.PrefixLabel(position, controlID, label);
            FunctioningMaskField.MaskField(propertyRect, type, property);
#endif
        }