private void Awake() { m_DevLogEntries = AssetDatabase.LoadAssetAtPath(Settings.DevLogScriptableObjectPath, typeof(DevLogEntries)) as DevLogEntries; m_DevLogPanel = new DevLogPanel(m_DevLogEntries); //TODO this needs to be done in OnEnable to avoid edge case bugs on an upgrade m_ScreenCaptures = AssetDatabase.LoadAssetAtPath(Settings.ScreenCaptureScriptableObjectPath, typeof(DevLogScreenCaptureCollection)) as DevLogScreenCaptureCollection; mediaPanel = new MediaPanel(m_ScreenCaptures); m_EntryPanel = new EntryPanel(m_DevLogEntries); m_TwitterPanel = new TwitterPanel(); m_DiscordPanel = new DiscordPanel(); m_SchedulingPanel = new SchedulingPanel(m_DevLogEntries); m_GitPanel = new GitPanel(m_EntryPanel); }
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(); } }