예제 #1
0
        void DrawNotificationVibrationPattern(SerializedProperty vibrationPattern)
        {
            EditorGUILayout.BeginHorizontal();

            if (notificationVibrationPatternTooltip == null)
            {
                notificationVibrationPatternTooltip = EM_EditorUtil.GetFieldTooltip(typeof(NotificationCategory), NotificationCategory_VibrationPattern);
            }

            EditorGUILayout.LabelField(new GUIContent(vibrationPattern.displayName, notificationVibrationPatternTooltip));
            EditorGUI.BeginChangeCheck();
            vibrationPattern.arraySize = EditorGUILayout.IntField(vibrationPattern.arraySize, GUILayout.Width(50));
            if (EditorGUI.EndChangeCheck())
            {
                // Put a limit on the array size, who wants long patterns? :)
                vibrationPattern.arraySize = Mathf.Clamp(vibrationPattern.arraySize, 0, NotificationCategory_MaxVibrationPatternLength);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUI.indentLevel++;
            for (int i = 0; i < vibrationPattern.arraySize; i++)
            {
                EditorGUILayout.PropertyField(vibrationPattern.GetArrayElementAtIndex(i));
            }
            EditorGUI.indentLevel--;
        }
예제 #2
0
        void DrawNotificationActionButtonsArray(SerializedProperty actionButtons)
        {
            EditorGUILayout.BeginHorizontal();

            if (notificationActionButtonsTooltip == null)
            {
                notificationActionButtonsTooltip = EM_EditorUtil.GetFieldTooltip(typeof(NotificationCategory), NotificationCategory_ActionButtons);
            }

            EditorGUILayout.LabelField(new GUIContent(actionButtons.displayName, notificationActionButtonsTooltip));
            EditorGUI.BeginChangeCheck();
            actionButtons.arraySize = EditorGUILayout.IntField(actionButtons.arraySize, GUILayout.Width(50));
            if (EditorGUI.EndChangeCheck())
            {
                // Won't allow values larger than the maxminum number of buttons allowed.
                actionButtons.arraySize = Mathf.Clamp(actionButtons.arraySize, 0, NotificationCategory_MaxCustomButtons);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUI.indentLevel++;
            for (int i = 0; i < actionButtons.arraySize; i++)
            {
                EditorGUILayout.PropertyField(actionButtons.GetArrayElementAtIndex(i));
            }
            EditorGUI.indentLevel--;
        }
예제 #3
0
        void DrawNotificationVibrationPattern(SerializedProperty vibrationPattern)
        {
            GUIContent plusContent  = EditorGUIUtility.IconContent("Toolbar plus");
            GUIContent minusContent = EditorGUIUtility.IconContent("Toolbar minus");
            GUIStyle   buttonsStyle = new GUIStyle(GUIStyle.none)
            {
                fixedHeight = EM_GUIStyleManager.smallButtonHeight,
                fixedWidth  = EM_GUIStyleManager.smallButtonWidth
            };

            EditorGUILayout.BeginHorizontal();

            if (notificationVibrationPatternTooltip == null)
            {
                notificationVibrationPatternTooltip = EM_EditorUtil.GetFieldTooltip(typeof(NotificationCategory), NotificationCategory_VibrationPattern);
            }

            EditorGUILayout.LabelField(new GUIContent(vibrationPattern.displayName, notificationVibrationPatternTooltip));

            /// Draw plus button.
            bool canAdd = vibrationPattern.arraySize < NotificationCategory_MaxVibrationPatternLength;

            EditorGUI.BeginDisabledGroup(!canAdd);
            if (GUILayout.Button(plusContent, buttonsStyle))
            {
                vibrationPattern.arraySize++;
            }
            EditorGUI.EndDisabledGroup();

            /// Draw minus button.
            bool canDelete = vibrationPattern.arraySize > 0;

            EditorGUI.BeginDisabledGroup(!canDelete);
            if (GUILayout.Button(minusContent, buttonsStyle))
            {
                vibrationPattern.arraySize--;
            }
            EditorGUI.EndDisabledGroup();

            EditorGUILayout.EndHorizontal();

            /// Draw all available patterns.
            EditorGUI.indentLevel++;
            for (int i = 0; i < vibrationPattern.arraySize; i++)
            {
                EditorGUILayout.PropertyField(vibrationPattern.GetArrayElementAtIndex(i));
            }
            EditorGUI.indentLevel--;
        }
예제 #4
0
        void DrawNotificationActionButtonsArray(SerializedProperty actionButtons)
        {
            GUIContent plusButtonContent  = EditorGUIUtility.IconContent("Toolbar Plus");
            GUIContent minusButtonContent = EditorGUIUtility.IconContent("Toolbar Minus");
            GUIStyle   buttonStyle        = new GUIStyle(GUIStyle.none)
            {
                fixedHeight = EM_GUIStyleManager.smallButtonHeight,
                fixedWidth  = EM_GUIStyleManager.smallButtonWidth,
            };

            EditorGUILayout.BeginHorizontal();

            if (notificationActionButtonsTooltip == null)
            {
                notificationActionButtonsTooltip = EM_EditorUtil.GetFieldTooltip(typeof(NotificationCategory), NotificationCategory_ActionButtons);
            }

            EditorGUILayout.LabelField(new GUIContent(actionButtons.displayName, notificationActionButtonsTooltip));

            /// Draw plus button.
            bool canAdd = actionButtons.arraySize < NotificationCategory_MaxCustomButtons;

            EditorGUI.BeginDisabledGroup(!canAdd);
            if (GUILayout.Button(plusButtonContent, buttonStyle))
            {
                actionButtons.arraySize++;
            }
            EditorGUI.EndDisabledGroup();

            /// Draw minus button.
            bool canRemove = actionButtons.arraySize > 0;

            EditorGUI.BeginDisabledGroup(!canRemove);
            if (GUILayout.Button(minusButtonContent, buttonStyle))
            {
                actionButtons.arraySize--;
            }
            EditorGUI.EndDisabledGroup();

            EditorGUILayout.EndHorizontal();

            EditorGUI.indentLevel++;
            for (int i = 0; i < actionButtons.arraySize; i++)
            {
                EditorGUILayout.PropertyField(actionButtons.GetArrayElementAtIndex(i));
            }
            EditorGUI.indentLevel--;
        }
예제 #5
0
        void DrawNotificationCategoryGroupId(SerializedProperty groupId)
        {
            var groupIdLabel = new GUIContent(
                groupId.displayName,
                EM_EditorUtil.GetFieldTooltip(typeof(NotificationCategory), NotificationCategory_GroupId)
                );

            groupId.stringValue = DrawListAsPopup(
                groupIdLabel,
                notificationCatGroupIDs,
                groupId.stringValue
                );

            if (groupId.stringValue.Equals(EM_Constants.NoneSymbol))
            {
                groupId.stringValue = string.Empty;
            }
        }