예제 #1
0
    public static void Toggle(UnityPathSelectionInfo selector)
    {
        SampleDirectoryStream tmp = new SampleDirectoryStream(selector.GetAbsolutePath(true));

        if (tmp.Exist())
        {
            tmp.ToggleVisiblity();
        }
    }
예제 #2
0
    public static void Toggle(UnityPathSelectionInfo selector)
    {
        Debug.Log("Test>:" + selector.GetAbsolutePath(true));
        DocumentationDirectoryStream tmp = new DocumentationDirectoryStream(selector.GetAbsolutePath(true));

        if (tmp.Exist())
        {
            tmp.ToggleVisiblity();
        }
    }
    public static void GetAffectedGit(UnityPathSelectionInfo selector, out GitLinkOnDisk gitAffected)
    {
        string path = selector.GetAbsolutePath(true);

        if (QuickGit.IsPathHasGitRootFolder(path))
        {
            gitAffected = new  GitLinkOnDisk(path);
        }
        QuickGit.GetGitInParents(path, QuickGit.PathReadDirection.LeafToRoot, out gitAffected);
    }
    void OnGUI()
    {
        UnityPathSelectionInfo.Get(out m_pathFound, out m_selector);
        GUILayout.Label("Package.json: " + m_selector.GetRelativePath(false), EditorStyles.boldLabel);
        PackageJsonFileStream f = PackageJsonUtility.GetPackageFile(m_selector);

        QuickGit.GetGitInParents(m_selector.GetAbsolutePath(false), QuickGit.PathReadDirection.LeafToRoot,
                                 out m_gitLink);
        DrawEditorDefaultInterface(m_selector, f, ref m_builder, ref m_jsonProposition, ref m_raw, ref m_hide);
    }
    public static void Get(out bool found, out UnityPathSelectionInfo info)
    {
        var obj = Selection.activeObject;

        found = obj != null;
        info  = new UnityPathSelectionInfo();
        if (found)
        {
            info.Set(AssetDatabase.GetAssetPath(obj.GetInstanceID()));
        }
    }
예제 #6
0
    void OnGUI()
    {
        UnityPathSelectionInfo.Get(out m_pathFound, out m_selector);
        GUILayout.Label("Read Me: " + m_selector.GetRelativePath(false), EditorStyles.boldLabel);
        ReadMeFileStream f = ReadMeUtility.GetReadMeFile(m_selector);

        QuickGit.GetGitInParents(m_selector.GetAbsolutePath(false), QuickGit.PathReadDirection.LeafToRoot, out m_gitLink);

        //QuickGit.GetGitInDirectory(m_selector.GetAbsolutePath(false), out m_gitLink, true);
        DrawEditorDefaultInterface(f, ref m_gitLink, ref m_text, ref m_hide);
    }
    public static void ProposeCloneProject(UnityPathSelectionInfo selector, ref string cloneProposed)
    {
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Clone"))
        {
            QuickGit.Clone(cloneProposed, selector.GetAbsolutePath(true));
        }
        cloneProposed = GUILayout.TextField(
            cloneProposed);


        GUILayout.EndHorizontal();
    }
