internal void Drain() { if (drainDisabled) { return; } drainDisabled = true; List <EventQueueEntry> list = eventQueueEntries; AnimationState animationState = state; for (int i = 0; i < list.Count; i++) { EventQueueEntry eventQueueEntry = list[i]; TrackEntry entry = eventQueueEntry.entry; switch (eventQueueEntry.type) { case EventType.Start: entry.OnStart(); animationState.OnStart(entry); break; case EventType.Interrupt: entry.OnInterrupt(); animationState.OnInterrupt(entry); break; case EventType.End: entry.OnEnd(); animationState.OnEnd(entry); goto case EventType.Dispose; case EventType.Dispose: entry.OnDispose(); animationState.OnDispose(entry); trackEntryPool.Free(entry); break; case EventType.Complete: entry.OnComplete(); animationState.OnComplete(entry); break; case EventType.Event: entry.OnEvent(eventQueueEntry.e); animationState.OnEvent(entry, eventQueueEntry.e); break; } } eventQueueEntries.Clear(); drainDisabled = false; }
public void Add(Event e, double time_offset) { EventQueueEntry entry = new EventQueueEntry(e, time_offset); //We maintain a sorted stable list int insert_index = 0; for (int index = this.event_list.Count - 1; index >= 0; index--) { if (this.event_list[index].getTime() <= time_offset) { insert_index = index + 1; break; } } this.event_list.Insert(insert_index, entry); }
internal void Drain() { if (!this.drainDisabled) { this.drainDisabled = true; List <EventQueueEntry> eventQueueEntries = this.eventQueueEntries; AnimationState state = this.state; for (int i = 0; i < eventQueueEntries.Count; i++) { EventQueueEntry entry = eventQueueEntries[i]; TrackEntry entry2 = entry.entry; switch (entry.type) { case EventType.Start: { entry2.OnStart(); state.OnStart(entry2); continue; } case EventType.Interrupt: { entry2.OnInterrupt(); state.OnInterrupt(entry2); continue; } case EventType.End: entry2.OnEnd(); state.OnEnd(entry2); break; case EventType.Dispose: break; case EventType.Complete: goto Label_00C3; case EventType.Event: goto Label_00D7; default: { continue; } } entry2.OnDispose(); state.OnDispose(entry2); this.trackEntryPool.Free(entry2); continue; Label_00C3: entry2.OnComplete(); state.OnComplete(entry2); continue; Label_00D7: entry2.OnEvent(entry.e); state.OnEvent(entry2, entry.e); } this.eventQueueEntries.Clear(); this.drainDisabled = false; } }