protected override void DrawGUI(Rect position, Config config, bool labelClicked)
            {
                //Check if any feature within that Foldout are enabled, and show different color if so
                var hasToggledFeatures = false;
                var i = Array.IndexOf(Template.CurrentTemplate.uiFeatures, this);

                if (i >= 0)
                {
                    for (i++; i < Template.CurrentTemplate.uiFeatures.Length; i++)
                    {
                        var uiFeature = Template.CurrentTemplate.uiFeatures[i];
                        if (uiFeature is UIFeature_DropDownEnd)
                        {
                            break;
                        }

                        hasToggledFeatures |= uiFeature.Highlighted(config) && uiFeature.Enabled(config);
                    }
                }

                var color = GUI.color;

                GUI.color *= EditorGUIUtility.isProSkin ? Color.white : new Color(.95f, .95f, .95f, 1f);
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                GUI.color = color;
                EditorGUI.BeginChangeCheck();
                {
                    var rect = GUILayoutUtility.GetRect(EditorGUIUtility.fieldWidth, EditorGUIUtility.fieldWidth, EditorGUIUtility.singleLineHeight, EditorGUIUtility.singleLineHeight, TCP2_GUI.HeaderDropDownBold);

                    // hover
                    TCP2_GUI.DrawHoverRect(rect);

                    foldout = TCP2_GUI.HeaderFoldoutHighlight(rect, foldout, guiContent, hasToggledFeatures);
                    FoldoutStack.Push(foldout);
                }
                if (EditorGUI.EndChangeCheck())
                {
                    UpdatePersistentState();

                    if (Event.current.alt || Event.current.control)
                    {
                        var state = foldout;
                        foreach (var dd in AllDropDowns)
                        {
                            dd.foldout = state;
                            dd.UpdatePersistentState();
                        }
                    }
                }
            }
Beispiel #2
0
        protected override void DrawGUI(Rect position, TCP2_Config config)
        {
            //Check if any feature within that Foldout are enabled, and show different color if so
            var hasToggledFeatures = false;
            var i = Array.IndexOf(ShaderGeneratorTemplate.CurrentTemplate.uiFeatures, this);

            if (i >= 0)
            {
                for (i++; i < ShaderGeneratorTemplate.CurrentTemplate.uiFeatures.Length; i++)
                {
                    var uiFeature = ShaderGeneratorTemplate.CurrentTemplate.uiFeatures[i];
                    if (uiFeature is UIFeature_DropDownEnd)
                    {
                        break;
                    }

                    hasToggledFeatures |= uiFeature.Highlighted(config) && uiFeature.Enabled(config);
                }
            }

            var color = GUI.color;

            GUI.color *= 0.95f;
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            GUI.color = color;
            EditorGUI.BeginChangeCheck();
            foldout = TCP2_GUI.HeaderFoldoutHighlight(foldout, guiContent, hasToggledFeatures);
            FoldoutStack.Push(foldout);
            if (EditorGUI.EndChangeCheck())
            {
                UpdatePersistentState();

                if (Event.current.alt || Event.current.control)
                {
                    var state = foldout;
                    foreach (var dd in AllDropDowns)
                    {
                        dd.foldout = state;
                        dd.UpdatePersistentState();
                    }
                }
            }
        }