protected void DrawSectionMissionEntry(Rect rect, int index, bool isActive, bool isFocused) { var missionIDProperty = List.serializedProperty.GetArrayElementAtIndex(index); KMMission mission = KMMissionTableOfContentsEditor.GetMission(missionIDProperty.stringValue); string sectionLabel = String.Format("{0}.{1}", sectionNum, index + 1); EditorGUI.PrefixLabel(new Rect(rect.x, rect.y, 30, EditorGUIUtility.singleLineHeight), new GUIContent(sectionLabel)); EditorGUI.LabelField( new Rect(rect.x + 30, rect.y, 200, EditorGUIUtility.singleLineHeight), missionIDProperty.stringValue); if (!IsValidMission(missionIDProperty.stringValue)) { EditorGUI.HelpBox(new Rect(rect.x + 30 + 200, rect.y, 200, EditorGUIUtility.singleLineHeight), "Mission not found!", MessageType.Error); } else if (!IsMissionUnique(missionIDProperty.stringValue)) { EditorGUI.HelpBox(new Rect(rect.x + 30 + 200, rect.y, 100, EditorGUIUtility.singleLineHeight), "Duplicate!", MessageType.Warning); } else if (mission != null) { float x = 30 + 200; //Display Name EditorGUI.LabelField(new Rect(rect.x + x, rect.y, 300, EditorGUIUtility.singleLineHeight), mission.DisplayName); x += 300; } }
protected void OnSelect(ReorderableList list) { //Deselect all other section lists, because otherwise each section will have //an active selection int oldIndex = list.index; editor.ClearTableOfContentsSectionSelections(); list.index = oldIndex; SerializedProperty missionIDProperty = list.serializedProperty.GetArrayElementAtIndex(list.index); KMMission mission = KMMissionTableOfContentsEditor.GetMission(missionIDProperty.stringValue); if (mission != null) { EditorGUIUtility.PingObject(mission); } }
protected bool IsValidMission(String id) { return(KMMissionTableOfContentsEditor.GetMission(id) != null); }