public override void OnGUI(Rect rect)
 {
     if (!(this.m_LookDevView == null))
     {
         GUILayout.BeginVertical(new GUILayoutOption[0]);
         EditorGUIUtility.labelWidth = 130f;
         EditorGUIUtility.fieldWidth = 35f;
         this.DrawHeader(LookDevSettingsWindow.styles.sMultiView);
         for (int i = 0; i < 5; i++)
         {
             EditorGUI.BeginChangeCheck();
             bool value = GUILayout.Toggle(this.m_LookDevView.config.lookDevMode == (LookDevMode)i, LookDevSettingsWindow.styles.sMultiViewMode[i], LookDevSettingsWindow.styles.sMenuItem, new GUILayoutOption[0]);
             if (EditorGUI.EndChangeCheck())
             {
                 this.m_LookDevView.UpdateLookDevModeToggle((LookDevMode)i, value);
                 this.m_LookDevView.Repaint();
                 GUIUtility.ExitGUI();
             }
         }
         this.DrawSeparator();
         this.DrawHeader(LookDevSettingsWindow.styles.sCamera);
         if (GUILayout.Button(LookDevSettingsWindow.styles.sResetCamera, LookDevSettingsWindow.styles.sMenuItem, new GUILayoutOption[0]))
         {
             this.m_LookDevView.Frame();
         }
         this.m_LookDevView.config.enableToneMap = GUILayout.Toggle(this.m_LookDevView.config.enableToneMap, LookDevSettingsWindow.styles.sEnableToneMap, LookDevSettingsWindow.styles.sMenuItem, new GUILayoutOption[0]);
         EditorGUI.BeginChangeCheck();
         float exposureRange = (float)EditorGUILayout.IntSlider(LookDevSettingsWindow.styles.sExposureRange, (int)this.m_LookDevView.config.exposureRange, 1, 32, new GUILayoutOption[0]);
         if (EditorGUI.EndChangeCheck())
         {
             Undo.RecordObject(this.m_LookDevView.config, "Change exposure range");
             this.m_LookDevView.config.exposureRange = exposureRange;
         }
         this.DrawSeparator();
         this.DrawHeader(LookDevSettingsWindow.styles.sLighting);
         EditorGUI.BeginChangeCheck();
         GUILayout.BeginHorizontal(new GUILayoutOption[0]);
         this.m_LookDevView.config.enableShadowCubemap = GUILayout.Toggle(this.m_LookDevView.config.enableShadowCubemap, LookDevSettingsWindow.styles.sEnableShadows, LookDevSettingsWindow.styles.sMenuItem, new GUILayoutOption[0]);
         GUILayout.EndHorizontal();
         if (EditorGUI.EndChangeCheck())
         {
             this.m_LookDevView.Repaint();
         }
         EditorGUI.BeginChangeCheck();
         float shadowDistance = EditorGUILayout.Slider(LookDevSettingsWindow.styles.sShadowDistance, this.m_LookDevView.config.shadowDistance, 0f, 1000f, new GUILayoutOption[0]);
         if (EditorGUI.EndChangeCheck())
         {
             Undo.RecordObject(this.m_LookDevView.config, "Change shadow distance");
             this.m_LookDevView.config.shadowDistance = shadowDistance;
         }
         this.DrawSeparator();
         this.DrawHeader(LookDevSettingsWindow.styles.sAnimation);
         GUILayout.BeginHorizontal(new GUILayoutOption[0]);
         this.m_LookDevView.config.rotateObjectMode = GUILayout.Toggle(this.m_LookDevView.config.rotateObjectMode, LookDevSettingsWindow.styles.sRotateObjectMode, LookDevSettingsWindow.styles.sMenuItem, new GUILayoutOption[0]);
         GUILayout.EndHorizontal();
         GUILayout.BeginHorizontal(new GUILayoutOption[0]);
         this.m_LookDevView.config.rotateEnvMode = GUILayout.Toggle(this.m_LookDevView.config.rotateEnvMode, LookDevSettingsWindow.styles.sRotateEnvMode, LookDevSettingsWindow.styles.sMenuItem, new GUILayoutOption[0]);
         GUILayout.EndHorizontal();
         EditorGUI.BeginChangeCheck();
         float objRotationSpeed = EditorGUILayout.Slider(LookDevSettingsWindow.styles.sObjRotationSpeed, this.m_LookDevView.config.objRotationSpeed, -5f, 5f, new GUILayoutOption[0]);
         if (EditorGUI.EndChangeCheck())
         {
             Undo.RecordObject(this.m_LookDevView.config, "Change rotation speed");
             this.m_LookDevView.config.objRotationSpeed = objRotationSpeed;
         }
         EditorGUI.BeginChangeCheck();
         float envRotationSpeed = EditorGUILayout.Slider(LookDevSettingsWindow.styles.sEnvRotationSpeed, this.m_LookDevView.config.envRotationSpeed, -5f, 5f, new GUILayoutOption[0]);
         if (EditorGUI.EndChangeCheck())
         {
             Undo.RecordObject(this.m_LookDevView.config, "Change env speed");
             this.m_LookDevView.config.envRotationSpeed = envRotationSpeed;
         }
         this.DrawSeparator();
         this.DrawHeader(LookDevSettingsWindow.styles.sViewport);
         if (GUILayout.Button(LookDevSettingsWindow.styles.sResetView, LookDevSettingsWindow.styles.sMenuItem, new GUILayoutOption[0]))
         {
             this.m_LookDevView.ResetView();
         }
         this.DrawSeparator();
         this.DrawHeader(LookDevSettingsWindow.styles.sEnvLibrary);
         using (new EditorGUI.DisabledScope(!this.m_LookDevView.envLibrary.dirty))
         {
             if (GUILayout.Button(LookDevSettingsWindow.styles.sSaveCurrentLibrary, LookDevSettingsWindow.styles.sMenuItem, new GUILayoutOption[0]))
             {
                 base.editorWindow.Close();
                 if (this.m_LookDevView.SaveLookDevLibrary())
                 {
                     this.m_LookDevView.envLibrary.dirty = false;
                 }
                 GUIUtility.ExitGUI();
             }
         }
         if (GUILayout.Button(LookDevSettingsWindow.styles.sCreateNewLibrary, LookDevSettingsWindow.styles.sMenuItem, new GUILayoutOption[0]))
         {
             base.editorWindow.Close();
             string text = EditorUtility.SaveFilePanelInProject("Save New Environment Library", "New Env Library", "asset", "");
             if (!string.IsNullOrEmpty(text))
             {
                 this.m_LookDevView.CreateNewLibrary(text);
             }
             GUIUtility.ExitGUI();
         }
         EditorGUI.BeginChangeCheck();
         LookDevEnvironmentLibrary envLibrary = EditorGUILayout.ObjectField(this.m_LookDevView.userEnvLibrary, typeof(LookDevEnvironmentLibrary), false, new GUILayoutOption[0]) as LookDevEnvironmentLibrary;
         if (EditorGUI.EndChangeCheck())
         {
             this.m_LookDevView.envLibrary = envLibrary;
         }
         this.DrawSeparator();
         this.DrawHeader(LookDevSettingsWindow.styles.sMisc);
         this.m_LookDevView.config.showBalls          = GUILayout.Toggle(this.m_LookDevView.config.showBalls, LookDevSettingsWindow.styles.sShowBalls, LookDevSettingsWindow.styles.sMenuItem, new GUILayoutOption[0]);
         this.m_LookDevView.config.showControlWindows = GUILayout.Toggle(this.m_LookDevView.config.showControlWindows, LookDevSettingsWindow.styles.sShowControlWindows, LookDevSettingsWindow.styles.sMenuItem, new GUILayoutOption[0]);
         EditorGUI.BeginChangeCheck();
         bool allowDifferentObjects = GUILayout.Toggle(this.m_LookDevView.config.allowDifferentObjects, LookDevSettingsWindow.styles.sAllowDifferentObjects, LookDevSettingsWindow.styles.sMenuItem, new GUILayoutOption[0]);
         if (EditorGUI.EndChangeCheck())
         {
             this.m_LookDevView.config.allowDifferentObjects = allowDifferentObjects;
         }
         if (GUILayout.Button(LookDevSettingsWindow.styles.sResyncObjects, LookDevSettingsWindow.styles.sMenuItem, new GUILayoutOption[0]))
         {
             this.m_LookDevView.config.ResynchronizeObjects();
         }
         GUILayout.EndVertical();
         if (Event.current.type == EventType.MouseMove)
         {
             Event.current.Use();
         }
         if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Escape)
         {
             base.editorWindow.Close();
             GUIUtility.ExitGUI();
         }
     }
 }
        public override void OnGUI(Rect rect)
        {
            if (m_LookDevView == null)
            {
                return;
            }

            GUILayout.BeginVertical();
            {
                // We need to have a sufficient size to display negative float number
                EditorGUIUtility.labelWidth = 130;
                EditorGUIUtility.fieldWidth = 35;

                // Look Dev view mode
                DrawHeader(styles.sMultiView);

                for (int i = 0; i < (int)LookDevMode.Count; ++i)
                {
                    EditorGUI.BeginChangeCheck();
                    bool value = GUILayout.Toggle(m_LookDevView.config.lookDevMode == (LookDevMode)i, styles.sMultiViewMode[i], styles.sMenuItem);
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_LookDevView.UpdateLookDevModeToggle((LookDevMode)i, value);
                        m_LookDevView.Repaint();
                        GUIUtility.ExitGUI();
                    }
                }

                // Camera settings
                DrawSeparator();
                DrawHeader(styles.sCamera);

                if (GUILayout.Button(styles.sResetCamera, styles.sMenuItem))
                {
                    m_LookDevView.Frame();
                }

                m_LookDevView.config.enableToneMap = GUILayout.Toggle(m_LookDevView.config.enableToneMap, styles.sEnableToneMap, styles.sMenuItem);
                EditorGUI.BeginChangeCheck();
                // Cast to int to have integer step
                float newExposureRange = (float)EditorGUILayout.IntSlider(styles.sExposureRange, (int)m_LookDevView.config.exposureRange, 1, 32);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(m_LookDevView.config, "Change exposure range");
                    m_LookDevView.config.exposureRange = newExposureRange;
                }

                DrawSeparator();
                DrawHeader(styles.sLighting);

                EditorGUI.BeginChangeCheck();

                GUILayout.BeginHorizontal();
                m_LookDevView.config.enableShadowCubemap = GUILayout.Toggle(m_LookDevView.config.enableShadowCubemap, styles.sEnableShadows, styles.sMenuItem);
                GUILayout.EndHorizontal();
                if (EditorGUI.EndChangeCheck())
                {
                    m_LookDevView.Repaint();
                }

                EditorGUI.BeginChangeCheck();
                float newShadowDistance = EditorGUILayout.Slider(styles.sShadowDistance, m_LookDevView.config.shadowDistance, 0.0f, 1000.0f);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(m_LookDevView.config, "Change shadow distance");
                    m_LookDevView.config.shadowDistance = newShadowDistance;
                }

                DrawSeparator();
                DrawHeader(styles.sAnimation);

                GUILayout.BeginHorizontal();
                m_LookDevView.config.rotateObjectMode = GUILayout.Toggle(m_LookDevView.config.rotateObjectMode, styles.sRotateObjectMode, styles.sMenuItem);
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                m_LookDevView.config.rotateEnvMode = GUILayout.Toggle(m_LookDevView.config.rotateEnvMode, styles.sRotateEnvMode, styles.sMenuItem);
                GUILayout.EndHorizontal();

                EditorGUI.BeginChangeCheck();
                float newObjRotationSpeed = EditorGUILayout.Slider(styles.sObjRotationSpeed, m_LookDevView.config.objRotationSpeed, -5.0f, 5.0f);

                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(m_LookDevView.config, "Change rotation speed");
                    m_LookDevView.config.objRotationSpeed = newObjRotationSpeed;
                }

                EditorGUI.BeginChangeCheck();
                float newEnvRotationSpeed = EditorGUILayout.Slider(styles.sEnvRotationSpeed, m_LookDevView.config.envRotationSpeed, -5.0f, 5.0f);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(m_LookDevView.config, "Change env speed");
                    m_LookDevView.config.envRotationSpeed = newEnvRotationSpeed;
                }

                DrawSeparator();
                DrawHeader(styles.sViewport);
                if (GUILayout.Button(styles.sResetView, styles.sMenuItem))
                {
                    m_LookDevView.ResetView();
                }

                DrawSeparator();
                DrawHeader(styles.sEnvLibrary);
                using (new EditorGUI.DisabledScope(!m_LookDevView.envLibrary.dirty))
                {
                    if (GUILayout.Button(styles.sSaveCurrentLibrary, styles.sMenuItem))
                    {
                        editorWindow.Close();
                        if (m_LookDevView.SaveLookDevLibrary())
                        {
                            m_LookDevView.envLibrary.dirty = false;
                        }
                        GUIUtility.ExitGUI();
                    }
                }
                if (GUILayout.Button(styles.sCreateNewLibrary, styles.sMenuItem))
                {
                    editorWindow.Close();
                    string assetPath = EditorUtility.SaveFilePanelInProject("Save New Environment Library", "New Env Library", "asset", "");
                    if (!string.IsNullOrEmpty(assetPath))
                    {
                        m_LookDevView.CreateNewLibrary(assetPath);
                    }

                    GUIUtility.ExitGUI();
                }
                EditorGUI.BeginChangeCheck();
                LookDevEnvironmentLibrary library = EditorGUILayout.ObjectField(m_LookDevView.userEnvLibrary, typeof(LookDevEnvironmentLibrary), false) as LookDevEnvironmentLibrary;
                if (EditorGUI.EndChangeCheck())
                {
                    m_LookDevView.envLibrary = library;
                }

                DrawSeparator();
                DrawHeader(styles.sMisc);
                m_LookDevView.config.showBalls          = GUILayout.Toggle(m_LookDevView.config.showBalls, styles.sShowBalls, styles.sMenuItem);
                m_LookDevView.config.showControlWindows = GUILayout.Toggle(m_LookDevView.config.showControlWindows, styles.sShowControlWindows, styles.sMenuItem);
                EditorGUI.BeginChangeCheck();
                bool allowDifferentObjects = GUILayout.Toggle(m_LookDevView.config.allowDifferentObjects, styles.sAllowDifferentObjects, styles.sMenuItem);
                if (EditorGUI.EndChangeCheck())
                {
                    m_LookDevView.config.allowDifferentObjects = allowDifferentObjects;
                }
                if (GUILayout.Button(styles.sResyncObjects, styles.sMenuItem))
                {
                    m_LookDevView.config.ResynchronizeObjects();
                }
            }
            GUILayout.EndVertical();

            // Use mouse move so we get hover state correctly in the menu item rows
            if (Event.current.type == EventType.MouseMove)
            {
                Event.current.Use();
            }

            // Escape closes the window
            if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Escape)
            {
                editorWindow.Close();
                GUIUtility.ExitGUI();
            }
        }