using UnityEditor; using UnityEngine; using System.IO; using System.Collections.Generic; using ParticlePlayground; using ParticlePlaygroundLanguage; class PlaygroundCreatePresetWindowC : EditorWindow { public static GameObject particleSystemObject; public static Texture2D particleSystemIcon; public static string particleSystemName; public static bool childConnected = false; public static EditorWindow window; public static Vector2 scrollPosition; public int presetOrPublish = 0; public int selectedPreset = 0; public int selectedPresets = 0; public int selectedCategory = 0; public string[] categories; public int[] categoryValues; public bool showError1 = false; public static PlaygroundSettingsC playgroundSettings; public static PlaygroundLanguageC playgroundLanguage; public static void ShowWindow () { playgroundSettings = PlaygroundSettingsC.GetReference(); playgroundLanguage = PlaygroundSettingsC.GetLanguage(); window = EditorWindow.GetWindow(true, playgroundLanguage.presetWizard); window.Show(); } void OnEnable () { Initialize(); } public void Initialize () { if (Selection.activeGameObject!=null) { particleSystemObject = Selection.activeGameObject; particleSystemName = Selection.activeGameObject.name; } List tmpCategories = new List(); List tmpCategoryValues = new List(); bool containsResources = false; bool containsUncategorized = false; for (int i = 0; i(); int i=0; for (int x = 0; x presets = new List(); List presetIcons = new List(); List presetDependencies = new List(); for (int i = 0; i1?"Playground Preset Bundle ("+presets.Count+" presets).unitypackage":"Playground Preset - "+PlaygroundParticleWindowC.presetObjects[matched].presetObject.name+".unitypackage", "unitypackage"); if (assetPackagePath.Length!=0) AssetDatabase.ExportPackage(presetDependencies.ToArray(), assetPackagePath, ExportPackageOptions.Interactive); // Refresh the project AssetDatabase.Refresh(); // Close window if (assetPackagePath.Length!=0) window.Close(); } public bool ContainsDisallowedAsset (string asset) { return asset.Contains("PlaygroundBrushPresetInspectorC.cs") || asset.Contains("PlaygroundCreateBrushWindowC.cs") || asset.Contains("PlaygroundCreatePresetWindowC.cs") || asset.Contains("PlaygroundInspectorC.cs") || asset.Contains("PlaygroundParticleSystemInspectorC.cs") || asset.Contains("PlaygroundParticleWindowC.cs") || asset.Contains("PlaygroundBrushPresetC.cs") || asset.Contains("PlaygroundSplineInspector.cs") || asset.Contains("PlaygroundRecorderInspector.cs") || asset.Contains("PlaygroundTrailInspector.cs"); } public void RefreshFromPresetList () { if (PlaygroundParticleWindowC.presetNames.Count==0) return; particleSystemIcon = AssetDatabase.LoadAssetAtPath(playgroundSettings.playgroundPath+playgroundSettings.iconPath+PlaygroundParticleWindowC.presetNames[selectedPreset]+".png", typeof(Texture2D)) as Texture2D; particleSystemName = PlaygroundParticleWindowC.presetNames[selectedPreset]; } }