void DrawToolbar(Rect toolbarArea) { GUILayout.BeginArea(toolbarArea, styleToolbar); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); IReGoapAgent[] agentList = AStarDebugRecorder.recordings.Keys.ToArray(); selectedAgent = EditorGUILayout.Popup(selectedAgent, agentList.Select(x => x.ToString()).ToArray(), GUILayout.ExpandWidth(false)); if (selectedAgent < agentList.Count()) { AStarDebugRecording[] nodes = AStarDebugRecorder.recordings.GetValues(agentList[selectedAgent], false).ToArray(); selectedSearch = EditorGUILayout.Popup(selectedSearch, nodes.Select((node, index) => "search #" + index).ToArray(), GUILayout.ExpandWidth(false)); selectedRecording = nodes[selectedSearch]; } else { EditorGUILayout.Popup(0, new GUIContent[0]); } GUILayout.FlexibleSpace(); if (GUILayout.Button("Delete records", GUILayout.Width(100))) { AStarDebugRecorder.recordings.Clear(); } if (GUILayout.Button("Reset view", GUILayout.Width(100))) { offset = Vector2.zero; fontSize = 10; } GUILayout.EndHorizontal(); GUILayout.EndArea(); }
public static void AddRecording(AStarDebugRecording recording) { recordings.Add(recording.search.First().planner.GetCurrentAgent(), recording); }