private static bool EmbedPackageMenuValidation() { PackageManifest manifest = HalodiPackageCreatorController.GetPackageManifest(Selection.activeObject, false); if (manifest == null) { return(false); } // Do not allow embedding already embedded packages if (manifest.IsEmbedded) { return(false); } // Check if a VCS URL is set if (string.IsNullOrEmpty(manifest.repository.type) || string.IsNullOrEmpty(manifest.repository.url)) { return(false); } // Check if VSC URL is a git url if (manifest.repository.type != "git") { return(false); } return(true); }
private static void EmbedPackageMenu() { PackageManifest manifest = HalodiPackageCreatorController.GetPackageManifest(Selection.activeObject, false); if (manifest != null) { EmbedPackage(manifest); } }
private static void OpenPackage() { PackageManifest manifest = HalodiPackageCreatorController.GetPackageManifest(Selection.activeObject, false); if (manifest != null) { EditorUtility.RevealInFinder(Path.Combine(manifest.info.assetPath, Paths.PackageManifest)); } }
private static void PublishPackageMenu() { PackageManifest manifest = HalodiPackageCreatorController.GetPackageManifest(Selection.activeObject, true); if (manifest != null) { PublicationView.PublishPackages(manifest.info); } }
internal static void EmptySamplesDirectory(PackageManifest manifest) { DirectoryInfo SamplesDirectory = new DirectoryInfo(Path.Combine(HalodiPackageCreatorController.GetPackageDirectory(manifest), Paths.PackageSamplesFolder)); if (SamplesDirectory.Exists) { SamplesDirectory.Delete(true); } }
internal static void CopySamples(PackageManifest manifest) { string AssetSampleDirectory = HalodiPackageCreatorController.GetAssetsSampleDirectory(manifest); if (Directory.Exists(AssetSampleDirectory)) { EmptySamplesDirectory(manifest); string SamplesDirectory = Path.Combine(HalodiPackageCreatorController.GetPackageDirectory(manifest), Paths.PackageSamplesFolder); AssetDatabaseUtilities.CopyDirectory(HalodiPackageCreatorController.GetAssetsSampleDirectory(manifest), SamplesDirectory, true); } }
void OnClickCreate() { manifest.name_space = manifest.name_space.Trim(); manifest.package_name = manifest.package_name.Trim(); manifest.license = licenseList[licenseIndex]; if (!HalodiNewPackageController.ValidateName(manifest.package_name)) { EditorUtility.DisplayDialog("Invalid package name", "Please specify a valid name for the package. Valid names start with a letter, and only contains letters, numbers, underscores and hyphens.", "Close"); return; } else if (!HalodiNewPackageController.ValidateNameSpace(manifest.name_space)) { EditorUtility.DisplayDialog("Invalid namespace", "Please specify a valid namespace for the package. Valid namespaces start and end with a letter, and only contains letters, numbers, underscores, hyphens and dots as separation characters.", "Close"); return; } else if (!HalodiNewPackageController.ValidateVersion(manifest.version)) { EditorUtility.DisplayDialog("Invalid version", "Version needs to be in the format MAJOR.MINOR.PATCH, with only numeric values allowed.", "Close"); return; } else if (manifest.displayName.Trim().Length == 0) { EditorUtility.DisplayDialog("No display name set", "No display name for " + manifest.package_name + " set. Please provide a display name", "Close"); return; } else if (HalodiNewPackageController.PackageExists(manifest.package_name)) { EditorUtility.DisplayDialog("Package already exists", "A package named " + manifest.package_name + " already exists. Please choose another name.", "Close"); return; } else { EditorUtility.DisplayProgressBar("Creating package", "Creating new package " + manifest.displayName, 0.5f); try { HalodiNewPackageController.CreatePackage(manifest); } catch (System.Exception e) { Debug.LogError(e); } EditorUtility.ClearProgressBar(); UnityEngine.Object instance = HalodiPackageCreatorController.GetPackageManifestObject(manifest); Selection.activeObject = instance; Close(); GUIUtility.ExitGUI(); } }
private static bool PublishPackageMenuValidation() { PackageManifest manifest = HalodiPackageCreatorController.GetPackageManifest(Selection.activeObject, true); if (manifest != null) { return(manifest.info.source == UnityEditor.PackageManager.PackageSource.Embedded); } else { return(false); } }
void OnEnable() { packages = HalodiPackageCreatorController.LoadPackages(); minSize = new Vector2(640, 320); useGroupVersion = PackageGroupConfiguration.IsUseGroupVersion(); if (useGroupVersion) { groupVersion = PackageGroupConfiguration.GetGroupVersion(); } else { groupVersion = "0.0.0"; } }
void OnEnable() { HalodiPackageCreatorController.LoadPackages((p) => packages = p, UnityEditor.PackageManager.PackageSource.Embedded); minSize = new Vector2(640, 320); useGroupVersion = PackageGroupConfiguration.IsUseGroupVersion(); if (useGroupVersion) { groupVersion = PackageGroupConfiguration.GetGroupVersion(); } else { groupVersion = "0.0.0"; } }
internal void Store(PackageManifest manifest) { JObject manifestJSON = JObject.Parse(HalodiPackageCreatorController.GetPackageManifestObject(manifest).text); JObject author = new JObject( new JProperty("name", manifest.author.name), new JProperty("email", manifest.author.email), new JProperty("url", manifest.author.url)); manifestJSON["author"] = author; manifestJSON["license"] = manifest.license; JObject publicationConfig = new JObject( new JProperty("registry", manifest.publishConfig.registry) ); manifestJSON["publishConfig"] = publicationConfig; if (string.IsNullOrWhiteSpace(manifest.repository.url)) { manifest.repository.type = ""; } else { manifest.repository.type = "git"; } JObject repo = new JObject( new JProperty("type", manifest.repository.type), new JProperty("url", manifest.repository.url) ); manifestJSON["repository"] = repo; AssetDatabaseUtilities.CreateTextFile(manifestJSON.ToString(), HalodiPackageCreatorController.GetPackageDirectory(manifest), Paths.PackageManifest); AssetDatabaseUtilities.UpdateAssetDatabase(); }
void OnGUI() { if (manifest != null) { EditorGUILayout.LabelField("Display name: " + manifest.displayName); manifest.repository.url = EditorGUILayout.TextField("Git repository: ", manifest.repository.url); if (GUILayout.Button("Embed")) { HalodiPackageCreatorController.EmbedPackageFromGit(manifest); Exit(); } if (GUILayout.Button("Cancel")) { Exit(); } } }
private void OnClickCreate() { if (!HalodiNewPackageController.ValidateFolderName(sample.path)) { EditorUtility.DisplayDialog("Invalid sample path", "Please specify a valid sample paths. Valid sample paths start with a letter, and only contains letters, numbers, underscores and hyphens.", "Close"); return; } if (sample.displayName.Length == 0) { EditorUtility.DisplayDialog("Invalid display name", "Please specify a display name.", "Close"); return; } sample.path = Paths.PackageSamplesFolder + "/" + sample.path; // No paths.combine, written to file in specific format with slash HalodiPackageCreatorController.AddSample(manifest, sample); Close(); GUIUtility.ExitGUI(); }
void OnEnable() { HalodiPackageCreatorController.LoadPackages(SetPackages, UnityEditor.PackageManager.PackageSource.Embedded); }
private static bool EditPackageMenuValidation() { PackageManifest manifest = HalodiPackageCreatorController.GetPackageManifest(Selection.activeObject, true); return(manifest != null); }
private static bool OpenPackageValidation() { PackageManifest manifest = HalodiPackageCreatorController.GetPackageManifest(Selection.activeObject, false); return(manifest != null); }
private void SelectPackage(PackageManifest package) { UnityEngine.Object instance = HalodiPackageCreatorController.GetPackageManifestObject(package); Selection.activeObject = instance; CloseWindow(); }