Beispiel #1
0
        internal bool DrawEnabledModules(List <string> excludedTypes, SerializedProperty excludedTypesProperty)
        {
            var wasShowing = m_RootNamespaceGroup.expanded;
            var isShowing  = EditorGUILayout.Foldout(wasShowing, "Enabled Modules", true);

            m_RootNamespaceGroup.expanded = isShowing;
            if (wasShowing != isShowing && Event.current.alt)
            {
                m_RootNamespaceGroup.SetExpandedRecursively(isShowing);
            }

            if (!isShowing)
            {
                return(false);
            }

            var modified = false;

            UpdateDependentTypes(excludedTypes);

            using (new EditorGUI.IndentLevelScope())
            {
                DrawNamespaceGroup(m_RootNamespaceGroup, excludedTypes, excludedTypesProperty);
            }

            if (excludedTypesProperty.serializedObject.ApplyModifiedProperties())
            {
                modified = true;
            }

            return(modified);
        }
            public void Draw(HashSet <string> assemblyExceptions, HashSet <string> namespaceExceptions, HashSet <string> typeExceptions)
            {
                var included = !assemblyExceptions.Contains(FullName);

                using (new GUILayout.HorizontalScope())
                {
                    var wasExpanded = m_Expanded;
                    m_Expanded = EditorGUILayout.Foldout(m_Expanded, DisplayName, true);
                    if (wasExpanded != m_Expanded && Event.current.alt)
                    {
                        m_RootNamespaceGroup.SetExpandedRecursively(m_Expanded);
                    }

                    var indentedRect = EditorGUI.IndentedRect(Rect.zero);
                    var nowIncluded  = EditorGUILayout.Toggle("", included, GUILayout.Width(k_ToggleWidth + indentedRect.x));

                    if (included && !nowIncluded)
                    {
                        assemblyExceptions.Add(FullName);
                        if (Event.current.alt)
                        {
                            m_RootNamespaceGroup.GetAllNamespacesRecursively(namespaceExceptions);
                        }

                        RuntimeSerializationSettingsUtils.SaveSettings();
                    }

                    if (!included && nowIncluded)
                    {
                        assemblyExceptions.Remove(FullName);
                        if (Event.current.alt)
                        {
                            m_RootNamespaceGroup.RemoveAllNamespacesRecursively(namespaceExceptions);
                        }

                        RuntimeSerializationSettingsUtils.SaveSettings();
                    }
                }

                if (m_Expanded)
                {
                    using (new EditorGUI.IndentLevelScope())
                    {
                        using (new EditorGUI.DisabledScope(!included))
                        {
                            DrawButtons(namespaceExceptions, "namespaces", m_GetAllNamespaces, m_RemoveAllNamespaces);
                            DrawButtons(namespaceExceptions, "types", m_GetAllTypes, m_RemoveAllTypes);
                        }

                        foreach (var kvp in m_RootNamespaceGroup.Children)
                        {
                            kvp.Value.Draw(kvp.Key, included, namespaceExceptions, typeExceptions);
                        }
                    }
                }
            }