private static void BeginFindReference() { if (_target == null) { return; } switch (_mode) { case ShowMode.FolderMode: _referenceList = AssetDatabase.GetDependencies(AssetDatabase.GetAssetPath(_target), recursive); _refFolderItem = new RefFolderItem(); for (int i = 0; i < _referenceList.Length; i++) { _refFolderItem.AddRefItem(_referenceList[i]); } break; case ShowMode.ReferenceMode: _refItem = new RefItem(); _refItem.InitRef(_target); break; } }
public void AddRefItem(string path) { Regex reg = new Regex(@"(\S+?)/"); if (reg.IsMatch(path)) { string name = reg.Match(path).Groups[1].Value; if (string.IsNullOrEmpty(_name)) { _name = name; } string full = reg.Match(path).Value; string nextPath = path.Replace(full, ""); string nextName = reg.Match(nextPath).Groups[1].Value; RefFolderItem item = _next.Find((i) => i._name == nextName); if (item == null) { item = new RefFolderItem(); item._parent = this; _next.Add(item); } item.AddRefItem(nextPath); } else { _name = path; } }
private void ShowRefFolderItems(RefFolderItem items, int layer = 0) { EditorGUILayout.LabelField(new string('-', layer * 2) + items._name, textStyle); GUILayout.Space(5); if (items._next.Count < 1) { return; } for (int i = 0; i < items._next.Count; i++) { ShowRefFolderItems(items._next[i], layer + 1); } }