private void Calculate() { if (string.IsNullOrEmpty(_searchType)) { return; } var dll = Assembly.LoadFile(EditorAssetHelper.GetLibraryDll(AssetHelper.AssemblyCSharp)); var type = dll.GetType(_searchType); if (type == null) { return; } var baseType = type; var types = dll.GetTypes(); var subTypes = new HashSet <Type>(); foreach (var t in types) { // 其实这里把自己也算进去了 if (baseType.IsAssignableFrom(t)) { subTypes.Add(t); } } CaulateTypes(subTypes, dll); }
private void ShowBuiltinDependences() { var dependences = EditorUtility.CollectDependencies(GetSelections()); var builtin = dependences.Where(o => EditorAssetHelper.IsBuiltinAsset(o)).ToList(); SelectingEditorWindow.Show(builtin, "引用的内置资源"); }
private void CaulateAll() { var dll = Assembly.LoadFile(EditorAssetHelper.GetLibraryDll(AssetHelper.AssemblyCSharp)); var types = new HashSet <Type>(); foreach (var type in dll.GetTypes()) { if (type.IsEnum) { continue; } types.Add(type); } CaulateTypes(types, dll); }
protected override void CustomOnGUI() { if (_msg != null) { EditorUIHelper.TitleField(_msg); EditorUIHelper.Space(); } _search = EditorUIHelper.SearchCancelTextField(_search); _searchFilter = EditorUIHelper.EnumPopup <EditorAssetHelper.SearchFilter>(_searchFilter, "SearchFilter"); EditorUIHelper.TitleField("数量:", (_goList != null ? _goList.Count : 0).ToString()); EditorUIHelper.Space(); _ListScroll = EditorUIHelper.BeginScrollView(_ListScroll); { var count = _goList != null ? _goList.Count : 0; var needSearch = !string.IsNullOrEmpty(_search); for (int i = 0; i < count; i++) { var go = _goList[i]; if (needSearch && !go.name.Contains(_search)) { continue; } if (!EditorAssetHelper.IsMatch(go, _searchFilter)) { continue; } EditorUIHelper.DrawLine(); EditorUIHelper.BeginHorizontal(); { EditorUIHelper.ObjectField(go, null, string.Empty, true); EditorUIHelper.Button("选中", () => EditorAssetHelper.SelectObject(go)); var index = i; EditorUIHelper.Button("移除", () => RemoveGo(index)); } EditorUIHelper.EndHorizontal(); } } EditorUIHelper.EndScrollView(); }
protected override void CustomOnGUI() { _searchText = EditorUIHelper.SearchCancelTextField(_searchText); EditorUIHelper.Space(); EditorUIHelper.Button("InstanceID", () => { int id; if (int.TryParse(_searchText, out id)) { EditorAssetHelper.SelectObject(EditorUtility.InstanceIDToObject(id)); } }); EditorUIHelper.Space(); EditorUIHelper.Button("GUID", () => { EditorAssetHelper.SelectObject(EditorAssetHelper.GUIDToObject(_searchText)); }); }
private void ShowAssets() { if (_assetPaths == null) { _assetPaths = Operator.GetAssetPaths(); if (!string.IsNullOrEmpty(_searchText)) { _assetPaths = _assetPaths.Where(s => s.Contains(_searchText)).ToList(); } } var count = _assetPaths.Count; for (int i = 0; i < count; i++) { EditorUIHelper.Space(0.1f); EditorUIHelper.BeginSelectdColor(_selectedObjIndex == i); { EditorUIHelper.BeginHorizontal(EditorUIHelper.TextAreaStyle); { var path = _assetPaths[i]; var i1 = i; EditorUIHelper.Button(path, () => { EditorAssetHelper.SelectObject(AssetDatabase.LoadMainAssetAtPath(path)); _selectedObjIndex = i1; }, EditorUIHelper.TextFieldStyle); } EditorUIHelper.EndHorizontal(); } EditorUIHelper.EndSelectedColor(); } if (_selectedObjIndex >= 0) { ShowSettingPanel(Operator.GetImporterSetting(_assetPaths[_selectedObjIndex])); } }
protected override List <Material> GetProjectObjects() { return(EditorAssetHelper.FindAssetsPaths(EditorAssetHelper.SearchFilter.Material) .ConvertAll(input => AssetDatabase.LoadAssetAtPath <Material>(input))); }
protected override List <GameObject> GetProjectObjects() { return(EditorAssetHelper.FindAssetsPaths(EditorAssetHelper.SearchFilter.Prefab) .ConvertAll(input => AssetDatabase.LoadAssetAtPath <GameObject>(input))); }