public override void OnInspectorGUI() { GUI.enabled = true; EditorGUILayout.BeginHorizontal(); if (EditorGUILayoutUtil.ObjectField <UIRoot>("Root", ref root, true)) { Classify(ref root); } if (GUILayout.Button("Refresh", GUILayout.ExpandWidth(false)) || root == null) { Classify(ref root); } GUI.enabled = root != null; if (GUILayout.Button("Rename", GUILayout.ExpandWidth(false))) { Rename(); } GUI.enabled = true; EditorGUILayout.EndHorizontal(); scroll = EditorGUILayout.BeginScrollView(scroll); VisualizeGroup(); EditorGUILayoutUtil.DrawSeparator(); VisualizeDups(); EditorGUILayout.EndScrollView(); }
private void DrawTextList() { EditorGUILayoutUtil.DrawSeparator(); if (!locked && !Selection.gameObjects.IsEmpty() && (roots == null || !Enumerable.SequenceEqual(roots, Selection.gameObjects))) { Clear(); // search labels roots = Selection.gameObjects; foreach (GameObject o in roots) { tabs.Clear(); foreach (UITabHandler t in o.GetComponentsInChildren <UITabHandler>(true)) { tabs.Add(new UITabHandlerInspectorImpl(t)); } } foreach (GameObject o in roots) { // remove number labels HashSet <UIText> ignore = new HashSet <UIText>(); foreach (DropDown dropdown in o.GetComponentsInChildren <DropDown>(true)) { foreach (UIText l in dropdown.GetComponentsInChildren <UIText>(true)) { ignore.Add(l); } } foreach (UIText l in o.GetComponentsInChildren <UIText>(true)) { if (l.text.IsEmpty()) { continue; } if (ignore.Contains(l)) { continue; } if (visibleOnly && (!l.gameObject.activeInHierarchy || !l.enabled)) { continue; } foreach (char c in l.text) { if (char.IsLetter(c) && !char.IsWhiteSpace(c) && !char.IsPunctuation(c)) { labels.Add(l); break; } } } } } foreach (UITabHandlerInspectorImpl inspector in tabs) { if (inspector.OnInspectorGUI()) { Save(); roots = null; } } // draw trigger list EditorGUILayout.BeginVertical(); foreach (UIText l in labels) { if (!mod.ContainsKey(l)) { FindKey(l); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.ObjectField(l, typeof(UIText), true); Color oldColor = GUI.backgroundColor; string srcKey = mod.Get(l); if (srcKey == null) { srcKey = l.textKey; } if (!Lexicon.ContainsKey(srcKey)) { GUI.backgroundColor = Color.red; } string dstKey = EditorGUILayout.TextField(srcKey); GUI.backgroundColor = oldColor; string text = EditorGUILayout.TextField(l.text); if (srcKey != dstKey) { mod[l] = dstKey; } if (text != l.text) { l.SetText(text); EditorUtil.SetDirty(l); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); if (GUILayout.Button("Save")) { Save(); } }