public void AddFlowEvent(ProfilerTimelineGUI.ThreadInfo.FlowEventData flowEventData, int threadIndex, Rect sampleRect, bool isSelectedSample) { var flowEvent = flowEventData.flowEvent; var flowEventType = flowEvent.FlowEventType; switch (flowEventType) { case ProfilerFlowEventType.Begin: if (!hasBeginEventPosition) { m_BeginEventPosition = new Vector2(sampleRect.xMin, sampleRect.yMax); } break; case ProfilerFlowEventType.Next: ProcessSampleRectForNextEvent(sampleRect, threadIndex, flowEvent.FlowId); break; case ProfilerFlowEventType.End: ProcessSampleRectForEndEvent(sampleRect, flowEvent.FlowId); break; default: break; } // Only next and end events show a selected line when selected. if (flowEventType != ProfilerFlowEventType.Begin) { if (isSelectedSample && !hasSelectedEventPosition) { Vector2 selectedFlowEventPosition = k_InvalidPosition; switch (flowEventType) { case ProfilerFlowEventType.Next: selectedFlowEventPosition = new Vector2(sampleRect.xMin, sampleRect.yMax); break; case ProfilerFlowEventType.End: selectedFlowEventPosition = new Vector2(sampleRect.xMax, sampleRect.yMax); break; default: break; } m_SelectedEvent = new SelectedEventData() { flowEventPosition = selectedFlowEventPosition, flowEventType = flowEventType, flowId = flowEventData.flowEvent.FlowId, }; } } }
public void AddFlowEvent(ProfilerTimelineGUI.ThreadInfo.FlowEventData flowEventData, Rect sampleRect, bool isSelectedSample) { var flowEvent = flowEventData.flowEvent; var flowEventId = flowEvent.FlowId; var flowEventType = flowEvent.FlowEventType; if (!m_Flows.TryGetValue(flowEventId, out var flowEvents)) { flowEvents = new List <FlowEventData>(); m_Flows[flowEventId] = flowEvents; } flowEvents.Add(new FlowEventData() { rect = sampleRect, flowEventType = flowEventType, isSelected = isSelectedSample }); if (isSelectedSample) { hasSelectedEvent = true; } }