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 DrawEditorDefaultInterface(ReadMeFileStream readme, ref GitLinkOnDisk gitLink, ref string readMeText, ref bool hide) { hide = EditorGUILayout.Foldout(hide, hide ? "→ Read Me" : "↓ Read Me", EditorStyles.boldLabel); if (!hide) { GUILayout.Label("Read Me:", EditorStyles.boldLabel); GUILayout.Label("Linked git:" + (gitLink == null?"None":gitLink.GetName()), EditorStyles.boldLabel);; readMeText = EditorGUILayout.TextArea(readMeText, GUILayout.MinHeight(100)); GUILayout.BeginHorizontal(); if (GUILayout.Button("Create Default")) { if (gitLink != null) { readme.Create(ReadMeUtility.CreateBasicDefaultOnFrom(gitLink)); } else { readme.Create("# Read Me \n Hey buddy! \nWhat 's up ?"); } readMeText = readme.Get(); } if (GUILayout.Button("Load")) { readMeText = readme.Get(); } if (GUILayout.Button("Override")) { readme.Set(readMeText); } if (GUILayout.Button("Open")) { readme.Open(); } GUILayout.EndHorizontal(); } }