private void Reset() { if (string.IsNullOrEmpty(m_directory)) { m_directory = Application.dataPath + "/../"; } m_gitLinksPath = QuickGit.GetAllFolders(m_directory, true); QuickGit.GetGitsInDirectory(m_directory, out m_gitLinks); m_packageInfo = UnityPackageUtility.GetGitUnityPackageInDirectory(m_directory); }
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(); }