public static void Toggle(UnityPathSelectionInfo selector) { SampleDirectoryStream tmp = new SampleDirectoryStream(selector.GetAbsolutePath(true)); if (tmp.Exist()) { tmp.ToggleVisiblity(); } }
public static string[] GetRelativeFoldersIn(SampleDirectoryStream samplesDir) { if (!samplesDir.Exist()) { return(new string[0]); } string path = samplesDir.GetCurrentPath(); string [] folders = Directory.GetDirectories(path); for (int i = 0; i < folders.Length; i++) { folders[i] = (samplesDir.IsVisible() ? "Samples/" : "Samples~/") + UnityPaths.GetRelativePath(path, folders[i]); Debug.Log(">>" + folders[i]); } return(folders); }
private static void LoadSamplesFromDirectoryToPackage(UnityPathSelectionInfo selection, ref PackageBuildInformation package) { SampleDirectoryStream samplesDir = SampleUtility.GetSampleFolder(selection); string[] folders = SampleUtility.GetRelativeFoldersIn(samplesDir); for (int i = 0; i < folders.Length; i++) { string name = folders[i]; name = UnityPaths.GetLastPartOfPath(name); package.m_samples.m_samples.Add(new SampleInfo() { m_displayName = name, m_assetRelativePath = folders[i], m_description = "" }); } }
public static void DrawInfoAboutInterface(SampleDirectoryStream sample) { }
public static void Create(UnityPathSelectionInfo selector, bool asHidden) { SampleDirectoryStream tmp = new SampleDirectoryStream(selector.GetAbsolutePath(true)); tmp.Create(asHidden); }
public static void DrawPackageEditor(UnityPathSelectionInfo selection, PackageJsonFileStream packageTarget, PackageBuildInformation package) { string path = packageTarget.GetAbsolutePath(); GitLinkOnDisk gitLinked = packageTarget.GetLinkedGit(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Create package.json")) { LoadSamplesFromDirectoryToPackage(selection, ref package); string json = PackageBuilder.GetPackageAsJson(package); packageTarget.Set(json, true); AssetDatabase.Refresh(); } if (GUILayout.Button("Create Files & Folders")) { PackageBuilder.CreateUnityPackage(packageTarget.GetPackageProjectRoot(), package); AssetDatabase.Refresh(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (string.IsNullOrEmpty(package.m_projectName)) { package.m_projectName = UnityPaths.AlphaNumeric(Application.productName); } package.m_projectName = (GUILayout.TextField("" + package.m_projectName)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (string.IsNullOrEmpty(package.m_projectAlphNumId)) { // package.m_projectAlphNumId = UnityPaths.AlphaNumeric(Application.productName, true); package.m_projectAlphNumId = selection.GetSelectName(true); } if (string.IsNullOrEmpty(package.m_company)) { package.m_company = UnityPaths.AlphaNumeric(Application.companyName); } package.m_country = UnityPaths.AlphaNumeric(GUILayout.TextField("" + package.m_country)); GUILayout.Label(".", GUILayout.Width(5)); package.m_company = UnityPaths.AlphaNumeric(GUILayout.TextField("" + package.m_company)); GUILayout.Label(".", GUILayout.Width(5)); package.m_projectAlphNumId = UnityPaths.AlphaNumeric(GUILayout.TextField("" + package.m_projectAlphNumId)); GUILayout.EndHorizontal(); GUILayout.Label("Namespace ID: " + package.GetProjectNamespaceId()); GUILayout.Label("Description"); package.m_description = GUILayout.TextArea(package.m_description, GUILayout.MinHeight(100)); GUILayout.BeginHorizontal(); GUILayout.Label("Tags:", GUILayout.MaxWidth(60)); package.m_keywords = GUILayout.TextField(string.Join(",", package.m_keywords)).Split(','); GUILayout.EndHorizontal(); GUILayout.Label("Author"); GUILayout.BeginHorizontal(); GUILayout.Label("Name: ", GUILayout.MaxWidth(60)); package.m_author.m_name = GUILayout.TextField(package.m_author.m_name); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Mail: ", GUILayout.MaxWidth(60)); package.m_author.m_mail = GUILayout.TextField(package.m_author.m_mail); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Url: ", GUILayout.MaxWidth(60)); package.m_author.m_url = GUILayout.TextField(package.m_author.m_url); GUILayout.EndHorizontal(); GUILayout.Label("Repository Info"); GUILayout.BeginHorizontal(); GUILayout.Label("Git Url: ", GUILayout.MaxWidth(60)); package.m_repositoryLink.m_url = GUILayout.TextField(gitLinked.GetUrl()); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Revision: ", GUILayout.MaxWidth(60)); package.m_repositoryLink.m_revision = GUILayout.TextField(gitLinked.GetLastRevision()); GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.Label("Direct dependence"); DrawEditableDependency(ref package.m_otherPackageDependency); GUILayout.Space(10); GUILayout.Label("Relative dependence"); DrawEditableDependency(ref package.m_otherPackageRelation); SampleDirectoryStream sample = SampleUtility.GetSampleFolder(selection); SampleEditor.DrawInfoAboutInterface(sample); DocumentationDirectoryStream documentation = DocumentationUtility.GetDocumentFolder(selection); DocumentationEditor.DrawInfoAboutInterface(documentation); }