public static void DrawPackageDownUpButton(GitLinkOnDisk disk, bool affectPackage = true)
    {
        if (!disk.HasUrl())
        {
            return;
        }

        bool     isDirectoryCreated = Directory.Exists(disk.GetDirectoryPath());
        bool     isGitFolderPresent = disk.HasUrl();
        GUIStyle disableStyle       = GetDisableStyle();
        GUIStyle enableStyle        = GetEnableStyle();


        GUILayout.BeginHorizontal();
        bool downAllow = true;

        if (GUILayout.Button("Down", downAllow ? enableStyle : disableStyle))
        {
            UnityPackageUtility.Down(disk.GetDirectoryPath(), disk.GetUrl(), affectPackage);
        }
        bool upAllow = isDirectoryCreated && isGitFolderPresent;

        if (GUILayout.Button("Up", upAllow ? enableStyle : disableStyle))
        {
            if (upAllow)
            {
                UnityPackageUtility.Up(disk.GetDirectoryPath(), affectPackage);
            }
        }
        GUILayout.EndHorizontal();
    }
コード例 #2
0
    public static void DisplayGitLink(GitLinkOnDisk git)
    {
        GUIStyle button = new GUIStyle(GUI.skin.button);

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("> Git:", button, GUILayout.MaxWidth(50)))
        {
            Application.OpenURL(git.GetUrl());
        }
        EditorGUILayout.TextField(git.GetUrl());
        if (GUILayout.Button("> Path:", new GUIStyle(GUI.skin.button), GUILayout.MaxWidth(50)))
        {
            Application.OpenURL(git.GetDirectoryPath());
        }
        EditorGUILayout.TextField(git.GetDirectoryPath());
        GUILayout.EndHorizontal();
    }
コード例 #3
0
    public static string CreateBasicDefaultOnFrom(GitLinkOnDisk gitLink)
    {
        string text = "# Welcome to: " + gitLink.GetUrl() + "  \n";

        text += "Never used a package before ?  \n";
        text += "You don't understand how to use this git repository ?  \n";
        text += "May be you should stop now and learn the basic:  \n";
        text += "https://eloistree.page.link/hellopackage  \n";
        text += "  \n";
        text += "You know how the music work ?  \n";
        text += "Here is the copy past link of this package manager:  \n";
        text += "`" + gitLink.GetUrl() + "`  \n";
        text += "  \n";
        text += "In hope that this code help you.  \n";
        text += "Kind regards,  \n";
        text += Application.companyName;
        return(text);
    }
コード例 #4
0
    public static void DisplayGitCommands(GitLinkOnDisk gitDirectory)
    {
        bool hasUrl = gitDirectory.HasUrl();

        if (gitDirectory.Exist())
        {
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Add -a"))
            {
                QuickGit.Add(gitDirectory.GetDirectoryPath());
            }
            if (GUILayout.Button("Commit"))
            {
                QuickGit.Commit(gitDirectory.GetDirectoryPath());
            }
            if (hasUrl && GUILayout.Button("Pull"))
            {
                QuickGit.Pull(gitDirectory.GetDirectoryPath());
            }
            if (hasUrl && GUILayout.Button("Push"))
            {
                QuickGit.Push(gitDirectory.GetDirectoryPath());
            }

            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            if (hasUrl && GUILayout.Button("Add>Commit>Pull"))
            {
                QuickGit.AddCommitAndPush(gitDirectory.GetDirectoryPath());
            }
            if (hasUrl && GUILayout.Button("A>C>Pull + A>C>push"))
            {
                QuickGit.PullPushWithAddAndCommit(gitDirectory.GetDirectoryPath());
            }

            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Open explorer"))
            {
                Application.OpenURL(gitDirectory.GetDirectoryPath());
            }
            if (GUILayout.Button("See Status"))
            {
                QuickGit.OpenCmd(gitDirectory.GetDirectoryPath());
            }
            if (hasUrl && GUILayout.Button("Go to Server"))
            {
                Application.OpenURL(gitDirectory.GetUrl());
            }

            GUILayout.EndHorizontal();
        }
    }
    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);
    }