예제 #8
0
    void OnGUI()
    {
        if (GUILayout.Button("Lock Selection: " + m_lockState))
        {
            m_lockState = !m_lockState;
        }
        if (!Directory.Exists(m_selector.GetAbsolutePath(true)))
        {
            m_lockState = false;
        }

        if (!m_lockState)
        {
            UnityPathSelectionInfo.Get(out m_pathFound, out m_selector);
        }
        string previous = m_info.m_focusPath;

        m_info.m_focusPath = m_selector.GetAbsolutePath(true);
        if (previous != m_info.m_focusPath)
        {
            RefreshAccess();
        }


        EditorGUILayout.TextField(m_selector.GetRelativePath(true));
        EditorGUILayout.TextField(m_selector.GetAbsolutePath(true));

        m_info.m_scollrPackagePosition = GUILayout.BeginScrollView(m_info.m_scollrPackagePosition);
        GUILayout.Label("Welcome", EditorStyles.boldLabel);
        GUILayout.Label("This window allow you to read write config package.");
        GUILayout.Space(10);

        m_info.m_hideHiddenTool = EditorGUILayout.Foldout(m_info.m_hideHiddenTool, m_info.m_hideHiddenTool ? "→ Doc & Sample" : "↓ Doc & Sample", EditorStyles.boldLabel);
        if (!m_info.m_hideHiddenTool)
        {
            ToggleAndCreateHiddenFolder();
        }

        ReadMeEditor.DrawEditorDefaultInterface(m_info.m_readMe, ref m_info.m_gitLink, ref m_info.m_tmpReadMeText, ref m_info.m_tmpReadMeHide);

        ChangeLogEditor.DrawEditorDefaultInterface(m_info.m_changelog, ref m_info.m_tmpLogVersion, ref m_info.m_tmpLogTitle, ref m_info.m_tmpLogNew, ref m_info.m_tmpLogHide);

        LicenseEditor.DrawEditorDefaultInterface(m_info.m_license, ref m_info.m_tmpLicenseLink, ref m_info.m_tmpLicenseText, ref m_info.tmpLicenseHide);



        //CreatePackageDirectories();
        GUILayout.EndScrollView();
    }
    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 DrawEditorDefaultInterface(UnityPathSelectionInfo selection, PackageJsonFileStream package, ref PackageBuildInformation builder, ref string proposeJson, ref bool rawDisplay, ref bool hide)
    {
        hide = EditorGUILayout.Foldout(hide, hide ? "→ Package.json" : "↓ Package.json", EditorStyles.boldLabel);
        if (!hide)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("Json: " + package.Exist(), EditorStyles.boldLabel);
            GUILayout.Label("Found Git: " + package.GetLinkedGit().Exist(), EditorStyles.boldLabel);
            GUILayout.EndHorizontal();

            rawDisplay = GUILayout.Toggle(rawDisplay, rawDisplay ? "Use Editor" : "Use Raw");
            if (rawDisplay)
            {
                DrawPackageRawEditor(package, ref proposeJson);
            }
            else
            {
                DrawPackageEditor(selection, package, builder);
            }
        }
    }
    public static void ProposeToCreateFolder(UnityPathSelectionInfo selector, ref string folderName)
    {
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Create folder:", GUILayout.Width(120)))
        {
            if (!string.IsNullOrEmpty(folderName))
            {
                string full     = selector.GetAbsolutePath(true);
                string relative = selector.GetRelativePath(true);
                if (Directory.Exists(full))
                {
                    Directory.CreateDirectory(full + "/" + folderName);
                    RefreshDatabase();

                    Ping.PingFolder(relative + "/" + folderName, false);
                }
            }
        }
        folderName = GUILayout.TextField(folderName);
        GUILayout.EndHorizontal();
        DisplayMessageToHelp("Please select or create a empty folder");
    }
