// --------------------------------------------------------------------------------- /// Stops the repaint time. void StopRepaintTimer() { if (ourRepaintTimer != null) { ourRepaintTimer.Stop(); ourRepaintTimer = null; } }
// ================================================================================= // REPAINT TIMER UTILITY // --------------------------------------------------------------------------------- /// Starts the repaint time. void StartRepaintTimer() { if (ourRepaintTimer == null) { ourRepaintTimer = TimerService.CreateTimedAction(0.06f, Repaint, /*isLooping=*/ true); ourRepaintTimer.Schedule(); } }
// ======================================================================= // Utilities // ----------------------------------------------------------------------- void UpdateErrorRepaintTimer() { if (!ErrorController.IsErrorOrWarning) { if (ourErrorRepaintTimer != null) { ourErrorRepaintTimer.Stop(); } } else { if (ourErrorRepaintTimer == null) { ourErrorRepaintTimer = TimerService.CreateTimedAction(0.06f, Repaint, /*isLooping=*/ true); } else if (ourErrorRepaintTimer.IsElapsed) { ourErrorRepaintTimer.Restart(); } } }
// ----------------------------------------------------------------------- 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); } }
// ---------------------------------------------------------------------- /// Returns the active status of the timed action. /// /// @param timedAction The timed action analysed. /// @return _true_ if the timed action is scheduled. _false_ otherwise. /// public static bool IsActive(TimedAction timedAction) { return(myTimerService.IsActive(timedAction)); }
// ---------------------------------------------------------------------- /// Stops and removed a timed action from the timr service. /// /// @param timedAction The timed action to be stopped. /// public static void Stop(TimedAction timedAction) { myTimerService.Stop(timedAction); }
// ---------------------------------------------------------------------- /// Restart and reschedule the given timed action. /// /// @param timedAction The timed action to be restart and rescheduled. /// public static void Restart(TimedAction timedAction) { myTimerService.Restart(timedAction); }
// ---------------------------------------------------------------------- /// Schedule a timed action into the timer service. /// /// @param timedAction The timed action to be scheduled. /// public static void Schedule(TimedAction timedAction) { myTimerService.Schedule(timedAction); }