private void DrawPrevNextButtons(FrameDebuggerWindow frameDebugger, ref int newLimit) { bool wasEnabled = GUI.enabled; GUI.enabled = newLimit > 1; if (GUILayout.Button(FrameDebuggerStyles.TopToolbar.prevFrame, EditorStyles.toolbarButton)) { frameDebugger.ChangeFrameEventLimit(newLimit - 1); } GUI.enabled = newLimit < FrameDebuggerUtility.count; if (GUILayout.Button(FrameDebuggerStyles.TopToolbar.nextFrame, EditorStyles.toolbarButtonRight)) { frameDebugger.ChangeFrameEventLimit(newLimit + 1); } // If we had last event selected, and something changed in the scene so that // number of events is different - then try to keep the last event selected. if (m_PrevEventsLimit == m_PrevEventsCount) { if (FrameDebuggerUtility.count != m_PrevEventsCount && FrameDebuggerUtility.limit == m_PrevEventsLimit) { frameDebugger.ChangeFrameEventLimit(FrameDebuggerUtility.count); } } m_PrevEventsLimit = FrameDebuggerUtility.limit; m_PrevEventsCount = FrameDebuggerUtility.count; GUI.enabled = wasEnabled; }
private void DrawEventLimitSlider(FrameDebuggerWindow frameDebugger, out int newLimit) { newLimit = 0; EditorGUI.BeginChangeCheck(); bool wasEnabled = GUI.enabled; GUI.enabled = FrameDebuggerUtility.count > 1; newLimit = EditorGUILayout.IntSlider(FrameDebuggerUtility.limit, 1, FrameDebuggerUtility.count, 1, EditorStyles.toolbarSlider); GUI.enabled = wasEnabled; if (EditorGUI.EndChangeCheck()) { frameDebugger.ChangeFrameEventLimit(newLimit); } }