예제 #12
0
    void OnGUI()
    {
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Back-up:", EditorStyles.boldLabel);
        if (GUILayout.Button("Save"))
        {
            WindowPlayerPref.Save("PackageBasicBuilderBackup", JsonUtility.ToJson(m_info));
        }
        if (WindowPlayerPref.Has("PackageBasicBuilderBackup") && GUILayout.Button("Load"))
        {
            try
            {
                string json = WindowPlayerPref.Load("PackageBasicBuilderBackup");
                Info   i    = JsonUtility.FromJson <Info>(json);
                if (i != null)
                {
                    m_info = i;
                }
            }
            catch (Exception) { }
        }

        EditorGUILayout.EndHorizontal();

        m_info.m_selector    = null;
        m_info.m_targetedGit = null;
        UnityPathSelectionInfo.Get(out m_info.m_selectorpathFound, out m_info.m_selector);
        AccessGitWithPathSelector.GetAffectedGit(m_info.m_selector, out m_info.m_targetedGit);

        if (m_info.m_targetedGit != null)
        {
            string p = m_info.m_targetedGit.GetRelativeDirectoryPath();
            m_info.m_selector = new UnityPathSelectionInfo(p);
        }

        EditorGUILayout.HelpBox("Reminder: Git must be install and Git.exe must be add in System Variable Path.", MessageType.Warning, true);
        m_info.m_packageTargeted = PackageJsonUtility.GetPackageFile(m_info.m_selector);



        if (GUILayout.Button("Select: " + m_info.m_selector.GetSelectName(false)))
        {
            m_info.m_selector.Open();
        }
        if (m_info.m_targetedGit == null)
        {
            string path = m_info.m_selector.GetAbsolutePath(true);

            if (GUILayout.Button("Git Init. in " + m_info.m_selector.GetSelectName(true)))
            {
                QuickGit.CreateLocal(path);
            }
            GitForFacilitationEditor.ProposeCloneProject(m_info.m_selector, ref m_info.m_tmpCloneProposed);
            GitForFacilitationEditor.ProposeToCreateFolder(m_info.m_selector, ref m_info.m_tmpFolderToCreate);
        }
        else
        {
            if (!m_info.m_targetedGit.IsHosted())
            {
                GitForFacilitationEditor.PushLocalGitToOnlineAccount(m_info.m_targetedGit,
                                                                     ref m_info.m_userNameToCreateGit,
                                                                     ref m_info.m_projectNameToCreate,
                                                                     ref m_info.m_dropDownSelectionServer,
                                                                     ref m_info.m_hideGitUtilitary);
            }
            GUILayout.Space(20);
            if (GUILayout.Button("Git: " + m_info.m_selector.GetSelectName(true), EditorStyles.boldLabel))
            {
                Application.OpenURL(m_info.m_selector.GetAbsolutePath(false));
            }
            if (QuickGit.IsPathHasGitRootFolder(m_info.m_selector.GetAbsolutePath(true)))
            {
                GitEditorDrawer.DisplayGitCommands(m_info.m_targetedGit);
                UnityPackageEditorDrawer.DrawPackageDownUpButton(m_info.m_targetedGit, true);
            }
            PackageJsonEditor.DrawEditorDefaultInterface(m_info.m_selector, m_info.m_packageTargeted, ref m_info.m_packageBuilder, ref m_info.m_tmpPackageJsonProposition, ref m_info.m_tmp_rawDisplayJsonPackage, ref m_info.m_hidePackageBuilder);;
        }
    }
예제 #13
0
 public static PackageJsonFileStream GetPackageFile(UnityPathSelectionInfo selector)
 {
     return(new PackageJsonFileStream(selector.GetAbsolutePath(true)));
 }
