private void DrawNamespace(NamespaceMeta namespaceMeta) { EditorGUILayout.LabelField(namespaceMeta.Name + " (" + namespaceMeta.Types.Count + " Types)"); ++EditorGUI.indentLevel; for (int i = 0, max = namespaceMeta.Namespaces.Count; i < max; ++i) { this.DrawNamespace(namespaceMeta.Namespaces[i]); } --EditorGUI.indentLevel; }
public NamespaceMeta GenerateNamespace(string @namespace) { if (string.IsNullOrEmpty(@namespace) == true) { return(this.GlobalNamespace); } NamespaceMeta hitNamespace; if (this.namespaceCache.TryGetValue(@namespace, out hitNamespace) == true) { return(hitNamespace); } string[] targetNamespaces = @namespace.Split('.'); NamespaceMeta currentNamespace = this.GlobalNamespace; for (int n = 0, max = targetNamespaces.Length; n < max; ++n) { int i = 0; int namespacesCount = currentNamespace.Namespaces.Count; string targetNamespace = targetNamespaces[n]; for (; i < namespacesCount; ++i) { NamespaceMeta namespaceMeta = currentNamespace.Namespaces[i]; if (namespaceMeta.Name == targetNamespace) { currentNamespace = namespaceMeta; break; } } if (i == namespacesCount) { NamespaceMeta newNamespace = new NamespaceMeta(targetNamespace); currentNamespace.Namespaces.Add(newNamespace); currentNamespace = newNamespace; } } this.namespaceCache.Add(@namespace, currentNamespace); return(currentNamespace); }