예제 #1
0
 public void IssueEditorUpdate()
 {
     if (EditorUpdate != null)
     {
         EditorUpdate.Invoke();
     }
 }
        public static Task <bool> updateText(string editorText)
        {
            _editorText = editorText;
            EditorUpdate?.Invoke(null, editorText);

            return(Task.FromResult(true));
        }
예제 #3
0
 private void MasterTimeTick(object sender, EventArgs e)
 {
     EditorUpdate?.Invoke(this, e);
 }
예제 #4
0
 internal static void EditorRootUpdate()
 {
     EditorUpdate?.Invoke();
 }
예제 #5
0
        private void ProcessForegroundQueue()
        {
            EditorUpdate?.Invoke(this, EventArgs.Empty);

            _foregroundStepStopwatch.Restart();
            for (; _foregroundStepStopwatch.Elapsed.TotalMilliseconds < 16;)
            {
                if (_enumeration != null)
                {
                    try
                    {
                        if (!_enumeration.MoveNext())
                        {
                            _enumeration.Dispose();
                            _enumeration = null;
                        }
                        else
                        {
                            CurrentReport = _enumeration.Current;
                        }
                    }
                    catch (Exception exception)
                    {
                        CurrentReport = exception.ToString();
                        Debug.LogError(exception);
                        _enumeration?.Dispose();
                        _enumeration = null;
                    }
                }
                else
                {
                    Func <IEnumerable <ProgressBarReport> > task;
                    lock (_gate)
                    {
                        if (_foregroundTasks.Count == 0)
                        {
                            CurrentReport = "";
                            _completeForegroundTasksCounter = 0;
                            EditorApplication.update        =
                                Delegate.Remove(EditorApplication.update, _processForegroundQueue) as
                                EditorApplication.CallbackFunction;
                            return;
                        }

                        ++_completeForegroundTasksCounter;

                        task = _foregroundTasks.Dequeue();
                    }

                    try
                    {
                        _enumeration = task().GetEnumerator();
                    }
                    catch (Exception exception)
                    {
                        CurrentReport = exception.ToString();
                        Debug.LogError(exception);
                    }
                }
            }
        }