public override void OnInspectorGUI() { serializedObject.Update(); // Courses can change without recompile so we have to check for them. UpdateAvailableCourses(); DrawRuntimeConfigurationDropDown(); EditorGUI.BeginDisabledGroup(IsCourseListEmpty()); { DrawCourseSelectionDropDown(); GUILayout.BeginHorizontal(); { if (GUILayout.Button("Open Course in Workflow window")) { GlobalEditorHandler.SetCurrentCourse(CourseAssetUtils.GetCourseNameFromPath(configurator.GetSelectedCourse())); GlobalEditorHandler.StartEditingCourse(); } if (GUILayout.Button(new GUIContent("Show Course in Explorer..."))) { string absolutePath = $"{new FileInfo(CourseAssetUtils.GetCourseAssetPath(CourseAssetUtils.GetCourseNameFromPath(configurator.GetSelectedCourse())))}"; EditorUtility.RevealInFinder(absolutePath); } } GUILayout.EndHorizontal(); } EditorGUI.EndDisabledGroup(); serializedObject.ApplyModifiedProperties(); }
private void DrawCourseSelectionDropDown() { int index = 0; string courseName = CourseAssetUtils.GetCourseNameFromPath(configurator.GetSelectedCourse()); if (string.IsNullOrEmpty(courseName) == false) { index = trainingCourseDisplayNames.FindIndex(courseName.Equals); } index = EditorGUILayout.Popup("Selected Training Course", index, trainingCourseDisplayNames.ToArray()); if (index < 0) { index = 0; } string newCourseStreamingAssetsPath = CourseAssetUtils.GetCourseStreamingAssetPath(trainingCourseDisplayNames[index]); if (IsCourseListEmpty() == false && configurator.GetSelectedCourse() != newCourseStreamingAssetsPath) { SetConfiguratorSelectedCourse(newCourseStreamingAssetsPath); GlobalEditorHandler.SetCurrentCourse(trainingCourseDisplayNames[index]); } }