// ----------------------------------------------------------------------- /// Displays an error/warning icon with the details inside a toolbox. /// /// @param rect The rectangle in which to display the error/warning icon. /// @param errors List of errors /// @param warnings List of warnings /// void DisplayErrorsAndWarningAt(Rect rect, List <ErrorWarning> errors, List <ErrorWarning> warnings) { // -- Display the appropriate error/warning icon -- var icon = errors.Count != 0 ? ErrorController.ErrorIcon : ErrorController.WarningIcon; ErrorController.DisplayErrorOrWarningIconWithAlpha(rect, icon); // -- Display error/warning details -- if (rect.Contains(WindowMousePosition)) { var nbOfMessages = Mathf.Min(5, errors.Count + warnings.Count); var detailRect = ErrorController.DetermineErrorDetailRect(position, rect, nbOfMessages); ErrorController.DisplayErrorAndWarningDetails(detailRect, errors, warnings); } }
// ----------------------------------------------------------------------- /// Displays an icon and message when mouse is over icon. /// /// @param position The parent window rectangle. /// @param iconRect The rectangle used to display the error/warning icon. /// @param icon The icon to be displayed. /// @param errors List of errors /// @param warnings List of warnings /// public static void DisplayIconAndMessages(Rect position, Rect rect, Texture2D icon, string[] errors, string[] warnings) { // -- Display the appropriate error/warning icon -- ErrorController.DisplayErrorOrWarningIconWithAlpha(rect, icon); // -- Display error/warning details -- var mousePosition = Event.current.mousePosition; if (rect.Contains(mousePosition)) { var nbOfMessages = 1; var detailRect = ErrorController.DetermineErrorDetailRect(position, rect, nbOfMessages); ErrorController.DisplayErrorAndWarningDetails(detailRect, errors, null); } }
// ----------------------------------------------------------------------- void DisplayVisualScriptErrorsAndWarnings(List <ErrorWarning> errors, List <ErrorWarning> warnings) { // -- Get error/warning information -- var nbOfErrors = errors.Count; var nbOfWarnings = warnings.Count; // -- Display scene error/warning icon -- var r = GetVisualScriptErrorWarningIconRect(); var icon = nbOfErrors != 0 ? ErrorController.ErrorIcon : ErrorController.WarningIcon; ErrorController.DisplayErrorOrWarningIconWithAlpha(r, icon); // -- Initiate the display of the scene error/warning details when mouse is over the icon -- if (r.Contains(WindowMousePosition)) { showErrorDetails = true; if (showErrorDetailTimer == null) { showErrorDetailTimer = TimerService.CreateTimedAction(1f, () => { showErrorDetails = false; }); showErrorDetailTimer.Schedule(); } else { showErrorDetailTimer.Restart(); } } // -- Display scene errors/warnings -- if (showErrorDetails) { var nbOfMessages = Mathf.Min(10, nbOfErrors + nbOfWarnings); r = ErrorController.DetermineErrorDetailRect(position, r, nbOfMessages, true); if (r.Contains(WindowMousePosition)) { showErrorDetailTimer.Restart(); } ErrorController.DisplayErrorAndWarningDetails(r, errors, warnings); } }