예제 #14
0
    void OnGUI()
    {
        if (m_info == null)
        {
            m_info = new Info();
        }

        bool   foundPath    = false;
        string previousPath = m_info.m_directoryRelative;
        UnityPathSelectionInfo selected;

        UnityPathSelectionInfo.Get(out foundPath, out selected);
        m_info.m_directoryRelative = selected.GetRelativePath(true);
        m_info.m_directoryAbsolute = selected.GetAbsolutePath(true);
        bool changeFound = m_info.m_directoryRelative != previousPath;

        bool resquestRefresh = GUILayout.Button("Refresh");

        if (resquestRefresh || changeFound)
        {
            m_gitInProject.Refresh();
            m_info.m_gitLinksPath = QuickGit.GetAllFolders(m_info.m_directoryAbsolute, true);
            QuickGit.GetGitsInDirectory(m_info.m_directoryAbsolute, out m_info.m_gitLinks);
            m_info.m_projectGitInParent = "";
            GitLinkOnDisk gd;
            QuickGit.GetGitInParents(selected.GetAbsolutePath(true), QuickGit.PathReadDirection.LeafToRoot, out gd);
            if (gd != null)
            {
                m_info.m_projectGitInParent = gd.GetDirectoryPath();
            }
        }


        EditorGUILayout.TextField("Relative >", m_info.m_directoryRelative);
        EditorGUILayout.TextField("Abosluete > ", m_info.m_directoryAbsolute);

        // if (foundPath)
        {
            if (!string.IsNullOrEmpty(m_info.m_projectGitInParent))
            {
                EditorGUILayout.TextField("Parent Git", m_info.m_projectGitInParent.Length <= 0?"Project is not in a git.": m_info.m_projectGitInParent);
            }

            m_info.m_displayAllFolder = EditorGUILayout.Toggle("All Directory", m_info.m_displayAllFolder);
            if (m_info.m_displayAllFolder)
            {
                for (int i = 0; i < m_info.m_gitLinksPath.Length; i++)
                {
                    m_info.m_gitLinksPath[i] = EditorGUILayout.TextField("Directory", m_info.m_gitLinksPath[i]);
                }
            }

            m_info.m_displayAllGitInFolder = EditorGUILayout.Toggle("All Repository", m_info.m_displayAllGitInFolder);
            if (m_info.m_displayAllGitInFolder)
            {
                for (int i = 0; i < m_info.m_gitLinks.Count; i++)
                {
                    GitEditorDrawer.DisplayGitInfoWithCommand(m_info.m_gitLinks[i], ref m_info.m_displayprojectsInfo[i], ref m_info.m_displayInfoInGits[i]);
                    EditorGUILayout.Space();
                }
            }
        }

        GUILayout.BeginHorizontal();
        GitEditorDrawer.ButtonDeleteEmptyFiles(m_info.m_directoryAbsolute);
        GitEditorDrawer.ButtonRefreshGitKeeper(m_info.m_directoryAbsolute);
        GUILayout.EndHorizontal();
    }
 public static LicenseFileStream GetReadMeFile(UnityPathSelectionInfo m_selector)
 {
     return(new LicenseFileStream(m_selector.GetAbsolutePath(true), ".md"));
 }
 void OnGUI()
 {
     UnityPathSelectionInfo.Get(out m_pathFound, out m_selector);
     GUILayout.Label("Focus: " + m_selector.GetRelativePath(false), EditorStyles.boldLabel);
     DrawEditorDefaultInterface(new ChangeLogFileStream(m_selector.GetAbsolutePath(false)), ref m_version, ref m_title, ref m_logs, ref m_hide);
 }
예제 #17
0
    public static void Create(UnityPathSelectionInfo selector, bool asHidden)
    {
        SampleDirectoryStream tmp = new SampleDirectoryStream(selector.GetAbsolutePath(true));

        tmp.Create(asHidden);
    }
예제 #18
0
 void OnGUI()
 {
     UnityPathSelectionInfo.Get(out m_pathFound, out m_selector);
     DrawEditorDefaultInterface(new LicenseFileStream(m_selector.GetAbsolutePath(false)), ref m_licenseLink, ref m_licenseText, ref m_hide);
 }
예제 #19
0
 public static DocumentationDirectoryStream GetDocumentFolder(UnityPathSelectionInfo selector)
 {
     return(new DocumentationDirectoryStream(selector.GetAbsolutePath(true)));
 }
예제 #20
0
 public static void GetSelectedPathInUnity(out bool found, out UnityPathSelectionInfo info)
 {
     UnityPathSelectionInfo.Get(out found, out info);
 }
예제 #21
0
 public static SampleDirectoryStream GetSampleFolder(UnityPathSelectionInfo selector)
 {
     return(new SampleDirectoryStream(selector.GetAbsolutePath(true)));
 }
    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);
    }