Example #1
0
        public void Remove(BuildNotification notification)
        {
            BuildNotification entry = null;

            switch (notification.cat)
            {
            case BuildNotification.Category.Error:
                entry = FindDuplicate(notification, errors);
                if (entry != null)
                {
                    errors.Remove(entry);
                }
                break;

            case BuildNotification.Category.Warning:
                entry = FindDuplicate(notification, warnings);
                if (entry != null)
                {
                    warnings.Remove(entry);
                }
                break;

            case BuildNotification.Category.Notification:
                entry = FindDuplicate(notification, notifications);
                if (entry != null)
                {
                    notifications.Remove(entry);
                }
                break;
            }
        }
Example #2
0
 private void RefreshList(List <BuildNotification> buildNotifications)
 {
     for (int i = 0; i < buildNotifications.Count; i++)
     {
         BuildNotification note = buildNotifications[i];
         if (note.clearable)
         {
             buildNotifications.RemoveAt(i);
             --i;
         }
     }
 }
Example #3
0
        private BuildNotification FindDuplicate(BuildNotification notification, List <BuildNotification> list)
        {
            BuildNotification duplicate = null;

            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].title.Equals(notification.title) && list[i].details.Equals(notification.details))
                {
                    duplicate = list[i];
                    break;
                }
            }

            return(duplicate);
        }
Example #4
0
        public void AddNotification(BuildNotification notification)
        {
            BuildNotification entry = null;

            switch (notification.cat)
            {
            case BuildNotification.Category.Error:
                entry = FindDuplicate(notification, errors);
                if (entry == null)
                {
                    errors.Add(notification);
                }
                else if (entry.valid == null && notification.valid != null)
                {
                    entry.valid = notification.valid;
                }
                break;

            case BuildNotification.Category.Warning:
                entry = FindDuplicate(notification, warnings);
                if (entry == null)
                {
                    warnings.Add(notification);
                }
                else if (entry.valid == null && notification.valid != null)
                {
                    entry.valid = notification.valid;
                }
                break;

            case BuildNotification.Category.Notification:
                entry = FindDuplicate(notification, notifications);
                if (entry == null)
                {
                    notifications.Add(notification);
                }
                else if (entry.valid == null && notification.valid != null)
                {
                    entry.valid = notification.valid;
                }
                break;
            }
        }
Example #5
0
        private void DrawWarnings()
        {
            int warningCount   = 0;
            int clearableCount = 0;

            for (int i = 0; i < BuildNotificationList.instance.warnings.Count; i++)
            {
                BuildNotification notification = BuildNotificationList.instance.warnings[i];

                if (notification.valid == null || notification.valid())
                {
                    ++warningCount;
                }
                if (notification.clearable)
                {
                    ++clearableCount;
                }
            }

            if (warningCount == 0)
            {
                return;
            }

            Color defaultBackgroundColor = GUI.backgroundColor;

            EditorGUILayout.BeginHorizontal();
            GUI.backgroundColor = Color.yellow;
            UnityBuildGUIUtility.DropdownHeader(
                "Warnings (" + warningCount + ")",
                ref show, true,
                GUILayout.ExpandWidth(true));

            if (clearableCount > 0)
            {
                if (GUILayout.Button(clearButtonContent, UnityBuildGUIUtility.helpButtonStyle))
                {
                    BuildNotificationList.instance.RefreshWarnings();
                }
            }

            GUI.backgroundColor = defaultBackgroundColor;
            EditorGUILayout.EndHorizontal();

            if (show)
            {
                EditorGUILayout.BeginVertical(UnityBuildGUIUtility.dropdownContentStyle);

                for (int i = 0; i < BuildNotificationList.instance.warnings.Count; i++)
                {
                    BuildNotification notification = BuildNotificationList.instance.warnings[i];

                    if (notification.valid == null || notification.valid())
                    {
                        EditorGUILayout.HelpBox(notification.title + "\n" + notification.details, MessageType.Warning);
                    }
                }

                EditorGUILayout.EndVertical();
            }

            GUILayout.Space(15);
        }