public override void OnInspectorGUI() { GUI.color = Color.gray; DrawDefaultInspector(); creator = target as TransLineCreator; GUILayout.Space(5); if (editing || creating) { if (creating) { GUI.color = Color.white; GUILayout.Label("Enter the name of the new line"); creator.editLineName = GUILayout.TextField(creator.editLineName); creator.lineCategory = (LineCategory)EditorGUILayout.EnumPopup("Line Category:", creator.lineCategory); GUILayout.Space(5); GUI.color = Color.green; GUILayout.Label("Add a station by clicking on one..."); GUILayout.Space(5); GUI.color = Color.white; StationsEditor(); if (creator.editingLineStations.Count > 1) { GUILayout.FlexibleSpace(); GUI.color = Color.green; if (GUILayout.Button("Create")) { creator.CreateNewLine(); creator.ResetEditingInfo(); creating = false; } } GUILayout.FlexibleSpace(); GUI.color = Color.yellow; if (GUILayout.Button("Back")) { creator.ResetEditingInfo(); creating = false; } } if (editing) { GUI.color = Color.white; if (creator.editingLine == null) { GUILayout.Space(10); GUILayout.Label("Lines in this scene:"); foreach (var line in creator.lines.Values) { GUI.backgroundColor = line.lineColor; if (GUILayout.Button(line.lineName)) { creator.editingLine = line; creator.PrepareLineForEdit(line); } } GUILayout.FlexibleSpace(); GUI.color = Color.yellow; GUI.backgroundColor = Color.yellow; if (GUILayout.Button("Back")) { creator.ResetEditingInfo(); editing = false; } } else { GUI.color = Color.white; GUILayout.Label("Enter the name of the new line"); creator.editLineName = GUILayout.TextField(creator.editLineName); creator.lineCategory = (LineCategory)EditorGUILayout.EnumPopup("Line Category:", creator.lineCategory); GUILayout.Space(10); GUILayout.Label("Stations in this line:"); StationsEditor(); GUILayout.FlexibleSpace(); GUI.color = Color.cyan; if (GUILayout.Button("Update Line")) { creator.SaveEditingLine(); creator.ResetEditingInfo(); } GUILayout.Space(10); GUI.color = Color.red; if (GUILayout.Button("Remove this line")) { creator.RemoveEditLine(); creator.ResetEditingInfo(); //editing = false; } GUILayout.FlexibleSpace(); GUI.color = Color.yellow; if (GUILayout.Button("Back")) { creator.ResetEditingInfo(); } } } } else { WalkingDistanceEditor(); GUI.color = Color.white; GUILayout.Label("Choose one of the alternatives to start:"); GUI.color = Color.green; if (GUILayout.Button("Create new line")) { creator.ResetEditingInfo(); creating = true; } GUILayout.Space(10); GUI.color = Color.cyan; if (GUILayout.Button("Edit existing line")) { creator.ResetEditingInfo(); editing = true; } GUILayout.FlexibleSpace(); GUI.color = Color.white; GUILayout.Label("Press this button to exit 'Transportation Line Creator'"); GUI.color = Color.yellow; if (GUILayout.Button("Exit")) { editing = false; DestroyImmediate(creator); } } }