private void DrawParticleSystemProperties(string filter, ParticleSystemSetting setting, System.Action <string> addToPaths, System.Action <string> action) { if (GUILayout.Button("扫描", GUILayout.Width(50))) { _particleSystemSetting = setting; _particleSystemSettingPaths.Clear(); var guids = AssetDatabase.FindAssets(filter); var len = guids.Length; for (var i = 0; i < len; i++) { var path = AssetDatabase.GUIDToAssetPath(guids[i]); if (!InFilterList(path) && InContainList(path) && addToPaths != null) { addToPaths(path); } EditorUtility.DisplayProgressBar("处理中...", path, (float)(i + 1) / len); } EditorUtility.ClearProgressBar(); if (_particleSystemSettingPaths.Count < 1) { _window.ShowNotification(new GUIContent("无需处理")); } } if (_particleSystemSetting == setting && _particleSystemSettingPaths.Count > 0) { GUILayout.Label(_particleSystemSettingPaths.Count.ToString(), EditorStyles.textField, GUILayout.Width(50)); if (GUILayout.Button("全部处理", GUILayout.Width(80))) { var len = _particleSystemSettingPaths.Count; for (var i = 0; i < len; i++) { var path = _particleSystemSettingPaths[i]; if (action != null) { action(path); } EditorUtility.DisplayProgressBar("处理中...", path, (float)(i + 1) / len); } EditorUtility.ClearProgressBar(); _particleSystemSettingPaths.Clear(); } if (GUILayout.Button("X", GUILayout.Width(20))) { _particleSystemSettingPaths.Clear(); _particleSystemSetting = ParticleSystemSetting.None; } } }
private void DrawParticleSystemScrollList(ParticleSystemSetting setting, System.Action <string> act) { if (_particleSystemSetting == setting && _particleSystemSettingPaths.Count > 0) { _particleSystemSettingScrollPos = GUILayout.BeginScrollView(_particleSystemSettingScrollPos, EditorStyles.helpBox); for (var i = 0; i < _particleSystemSettingPaths.Count; i++) { var path = _particleSystemSettingPaths[i]; GUILayout.BeginHorizontal(EditorStyles.textField, GUILayout.MinHeight(20f)); if (GUILayout.Button(path, EditorStyles.label)) { EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath <Object>(path)); } if (GUILayout.Button("处理", GUILayout.Width(50))) { act?.Invoke(path); _particleSystemSettingPaths.RemoveAt(i); } if (GUILayout.Button("X", GUILayout.Width(20))) { _particleSystemSettingPaths.RemoveAt(i); if (_particleSystemSettingPaths.Count < 1) { _particleSystemSetting = ParticleSystemSetting.None; } } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); } }