void OnGUI() { try { selectedTab = GUILayout.Toolbar(selectedTab, toolbarLabels); switch (selectedTab) { case 0: if (m_DevLogEntries != null && m_ScreenCaptures != null) // Check we are correctly configured { Skin.StartSection("Posting", false); GUILayout.BeginHorizontal(); m_EntryPanel.DevLogPostingGUI(); bool canPostToAll; canPostToAll = DiscordPostingGUI(); canPostToAll &= TwitterPostingGUI(); GUI.enabled = canPostToAll; if (GUILayout.Button("Post to All")) { DevLogEntry entry = PostToDevLogAndTwitter(); Discord.PostEntry(entry); } GUI.enabled = true; GUILayout.EndHorizontal(); Skin.EndSection(); entryScrollPosition = EditorGUILayout.BeginScrollView(entryScrollPosition); mediaPanel.ScreenCaptures = m_ScreenCaptures; m_EntryPanel.entries = m_DevLogEntries; m_EntryPanel.OnGUI(); EditorGUILayout.Space(); mediaPanel.ScreenCaptures = m_ScreenCaptures; mediaPanel.OnGUI(); EditorGUILayout.EndScrollView(); } else { SettingsTabUI(); } break; case 1: if (m_DevLogPanel == null) { m_DevLogPanel = new DevLogPanel(m_DevLogEntries); } DevLogList.isDirty = true; m_DevLogPanel.ScreenCaptures = m_ScreenCaptures; m_DevLogPanel.entries = m_DevLogEntries; m_DevLogPanel.OnGUI(); break; case 2: m_SchedulingPanel.OnGUI(); break; case 3: m_GitPanel.OnGUI(); break; case 4: SettingsTabUI(); break; } } catch (InvalidCastException e) { //TODO Don't silently catch errors // this is a workaround. An exception is thrown when a new scene is loaded. Repaint(); } }
public void OnGUI() { GitPanel panel = panels[panelIndex]; EditorGUILayoutToolbar.Begin(); if (GUILayout.Button(refreshButton, EditorStyles.toolbarButton, GUIHelper.NoExpandWidth)) { forceRefresh = true; } if (forceRefresh && panel != null) { forceRefresh = false; panel.OnRefresh(); } EditorGUILayoutToolbar.Space(); bool hasShownToolbar = false; for (int i = 0; i < panelLabels.Length; i++) { if (panelLabels[i] == null) { if (!hasShownToolbar) { hasShownToolbar = true; EditorGUILayoutToolbar.Space(); if (panel != null && !panel.IsDisabledForError) { panel.OnToolbarGUI(); } EditorGUILayoutToolbar.FlexibleSpace(); } } else { if (GUILayout.Toggle((panelIndex == i), panelLabels[i], EditorStyles.toolbarButton, GUIHelper.NoExpandWidth)) { panelIndex = i; } } } EditorGUILayoutToolbar.End(); GUILayout.BeginVertical(GitStyles.Indented); panel = panels[panelIndex]; if (panel != null) { if (!panel.IsDisabledForError) { panel.OnGUI(); } else { Color c = GUI.color; GUI.color = GitStyles.ErrorColor; GUILayout.Label("Whoops! Encountered an error in git. Please see the About tab to ensure git is set up properly!", GitStyles.WhiteBoldLabel); GUI.color = c; } } else { GUILayout.Label("Not implemented yet."); } GUILayout.EndVertical(); }