private void loadSelectedSessions(int currentSelectedIndex) { if (_selectedJsonFileIndex == currentSelectedIndex) { return; } try { if (currentSelectedIndex < 0) { throw new System.ArgumentException(string.Format("invalid selected index ({0}). ", currentSelectedIndex)); } string file = getSessionsBySelectedIndex(HanoiUtil.GetVaildJsonFolders(), currentSelectedIndex); if (!loadJsonData(file)) { throw new System.ArgumentException(string.Format("loading file `{0}` failed. ", file)); } HanoiUtil.TotalTimeConsuming = HanoiUtil.calculateTotalTimeConsuming(m_data.Root.callStats); HanoiUtil.CalculateFrameInterval(m_data.Root.callStats, null); _selectedJsonFileIndex = currentSelectedIndex; } catch (Exception ex) { _selectedJsonFileIndex = -1; Debug.LogErrorFormat("[Hanoi] Loading session failed. ({0})", ex.Message); } }
private void loadSession(string file) { ClearHanoiRoot(); if (!loadJsonData(file)) { throw new System.ArgumentException(string.Format("loading file `{0}` failed. ", file)); } HanoiUtil.CalculateFrameInterval(m_data.Root.callStats, null); calculateStackHeight(); }
public void OnGUI() { CheckForResizing(); Handles.BeginGUI(); Handles.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(1, 1, 1)); //control窗口内容 GUILayout.BeginArea(new Rect(0, m_controlScreenPosY, m_winWidth, m_controlScreenHeight)); { drawGUIElement(); } GUILayout.EndArea(); //navigation窗口内容 GUILayout.BeginArea(new Rect(0, m_navigationScreenPosY, m_winWidth, m_navigationScreenHeight)); { if (m_data.isHanoiDataHasContent()) { GraphItWindowLuaPro.DrawGraphs(position, this); } } GUILayout.EndArea(); if (m_data.isHanoiDataLoadSucc() && (EditorWindow.focusedWindow == this)) { CheckForInput(); //detail窗口内容 GUILayout.BeginArea(new Rect(0, m_detailScreenPosY, m_winWidth, m_detailScreenHeight)); { Handles.matrix = Matrix4x4.TRS(m_Translation, Quaternion.identity, new Vector3(m_Scale.x, m_Scale.y, 1)); HanoiUtil.CalculateFrameInterval(m_data.Root.callStats, null); calculateStackHeight(); calculateScreenClipRange(); DrawHanoiData(m_data.Root); drawTimeInterval(); drawFrameInfo(m_data.Root.callStats, mousePositionInDrawing.x); if (m_mouseArea == MouseInArea.DetailScreen) { showMouseGlobalTime(); } } GUILayout.EndArea(); } Handles.EndGUI(); }