Exemplo n.º 1
0
        private int DoQualityLevelSelection(int currentQualitylevel, IList <QualitySettingsEditor.QualitySetting> qualitySettings, Dictionary <string, int> platformDefaultQualitySettings)
        {
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            int num = currentQualitylevel;

            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            Rect rect = GUILayoutUtility.GetRect(GUIContent.none, QualitySettingsEditor.Styles.kToggle, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(false),
                GUILayout.Width(80f),
                GUILayout.Height(20f)
            });

            rect.x     += EditorGUI.indent;
            rect.width -= EditorGUI.indent;
            GUI.Label(rect, "Levels", EditorStyles.boldLabel);
            foreach (BuildPlatform current in this.m_ValidPlatforms)
            {
                Rect rect2 = GUILayoutUtility.GetRect(GUIContent.none, QualitySettingsEditor.Styles.kToggle, new GUILayoutOption[]
                {
                    GUILayout.MinWidth(15f),
                    GUILayout.MaxWidth(20f),
                    GUILayout.Height(20f)
                });
                GUIContent gUIContent = EditorGUIUtility.TempContent(current.smallIcon);
                gUIContent.tooltip = current.title.text;
                GUI.Label(rect2, gUIContent);
                gUIContent.tooltip = "";
            }
            GUILayoutUtility.GetRect(GUIContent.none, QualitySettingsEditor.Styles.kToggle, new GUILayoutOption[]
            {
                GUILayout.MinWidth(15f),
                GUILayout.MaxWidth(20f),
                GUILayout.Height(20f)
            });
            GUILayout.EndHorizontal();
            Event current2 = Event.current;

            for (int i = 0; i < qualitySettings.Count; i++)
            {
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUIStyle gUIStyle = (i % 2 != 0) ? QualitySettingsEditor.Styles.kListOddBg : QualitySettingsEditor.Styles.kListEvenBg;
                bool     on       = num == i;
                Rect     rect3    = GUILayoutUtility.GetRect(GUIContent.none, QualitySettingsEditor.Styles.kToggle, new GUILayoutOption[]
                {
                    GUILayout.ExpandWidth(false),
                    GUILayout.Width(80f)
                });
                switch (current2.type)
                {
                case EventType.MouseDown:
                    if (rect3.Contains(current2.mousePosition))
                    {
                        num = i;
                        GUIUtility.keyboardControl = 0;
                        GUIUtility.hotControl      = this.m_QualityElementHash;
                        GUI.changed     = true;
                        this.m_Dragging = new QualitySettingsEditor.Dragging
                        {
                            m_StartPosition = i,
                            m_Position      = i
                        };
                        current2.Use();
                    }
                    break;

                case EventType.MouseUp:
                    if (GUIUtility.hotControl == this.m_QualityElementHash)
                    {
                        GUIUtility.hotControl = 0;
                        current2.Use();
                    }
                    break;

                case EventType.MouseDrag:
                    if (GUIUtility.hotControl == this.m_QualityElementHash)
                    {
                        if (rect3.Contains(current2.mousePosition))
                        {
                            this.m_Dragging.m_Position = i;
                            current2.Use();
                        }
                    }
                    break;

                case EventType.KeyDown:
                    if (current2.keyCode == KeyCode.UpArrow || current2.keyCode == KeyCode.DownArrow)
                    {
                        num += ((current2.keyCode != KeyCode.UpArrow) ? 1 : -1);
                        num  = Mathf.Clamp(num, 0, qualitySettings.Count - 1);
                        GUIUtility.keyboardControl = 0;
                        GUI.changed = true;
                        current2.Use();
                    }
                    break;

                case EventType.Repaint:
                    gUIStyle.Draw(rect3, GUIContent.none, false, false, on, false);
                    GUI.Label(rect3, EditorGUIUtility.TempContent(qualitySettings[i].m_Name));
                    break;
                }
                foreach (BuildPlatform current3 in this.m_ValidPlatforms)
                {
                    bool flag = false;
                    if (platformDefaultQualitySettings.ContainsKey(current3.name) && platformDefaultQualitySettings[current3.name] == i)
                    {
                        flag = true;
                    }
                    Rect rect4 = GUILayoutUtility.GetRect(QualitySettingsEditor.Styles.kPlatformTooltip, QualitySettingsEditor.Styles.kToggle, new GUILayoutOption[]
                    {
                        GUILayout.MinWidth(15f),
                        GUILayout.MaxWidth(20f)
                    });
                    if (Event.current.type == EventType.Repaint)
                    {
                        gUIStyle.Draw(rect4, GUIContent.none, false, false, on, false);
                    }
                    Color backgroundColor = GUI.backgroundColor;
                    if (flag && !EditorApplication.isPlayingOrWillChangePlaymode)
                    {
                        GUI.backgroundColor = Color.green;
                    }
                    bool flag2 = !qualitySettings[i].m_ExcludedPlatforms.Contains(current3.name);
                    bool flag3 = GUI.Toggle(rect4, flag2, QualitySettingsEditor.Styles.kPlatformTooltip, (!flag) ? QualitySettingsEditor.Styles.kToggle : QualitySettingsEditor.Styles.kDefaultToggle);
                    if (flag2 != flag3)
                    {
                        if (flag3)
                        {
                            qualitySettings[i].m_ExcludedPlatforms.Remove(current3.name);
                        }
                        else
                        {
                            qualitySettings[i].m_ExcludedPlatforms.Add(current3.name);
                        }
                    }
                    GUI.backgroundColor = backgroundColor;
                }
                Rect rect5 = GUILayoutUtility.GetRect(GUIContent.none, QualitySettingsEditor.Styles.kToggle, new GUILayoutOption[]
                {
                    GUILayout.MinWidth(15f),
                    GUILayout.MaxWidth(20f)
                });
                if (Event.current.type == EventType.Repaint)
                {
                    gUIStyle.Draw(rect5, GUIContent.none, false, false, on, false);
                }
                if (GUI.Button(rect5, QualitySettingsEditor.Styles.kIconTrash, GUIStyle.none))
                {
                    this.m_DeleteLevel = i;
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayoutUtility.GetRect(GUIContent.none, QualitySettingsEditor.Styles.kToggle, new GUILayoutOption[]
            {
                GUILayout.MinWidth(15f),
                GUILayout.MaxWidth(20f),
                GUILayout.Height(1f)
            });
            QualitySettingsEditor.DrawHorizontalDivider();
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            Rect rect6 = GUILayoutUtility.GetRect(GUIContent.none, QualitySettingsEditor.Styles.kToggle, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(false),
                GUILayout.Width(80f),
                GUILayout.Height(20f)
            });

            rect6.x     += EditorGUI.indent;
            rect6.width -= EditorGUI.indent;
            GUI.Label(rect6, "Default", EditorStyles.boldLabel);
            foreach (BuildPlatform current4 in this.m_ValidPlatforms)
            {
                Rect rect7 = GUILayoutUtility.GetRect(GUIContent.none, QualitySettingsEditor.Styles.kToggle, new GUILayoutOption[]
                {
                    GUILayout.MinWidth(15f),
                    GUILayout.MaxWidth(20f),
                    GUILayout.Height(20f)
                });
                int num2;
                if (!platformDefaultQualitySettings.TryGetValue(current4.name, out num2))
                {
                    platformDefaultQualitySettings.Add(current4.name, 0);
                }
                num2 = EditorGUI.Popup(rect7, num2, (from x in qualitySettings
                                                     select x.m_Name).ToArray <string>(), QualitySettingsEditor.Styles.kDefaultDropdown);
                platformDefaultQualitySettings[current4.name] = num2;
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(10f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayoutUtility.GetRect(GUIContent.none, QualitySettingsEditor.Styles.kToggle, new GUILayoutOption[]
            {
                GUILayout.MinWidth(15f),
                GUILayout.MaxWidth(20f),
                GUILayout.Height(20f)
            });
            Rect rect8 = GUILayoutUtility.GetRect(QualitySettingsEditor.Styles.kAddQualityLevel, QualitySettingsEditor.Styles.kToggle, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(true)
            });

            if (GUI.Button(rect8, QualitySettingsEditor.Styles.kAddQualityLevel))
            {
                this.m_ShouldAddNewLevel = true;
            }
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            return(num);
        }
        public override void OnInspectorGUI()
        {
            if (EditorApplication.isPlayingOrWillChangePlaymode)
            {
                EditorGUILayout.HelpBox("Changes made in play mode will not be saved.", MessageType.Warning, true);
            }
            this.m_QualitySettings.Update();
            List <QualitySettingsEditor.QualitySetting> qualitySettings = this.GetQualitySettings();
            Dictionary <string, int> qualityForPlatforms = this.GetDefaultQualityForPlatforms();
            int selectedLevel = this.DoQualityLevelSelection(QualitySettings.GetQualityLevel(), (IList <QualitySettingsEditor.QualitySetting>)qualitySettings, qualityForPlatforms);

            this.SetQualitySettings((IEnumerable <QualitySettingsEditor.QualitySetting>)qualitySettings);
            this.HandleAddRemoveQualitySetting(ref selectedLevel, qualityForPlatforms);
            this.SetDefaultQualityForPlatforms(qualityForPlatforms);
            GUILayout.Space(10f);
            QualitySettingsEditor.DrawHorizontalDivider();
            GUILayout.Space(10f);
            SerializedProperty arrayElementAtIndex = this.m_QualitySettingsProperty.GetArrayElementAtIndex(selectedLevel);
            SerializedProperty propertyRelative1   = arrayElementAtIndex.FindPropertyRelative("name");
            SerializedProperty propertyRelative2   = arrayElementAtIndex.FindPropertyRelative("pixelLightCount");
            SerializedProperty propertyRelative3   = arrayElementAtIndex.FindPropertyRelative("shadows");
            SerializedProperty propertyRelative4   = arrayElementAtIndex.FindPropertyRelative("shadowResolution");
            SerializedProperty propertyRelative5   = arrayElementAtIndex.FindPropertyRelative("shadowProjection");
            SerializedProperty propertyRelative6   = arrayElementAtIndex.FindPropertyRelative("shadowCascades");
            SerializedProperty propertyRelative7   = arrayElementAtIndex.FindPropertyRelative("shadowDistance");
            SerializedProperty propertyRelative8   = arrayElementAtIndex.FindPropertyRelative("shadowNearPlaneOffset");
            SerializedProperty propertyRelative9   = arrayElementAtIndex.FindPropertyRelative("shadowCascade2Split");
            SerializedProperty propertyRelative10  = arrayElementAtIndex.FindPropertyRelative("shadowCascade4Split");
            SerializedProperty propertyRelative11  = arrayElementAtIndex.FindPropertyRelative("blendWeights");
            SerializedProperty propertyRelative12  = arrayElementAtIndex.FindPropertyRelative("textureQuality");
            SerializedProperty propertyRelative13  = arrayElementAtIndex.FindPropertyRelative("anisotropicTextures");
            SerializedProperty propertyRelative14  = arrayElementAtIndex.FindPropertyRelative("antiAliasing");
            SerializedProperty propertyRelative15  = arrayElementAtIndex.FindPropertyRelative("softParticles");
            SerializedProperty propertyRelative16  = arrayElementAtIndex.FindPropertyRelative("realtimeReflectionProbes");
            SerializedProperty propertyRelative17  = arrayElementAtIndex.FindPropertyRelative("billboardsFaceCameraPosition");
            SerializedProperty propertyRelative18  = arrayElementAtIndex.FindPropertyRelative("vSyncCount");
            SerializedProperty propertyRelative19  = arrayElementAtIndex.FindPropertyRelative("lodBias");
            SerializedProperty propertyRelative20  = arrayElementAtIndex.FindPropertyRelative("maximumLODLevel");
            SerializedProperty propertyRelative21  = arrayElementAtIndex.FindPropertyRelative("particleRaycastBudget");
            SerializedProperty propertyRelative22  = arrayElementAtIndex.FindPropertyRelative("asyncUploadTimeSlice");
            SerializedProperty propertyRelative23  = arrayElementAtIndex.FindPropertyRelative("asyncUploadBufferSize");

            if (string.IsNullOrEmpty(propertyRelative1.stringValue))
            {
                propertyRelative1.stringValue = "Level " + (object)selectedLevel;
            }
            EditorGUILayout.PropertyField(propertyRelative1);
            GUILayout.Space(10f);
            GUILayout.Label(EditorGUIUtility.TempContent("Rendering"), EditorStyles.boldLabel, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(propertyRelative2);
            EditorGUILayout.PropertyField(propertyRelative12);
            EditorGUILayout.PropertyField(propertyRelative13);
            EditorGUILayout.PropertyField(propertyRelative14);
            EditorGUILayout.PropertyField(propertyRelative15);
            if (propertyRelative15.boolValue)
            {
                this.SoftParticlesHintGUI();
            }
            EditorGUILayout.PropertyField(propertyRelative16);
            EditorGUILayout.PropertyField(propertyRelative17, QualitySettingsEditor.Styles.kBillboardsFaceCameraPos, new GUILayoutOption[0]);
            GUILayout.Space(10f);
            GUILayout.Label(EditorGUIUtility.TempContent("Shadows"), EditorStyles.boldLabel, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(propertyRelative3);
            EditorGUILayout.PropertyField(propertyRelative4);
            EditorGUILayout.PropertyField(propertyRelative5);
            EditorGUILayout.PropertyField(propertyRelative7);
            EditorGUILayout.PropertyField(propertyRelative8);
            EditorGUILayout.PropertyField(propertyRelative6);
            if (propertyRelative6.intValue == 2)
            {
                this.DrawCascadeSplitGUI <float>(ref propertyRelative9);
            }
            else if (propertyRelative6.intValue == 4)
            {
                this.DrawCascadeSplitGUI <Vector3>(ref propertyRelative10);
            }
            GUILayout.Space(10f);
            GUILayout.Label(EditorGUIUtility.TempContent("Other"), EditorStyles.boldLabel, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(propertyRelative11);
            EditorGUILayout.PropertyField(propertyRelative18);
            EditorGUILayout.PropertyField(propertyRelative19);
            EditorGUILayout.PropertyField(propertyRelative20);
            EditorGUILayout.PropertyField(propertyRelative21);
            EditorGUILayout.PropertyField(propertyRelative22);
            EditorGUILayout.PropertyField(propertyRelative23);
            propertyRelative22.intValue = Mathf.Clamp(propertyRelative22.intValue, 1, 33);
            propertyRelative23.intValue = Mathf.Clamp(propertyRelative23.intValue, 2, 512);
            if (this.m_Dragging != null && this.m_Dragging.m_Position != this.m_Dragging.m_StartPosition)
            {
                this.m_QualitySettingsProperty.MoveArrayElement(this.m_Dragging.m_StartPosition, this.m_Dragging.m_Position);
                this.m_Dragging.m_StartPosition = this.m_Dragging.m_Position;
                selectedLevel = this.m_Dragging.m_Position;
            }
            this.m_QualitySettings.ApplyModifiedProperties();
            QualitySettings.SetQualityLevel(Mathf.Clamp(selectedLevel, 0, this.m_QualitySettingsProperty.arraySize - 1));
        }
Exemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            if (EditorApplication.isPlayingOrWillChangePlaymode)
            {
                EditorGUILayout.HelpBox("Changes made in play mode will not be saved.", MessageType.Warning, true);
            }
            this.m_QualitySettings.Update();
            List <QualitySettingsEditor.QualitySetting> qualitySettings = this.GetQualitySettings();
            Dictionary <string, int> defaultQualityForPlatforms         = this.GetDefaultQualityForPlatforms();
            int num = QualitySettings.GetQualityLevel();

            EditorGUI.BeginChangeCheck();
            num = this.DoQualityLevelSelection(num, qualitySettings, defaultQualityForPlatforms);
            if (EditorGUI.EndChangeCheck())
            {
                QualitySettings.SetQualityLevel(num);
            }
            this.SetQualitySettings(qualitySettings);
            this.HandleAddRemoveQualitySetting(ref num, defaultQualityForPlatforms);
            this.SetDefaultQualityForPlatforms(defaultQualityForPlatforms);
            GUILayout.Space(10f);
            QualitySettingsEditor.DrawHorizontalDivider();
            GUILayout.Space(10f);
            SerializedProperty arrayElementAtIndex = this.m_QualitySettingsProperty.GetArrayElementAtIndex(num);
            SerializedProperty serializedProperty  = arrayElementAtIndex.FindPropertyRelative("name");
            SerializedProperty property            = arrayElementAtIndex.FindPropertyRelative("pixelLightCount");
            SerializedProperty property2           = arrayElementAtIndex.FindPropertyRelative("shadows");
            SerializedProperty property3           = arrayElementAtIndex.FindPropertyRelative("shadowResolution");
            SerializedProperty property4           = arrayElementAtIndex.FindPropertyRelative("shadowProjection");
            SerializedProperty serializedProperty2 = arrayElementAtIndex.FindPropertyRelative("shadowCascades");
            SerializedProperty property5           = arrayElementAtIndex.FindPropertyRelative("shadowDistance");
            SerializedProperty property6           = arrayElementAtIndex.FindPropertyRelative("shadowNearPlaneOffset");
            SerializedProperty serializedProperty3 = arrayElementAtIndex.FindPropertyRelative("shadowCascade2Split");
            SerializedProperty serializedProperty4 = arrayElementAtIndex.FindPropertyRelative("shadowCascade4Split");
            SerializedProperty property7           = arrayElementAtIndex.FindPropertyRelative("shadowmaskMode");
            SerializedProperty property8           = arrayElementAtIndex.FindPropertyRelative("blendWeights");
            SerializedProperty property9           = arrayElementAtIndex.FindPropertyRelative("textureQuality");
            SerializedProperty property10          = arrayElementAtIndex.FindPropertyRelative("anisotropicTextures");
            SerializedProperty property11          = arrayElementAtIndex.FindPropertyRelative("antiAliasing");
            SerializedProperty serializedProperty5 = arrayElementAtIndex.FindPropertyRelative("softParticles");
            SerializedProperty property12          = arrayElementAtIndex.FindPropertyRelative("realtimeReflectionProbes");
            SerializedProperty property13          = arrayElementAtIndex.FindPropertyRelative("billboardsFaceCameraPosition");
            SerializedProperty property14          = arrayElementAtIndex.FindPropertyRelative("vSyncCount");
            SerializedProperty property15          = arrayElementAtIndex.FindPropertyRelative("lodBias");
            SerializedProperty property16          = arrayElementAtIndex.FindPropertyRelative("maximumLODLevel");
            SerializedProperty property17          = arrayElementAtIndex.FindPropertyRelative("particleRaycastBudget");
            SerializedProperty serializedProperty6 = arrayElementAtIndex.FindPropertyRelative("asyncUploadTimeSlice");
            SerializedProperty serializedProperty7 = arrayElementAtIndex.FindPropertyRelative("asyncUploadBufferSize");
            SerializedProperty property18          = arrayElementAtIndex.FindPropertyRelative("resolutionScalingFixedDPIFactor");

            if (string.IsNullOrEmpty(serializedProperty.stringValue))
            {
                serializedProperty.stringValue = "Level " + num;
            }
            EditorGUILayout.PropertyField(serializedProperty, new GUILayoutOption[0]);
            GUILayout.Space(10f);
            GUILayout.Label(EditorGUIUtility.TempContent("Rendering"), EditorStyles.boldLabel, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(property, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(property9, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(property10, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(property11, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(serializedProperty5, new GUILayoutOption[0]);
            if (serializedProperty5.boolValue)
            {
                this.SoftParticlesHintGUI();
            }
            EditorGUILayout.PropertyField(property12, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(property13, QualitySettingsEditor.Styles.kBillboardsFaceCameraPos, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(property18, new GUILayoutOption[0]);
            GUILayout.Space(10f);
            GUILayout.Label(EditorGUIUtility.TempContent("Shadows"), EditorStyles.boldLabel, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(property2, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(property3, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(property4, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(property5, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(property7, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(property6, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(serializedProperty2, new GUILayoutOption[0]);
            if (serializedProperty2.intValue == 2)
            {
                this.DrawCascadeSplitGUI <float>(ref serializedProperty3);
            }
            else if (serializedProperty2.intValue == 4)
            {
                this.DrawCascadeSplitGUI <Vector3>(ref serializedProperty4);
            }
            GUILayout.Space(10f);
            GUILayout.Label(EditorGUIUtility.TempContent("Other"), EditorStyles.boldLabel, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(property8, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(property14, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(property15, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(property16, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(property17, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(serializedProperty6, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(serializedProperty7, new GUILayoutOption[0]);
            serializedProperty6.intValue = Mathf.Clamp(serializedProperty6.intValue, 1, 33);
            serializedProperty7.intValue = Mathf.Clamp(serializedProperty7.intValue, 2, 512);
            if (this.m_Dragging != null && this.m_Dragging.m_Position != this.m_Dragging.m_StartPosition)
            {
                this.m_QualitySettingsProperty.MoveArrayElement(this.m_Dragging.m_StartPosition, this.m_Dragging.m_Position);
                this.m_Dragging.m_StartPosition = this.m_Dragging.m_Position;
                num = this.m_Dragging.m_Position;
                this.m_QualitySettings.ApplyModifiedProperties();
                QualitySettings.SetQualityLevel(Mathf.Clamp(num, 0, this.m_QualitySettingsProperty.arraySize - 1));
            }
            this.m_QualitySettings.ApplyModifiedProperties();
        }
        private int DoQualityLevelSelection(int currentQualitylevel, IList <QualitySettingsEditor.QualitySetting> qualitySettings, Dictionary <string, int> platformDefaultQualitySettings)
        {
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.BeginVertical();
            int num = currentQualitylevel;

            GUILayout.BeginHorizontal();
            Rect rect1 = GUILayoutUtility.GetRect(GUIContent.none, QualitySettingsEditor.Styles.kToggle, new GUILayoutOption[3] {
                GUILayout.ExpandWidth(false), GUILayout.Width(80f), GUILayout.Height(20f)
            });

            rect1.x     += EditorGUI.indent;
            rect1.width -= EditorGUI.indent;
            GUI.Label(rect1, "Levels", EditorStyles.boldLabel);
            using (List <BuildPlayerWindow.BuildPlatform> .Enumerator enumerator = this.m_ValidPlatforms.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    BuildPlayerWindow.BuildPlatform current = enumerator.Current;
                    Rect rect2 = GUILayoutUtility.GetRect(GUIContent.none, QualitySettingsEditor.Styles.kToggle, new GUILayoutOption[3] {
                        GUILayout.MinWidth(15f), GUILayout.MaxWidth(20f), GUILayout.Height(20f)
                    });
                    GUIContent content = EditorGUIUtility.TempContent((Texture)current.smallIcon);
                    content.tooltip = current.name;
                    GUI.Label(rect2, content);
                    content.tooltip = string.Empty;
                }
            }
            GUILayoutUtility.GetRect(GUIContent.none, QualitySettingsEditor.Styles.kToggle, new GUILayoutOption[3]
            {
                GUILayout.MinWidth(15f),
                GUILayout.MaxWidth(20f),
                GUILayout.Height(20f)
            });
            GUILayout.EndHorizontal();
            Event current1 = Event.current;

            for (int index = 0; index < qualitySettings.Count; ++index)
            {
                GUILayout.BeginHorizontal();
                GUIStyle guiStyle = index % 2 != 0 ? QualitySettingsEditor.Styles.kListOddBg : QualitySettingsEditor.Styles.kListEvenBg;
                bool     on       = num == index;
                Rect     rect2    = GUILayoutUtility.GetRect(GUIContent.none, QualitySettingsEditor.Styles.kToggle, new GUILayoutOption[2] {
                    GUILayout.ExpandWidth(false), GUILayout.Width(80f)
                });
                switch (current1.type)
                {
                case EventType.MouseDown:
                    if (rect2.Contains(current1.mousePosition))
                    {
                        num = index;
                        GUIUtility.keyboardControl = 0;
                        GUIUtility.hotControl      = this.m_QualityElementHash;
                        this.m_Dragging            = new QualitySettingsEditor.Dragging()
                        {
                            m_StartPosition = index,
                            m_Position      = index
                        };
                        current1.Use();
                        break;
                    }
                    break;

                case EventType.MouseUp:
                    if (GUIUtility.hotControl == this.m_QualityElementHash)
                    {
                        GUIUtility.hotControl = 0;
                        current1.Use();
                        break;
                    }
                    break;

                case EventType.MouseDrag:
                    if (GUIUtility.hotControl == this.m_QualityElementHash && rect2.Contains(current1.mousePosition))
                    {
                        this.m_Dragging.m_Position = index;
                        current1.Use();
                        break;
                    }
                    break;

                case EventType.KeyDown:
                    if (current1.keyCode == KeyCode.UpArrow || current1.keyCode == KeyCode.DownArrow)
                    {
                        num = Mathf.Clamp(num + (current1.keyCode != KeyCode.UpArrow ? 1 : -1), 0, qualitySettings.Count - 1);
                        GUIUtility.keyboardControl = 0;
                        current1.Use();
                        break;
                    }
                    break;

                case EventType.Repaint:
                    guiStyle.Draw(rect2, GUIContent.none, false, false, on, false);
                    GUI.Label(rect2, EditorGUIUtility.TempContent(qualitySettings[index].m_Name));
                    break;
                }
                using (List <BuildPlayerWindow.BuildPlatform> .Enumerator enumerator = this.m_ValidPlatforms.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        BuildPlayerWindow.BuildPlatform current2 = enumerator.Current;
                        bool flag1 = false;
                        if (platformDefaultQualitySettings.ContainsKey(current2.name) && platformDefaultQualitySettings[current2.name] == index)
                        {
                            flag1 = true;
                        }
                        Rect rect3 = GUILayoutUtility.GetRect(QualitySettingsEditor.Styles.kPlatformTooltip, QualitySettingsEditor.Styles.kToggle, new GUILayoutOption[2] {
                            GUILayout.MinWidth(15f), GUILayout.MaxWidth(20f)
                        });
                        if (Event.current.type == EventType.Repaint)
                        {
                            guiStyle.Draw(rect3, GUIContent.none, false, false, on, false);
                        }
                        Color backgroundColor = GUI.backgroundColor;
                        if (flag1 && !EditorApplication.isPlayingOrWillChangePlaymode)
                        {
                            GUI.backgroundColor = Color.green;
                        }
                        bool flag2 = !qualitySettings[index].m_ExcludedPlatforms.Contains(current2.name);
                        bool flag3 = GUI.Toggle(rect3, flag2, QualitySettingsEditor.Styles.kPlatformTooltip, !flag1 ? QualitySettingsEditor.Styles.kToggle : QualitySettingsEditor.Styles.kDefaultToggle);
                        if (flag2 != flag3)
                        {
                            if (flag3)
                            {
                                qualitySettings[index].m_ExcludedPlatforms.Remove(current2.name);
                            }
                            else
                            {
                                qualitySettings[index].m_ExcludedPlatforms.Add(current2.name);
                            }
                        }
                        GUI.backgroundColor = backgroundColor;
                    }
                }
                Rect rect4 = GUILayoutUtility.GetRect(GUIContent.none, QualitySettingsEditor.Styles.kToggle, new GUILayoutOption[2] {
                    GUILayout.MinWidth(15f), GUILayout.MaxWidth(20f)
                });
                if (Event.current.type == EventType.Repaint)
                {
                    guiStyle.Draw(rect4, GUIContent.none, false, false, on, false);
                }
                if (GUI.Button(rect4, QualitySettingsEditor.Styles.kIconTrash, GUIStyle.none))
                {
                    this.m_DeleteLevel = index;
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.BeginHorizontal();
            GUILayoutUtility.GetRect(GUIContent.none, QualitySettingsEditor.Styles.kToggle, new GUILayoutOption[3]
            {
                GUILayout.MinWidth(15f),
                GUILayout.MaxWidth(20f),
                GUILayout.Height(1f)
            });
            QualitySettingsEditor.DrawHorizontalDivider();
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            Rect rect5 = GUILayoutUtility.GetRect(GUIContent.none, QualitySettingsEditor.Styles.kToggle, new GUILayoutOption[3] {
                GUILayout.ExpandWidth(false), GUILayout.Width(80f), GUILayout.Height(20f)
            });

            rect5.x     += EditorGUI.indent;
            rect5.width -= EditorGUI.indent;
            GUI.Label(rect5, "Default", EditorStyles.boldLabel);
            using (List <BuildPlayerWindow.BuildPlatform> .Enumerator enumerator = this.m_ValidPlatforms.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    BuildPlayerWindow.BuildPlatform current2 = enumerator.Current;
                    Rect rect2 = GUILayoutUtility.GetRect(GUIContent.none, QualitySettingsEditor.Styles.kToggle, new GUILayoutOption[3] {
                        GUILayout.MinWidth(15f), GUILayout.MaxWidth(20f), GUILayout.Height(20f)
                    });
                    int selectedIndex;
                    if (!platformDefaultQualitySettings.TryGetValue(current2.name, out selectedIndex))
                    {
                        platformDefaultQualitySettings.Add(current2.name, 0);
                    }
                    selectedIndex = EditorGUI.Popup(rect2, selectedIndex, qualitySettings.Select <QualitySettingsEditor.QualitySetting, string>((Func <QualitySettingsEditor.QualitySetting, string>)(x => x.m_Name)).ToArray <string>(), QualitySettingsEditor.Styles.kDefaultDropdown);
                    platformDefaultQualitySettings[current2.name] = selectedIndex;
                }
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(10f);
            GUILayout.BeginHorizontal();
            GUILayoutUtility.GetRect(GUIContent.none, QualitySettingsEditor.Styles.kToggle, new GUILayoutOption[3]
            {
                GUILayout.MinWidth(15f),
                GUILayout.MaxWidth(20f),
                GUILayout.Height(20f)
            });
            if (GUI.Button(GUILayoutUtility.GetRect(GUIContent.none, QualitySettingsEditor.Styles.kToggle, new GUILayoutOption[1] {
                GUILayout.ExpandWidth(true)
            }), EditorGUIUtility.TempContent("Add Quality Level")))
            {
                this.m_ShouldAddNewLevel = true;
            }
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            return(num);
        }