UnityEditor.PreviewWindow.OnGUI C# (CSharp) Method

OnGUI() protected method

protected OnGUI ( ) : void
return void
        protected override void OnGUI()
        {
            if (this.m_ParentInspectorWindow == null)
            {
                base.Close();
                GUIUtility.ExitGUI();
            }
            Editor.m_AllowMultiObjectAccess = true;
            this.CreatePreviewables();
            base.AssignAssetEditor(base.tracker.activeEditors);
            IPreviewable[] editorsWithPreviews = base.GetEditorsWithPreviews(base.tracker.activeEditors);
            IPreviewable editorThatControlsPreview = base.GetEditorThatControlsPreview(editorsWithPreviews);
            bool flag = (editorThatControlsPreview != null) && editorThatControlsPreview.HasPreviewGUI();
            GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Height(17f) };
            Rect rect2 = EditorGUILayout.BeginHorizontal(GUIContent.none, InspectorWindow.styles.preToolbar, options);
            GUILayout.FlexibleSpace();
            Rect lastRect = GUILayoutUtility.GetLastRect();
            string text = string.Empty;
            if (editorThatControlsPreview != null)
            {
                text = editorThatControlsPreview.GetPreviewTitle().text;
            }
            GUI.Label(lastRect, text, InspectorWindow.styles.preToolbar2);
            if (flag)
            {
                editorThatControlsPreview.OnPreviewSettings();
            }
            EditorGUILayout.EndHorizontal();
            Event current = Event.current;
            if (((current.type == EventType.MouseUp) && (current.button == 1)) && rect2.Contains(current.mousePosition))
            {
                base.Close();
                current.Use();
            }
            else
            {
                Rect position = GUILayoutUtility.GetRect(0f, 10240f, (float) 64f, (float) 10240f);
                if (Event.current.type == EventType.Repaint)
                {
                    InspectorWindow.styles.preBackground.Draw(position, false, false, false, false);
                }
                if ((editorThatControlsPreview != null) && editorThatControlsPreview.HasPreviewGUI())
                {
                    editorThatControlsPreview.DrawPreview(position);
                }
            }
        }