// Token: 0x060022E7 RID: 8935 RVA: 0x001963F4 File Offset: 0x001945F4 private void QueueGraphUpdatesInternal() { bool flag = false; while (this.graphUpdateQueue.Count > 0) { GraphUpdateObject graphUpdateObject = this.graphUpdateQueue.Dequeue(); if (graphUpdateObject.requiresFloodFill) { flag = true; } foreach (object obj in this.astar.data.GetUpdateableGraphs()) { IUpdatableGraph updatableGraph = (IUpdatableGraph)obj; NavGraph graph = updatableGraph as NavGraph; if (graphUpdateObject.nnConstraint == null || graphUpdateObject.nnConstraint.SuitableGraph(this.astar.data.GetGraphIndex(graph), graph)) { GraphUpdateProcessor.GUOSingle item = default(GraphUpdateProcessor.GUOSingle); item.order = GraphUpdateProcessor.GraphUpdateOrder.GraphUpdate; item.obj = graphUpdateObject; item.graph = updatableGraph; this.graphUpdateQueueRegular.Enqueue(item); } } } if (flag) { GraphUpdateProcessor.GUOSingle item2 = default(GraphUpdateProcessor.GUOSingle); item2.order = GraphUpdateProcessor.GraphUpdateOrder.FloodFill; this.graphUpdateQueueRegular.Enqueue(item2); } GraphModifier.TriggerEvent(GraphModifier.EventType.PreUpdate); this.anyGraphUpdateInProgress = true; }
// Token: 0x060022E9 RID: 8937 RVA: 0x00196570 File Offset: 0x00194770 private bool ProcessRegularUpdates(bool force) { while (this.graphUpdateQueueRegular.Count > 0) { GraphUpdateProcessor.GUOSingle guosingle = this.graphUpdateQueueRegular.Peek(); GraphUpdateThreading graphUpdateThreading = (guosingle.order == GraphUpdateProcessor.GraphUpdateOrder.FloodFill) ? GraphUpdateThreading.SeparateThread : guosingle.graph.CanUpdateAsync(guosingle.obj); if (force || !Application.isPlaying || this.graphUpdateThread == null || !this.graphUpdateThread.IsAlive) { graphUpdateThreading &= (GraphUpdateThreading)(-2); } if ((graphUpdateThreading & GraphUpdateThreading.UnityInit) != GraphUpdateThreading.UnityThread) { if (this.StartAsyncUpdatesIfQueued()) { return(false); } guosingle.graph.UpdateAreaInit(guosingle.obj); } if ((graphUpdateThreading & GraphUpdateThreading.SeparateThread) != GraphUpdateThreading.UnityThread) { this.graphUpdateQueueRegular.Dequeue(); this.graphUpdateQueueAsync.Enqueue(guosingle); if ((graphUpdateThreading & GraphUpdateThreading.UnityPost) != GraphUpdateThreading.UnityThread && this.StartAsyncUpdatesIfQueued()) { return(false); } } else { if (this.StartAsyncUpdatesIfQueued()) { return(false); } this.graphUpdateQueueRegular.Dequeue(); if (guosingle.order == GraphUpdateProcessor.GraphUpdateOrder.FloodFill) { this.FloodFill(); } else { try { guosingle.graph.UpdateArea(guosingle.obj); } catch (Exception arg) { Debug.LogError("Error while updating graphs\n" + arg); } } if ((graphUpdateThreading & GraphUpdateThreading.UnityPost) != GraphUpdateThreading.UnityThread) { guosingle.graph.UpdateAreaPost(guosingle.obj); } } } return(!this.StartAsyncUpdatesIfQueued()); }
private void QueueGraphUpdatesInternal() { bool flag = false; while (this.graphUpdateQueue.Count > 0) { GraphUpdateObject graphUpdateObject = this.graphUpdateQueue.Dequeue(); if (graphUpdateObject.requiresFloodFill) { flag = true; } IEnumerator enumerator = this.astar.astarData.GetUpdateableGraphs().GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; IUpdatableGraph updatableGraph = (IUpdatableGraph)obj; NavGraph graph = updatableGraph as NavGraph; if (graphUpdateObject.nnConstraint == null || graphUpdateObject.nnConstraint.SuitableGraph(this.astar.astarData.GetGraphIndex(graph), graph)) { GraphUpdateProcessor.GUOSingle item = default(GraphUpdateProcessor.GUOSingle); item.order = GraphUpdateProcessor.GraphUpdateOrder.GraphUpdate; item.obj = graphUpdateObject; item.graph = updatableGraph; this.graphUpdateQueueRegular.Enqueue(item); } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } } if (flag) { GraphUpdateProcessor.GUOSingle item2 = default(GraphUpdateProcessor.GUOSingle); item2.order = GraphUpdateProcessor.GraphUpdateOrder.FloodFill; this.graphUpdateQueueRegular.Enqueue(item2); } GraphModifier.TriggerEvent(GraphModifier.EventType.PreUpdate); this.anyGraphUpdateInProgress = true; }
// Token: 0x060022EB RID: 8939 RVA: 0x001966D8 File Offset: 0x001948D8 private void ProcessPostUpdates() { while (this.graphUpdateQueuePost.Count > 0) { GraphUpdateProcessor.GUOSingle guosingle = this.graphUpdateQueuePost.Dequeue(); if ((guosingle.graph.CanUpdateAsync(guosingle.obj) & GraphUpdateThreading.UnityPost) != GraphUpdateThreading.UnityThread) { try { guosingle.graph.UpdateAreaPost(guosingle.obj); } catch (Exception arg) { Debug.LogError("Error while updating graphs (post step)\n" + arg); } } } }
// Token: 0x060022EC RID: 8940 RVA: 0x0019674C File Offset: 0x0019494C private void ProcessGraphUpdatesAsync() { AutoResetEvent[] array = new AutoResetEvent[] { this.graphUpdateAsyncEvent, this.exitAsyncThread }; for (;;) { WaitHandle[] waitHandles = array; if (WaitHandle.WaitAny(waitHandles) == 1) { break; } while (this.graphUpdateQueueAsync.Count > 0) { GraphUpdateProcessor.GUOSingle guosingle = this.graphUpdateQueueAsync.Dequeue(); try { if (guosingle.order == GraphUpdateProcessor.GraphUpdateOrder.GraphUpdate) { guosingle.graph.UpdateArea(guosingle.obj); this.graphUpdateQueuePost.Enqueue(guosingle); } else { if (guosingle.order != GraphUpdateProcessor.GraphUpdateOrder.FloodFill) { throw new NotSupportedException(string.Concat(guosingle.order)); } this.FloodFill(); } } catch (Exception arg) { Debug.LogError("Exception while updating graphs:\n" + arg); } } this.asyncGraphUpdatesComplete.Set(); } this.graphUpdateQueueAsync.Clear(); this.asyncGraphUpdatesComplete.Set(); }