private void OnEnable() { display = serializedObject.FindProperty("display"); displaySettings = serializedObject.FindProperty("displaySettings"); signalsFile = serializedObject.FindProperty("signalsFile"); pathsFile = serializedObject.FindProperty("pathsFile"); script = (LevelMetricsViewer)target; script.onFilesReread += ReloadTree; if (treeViewState == null) { treeViewState = new TreeViewState(); } ReloadTree(); }
private static void DrawHandles(LevelMetricsViewer scr, GizmoType gizmoType) { if (!scr.Display) { return; } if (!scr.DisplaySettings.ShowText) { return; } if (!Selection.Contains(scr.gameObject)) { return; } GUIStyle style = new GUIStyle(); style.normal.textColor = Color.black; Bounds testBound = new Bounds(Vector3.zero, Vector3.one * 0.2f); if (scr.editorSignals.Count > 0) { foreach (KeyValuePair <string, List <Signal.Runtime> > pair in scr.editorSignals) { foreach (Signal.Runtime signal in pair.Value) { string signalName = signal.name; if (!signal.treeElement.IsVisible()) { continue; } foreach (Signal.Data data in signal.Data) { testBound.center = data.pos; if (scr.DisplaySettings.Mode == DisplaySettings.Modes.ViewCheck && !GeometryUtility.TestPlanesAABB(scr.Planes, testBound)) { continue; } Vector3 pos = data.pos + Camera.current.transform.right * signal.gizmoSize * 0.5f; if (data.treeElement.IsVisible()) { Handles.Label(pos, string.Format("{0}: {1} at {2}", signalName, data.count, Utils.FloatToTime(data.time)), style); } } } } } if (scr.editorPaths.Count > 0) { foreach (KeyValuePair <string, Recordable.Runtime> pair in scr.editorPaths) { Recordable.Runtime path = pair.Value; if (!path.treeElement.IsVisible()) { continue; } for (int i = 0; i < path.Data.Count; i++) { testBound.center = path.Data[i].pos; if (!GeometryUtility.TestPlanesAABB(scr.Planes, testBound)) { continue; } Vector3 pos = path.Data[i].pos + Camera.current.transform.right * 0.2f; if (i == 0) { Handles.Label(pos, string.Format("{0}: {1}", path.name, Utils.FloatToTime(path.Data[i].time)), style); } else { Handles.Label(pos, Utils.FloatToTime(path.Data[i].time), style); } } } } }