private static void DrawPackageRawEditor(PackageJsonFileStream package, ref string rawProposition) { GUILayout.BeginHorizontal(); if (GUILayout.Button("Empty Shell")) { TextAsset t = Resources.Load <TextAsset>("PackageJson/EmptyShell"); if (t != null) { rawProposition = t.text; } } if (GUILayout.Button("Default")) { TextAsset t = Resources.Load <TextAsset>("PackageJson/Default"); if (t != null) { rawProposition = t.text; } } if (GUILayout.Button("Full")) { TextAsset t = Resources.Load <TextAsset>("PackageJson/Full"); if (t != null) { rawProposition = t.text; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Load")) { if (package.Exist()) { rawProposition = package.Get(); } } if (GUILayout.Button("Push")) { if (package.Exist()) { package.Set(rawProposition, true); } } GUILayout.EndHorizontal(); rawProposition = GUILayout.TextArea(rawProposition, GUILayout.MinHeight(500)); }
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); }