private StyleSheet LoadAndResolveStyleSheet(bool isDarkTheme)
        {
            var styleSheet = ScriptableObject.CreateInstance <StyleSheet>();

            styleSheet.hideFlags         = HideFlags.HideAndDontSave;
            styleSheet.isUnityStyleSheet = true;

            var packageManagerThemeVariablesSheetPath = isDarkTheme ? k_PackageManagerDarkVariablesSheetPath : k_PackageManagerLightVariablesSheetPath;
            var variablesThemeStyleSheetPath          = isDarkTheme ? UIElementsEditorUtility.s_DefaultCommonDarkStyleSheetPath : UIElementsEditorUtility.s_DefaultCommonLightStyleSheetPath;
            var extensionThemeStyleSheetPath          = isDarkTheme ? k_ExtensionDarkVariablesSheetPath : k_ExtensionLightVariablesSheetPath;
            var northstarThemeStyleSheetPath          = isDarkTheme ? k_PublicNorthstarDarkVariablesSheetPath : k_PublicNorthstarLightVariablesSheetPath;

            var packageManagerCommon = EditorGUIUtility.Load(k_PackageManagerCommonStyleSheetPath) as StyleSheet;
            var packageManagerTheme  = EditorGUIUtility.Load(packageManagerThemeVariablesSheetPath) as StyleSheet;

            var packageManagerStyles = k_PackageManagerStyleSheetPaths.Select(p => EditorGUIUtility.Load(p) as StyleSheet).ToArray();

            var variableThemeSheet                 = EditorGUIUtility.Load(UIElementsEditorUtility.GetStyleSheetPathForCurrentFont(variablesThemeStyleSheetPath)) as StyleSheet;
            var extensionThemeStyleSheet           = EditorGUIUtility.Load(extensionThemeStyleSheetPath) as StyleSheet;
            var northstarCommonVariablesStyleSheet = EditorGUIUtility.Load(s_PublicNorthstarCommonVariableStyleSheetPath) as StyleSheet;
            var northstarVariablesStyleSheet       = EditorGUIUtility.Load(northstarThemeStyleSheetPath) as StyleSheet;

            var resolver = new StyleSheets.StyleSheetResolver();

            resolver.AddStyleSheets(variableThemeSheet, extensionThemeStyleSheet, northstarCommonVariablesStyleSheet, northstarVariablesStyleSheet, packageManagerCommon, packageManagerTheme);
            resolver.AddStyleSheets(packageManagerStyles);
            resolver.ResolveTo(styleSheet);

            return(styleSheet);
        }
        private static StyleSheet ResolveStyleSheets(params StyleSheet[] styleSheets)
        {
            var styleSheet = ScriptableObject.CreateInstance <StyleSheet>();

            styleSheet.hideFlags           = HideFlags.HideAndDontSave;
            styleSheet.isDefaultStyleSheet = true;

            var resolver = new StyleSheets.StyleSheetResolver();

            resolver.AddStyleSheets(styleSheets);
            resolver.ResolveTo(styleSheet);
            return(styleSheet);
        }
        private StyleSheet LoadAndResolveFilterStyleSheet(bool isDarkTheme)
        {
            var styleSheet = ScriptableObject.CreateInstance <StyleSheet>();

            styleSheet.hideFlags         = HideFlags.HideAndDontSave;
            styleSheet.isUnityStyleSheet = true;

            var packageManagerThemeVariablesSheetPath = EditorGUIUtility.isProSkin ? k_PackageManagerDarkVariablesSheetPath : k_PackageManagerLightVariablesSheetPath;
            var packageManagerTheme        = EditorGUIUtility.Load(packageManagerThemeVariablesSheetPath) as StyleSheet;
            var packageManagerFilterCommon = EditorGUIUtility.Load(k_PackageManagerFiltersStyleSheetPath) as StyleSheet;

            var resolver = new StyleSheets.StyleSheetResolver();

            resolver.AddStyleSheets(packageManagerFilterCommon, packageManagerTheme);
            resolver.ResolveTo(styleSheet);

            return(styleSheet);
        }
Exemple #4
0
        private static StyleSheet LoadAndResolveStyleSheet(bool isDarkTheme)
        {
            var styleSheet = ScriptableObject.CreateInstance <StyleSheet>();

            styleSheet.hideFlags         = HideFlags.HideAndDontSave;
            styleSheet.isUnityStyleSheet = true;

            var packageManagerThemeVariablesSheetPath = isDarkTheme ? PackageManagerDarkVariablesSheetPath : PackageManagerLightVariablesSheetPath;
            var variablesThemeStyleSheetPath          = isDarkTheme ? UIElementsEditorUtility.s_DefaultCommonDarkStyleSheetPath : UIElementsEditorUtility.s_DefaultCommonLightStyleSheetPath;

            var packageManagerCommon = EditorGUIUtility.Load(PackageManagerCommonStyleSheetPath) as StyleSheet;
            var packageManagerTheme  = EditorGUIUtility.Load(packageManagerThemeVariablesSheetPath) as StyleSheet;

            var variableThemeSheet = EditorGUIUtility.Load(UIElementsEditorUtility.GetStyleSheetPathForCurrentFont(variablesThemeStyleSheetPath)) as StyleSheet;

            var resolver = new StyleSheets.StyleSheetResolver();

            resolver.AddStyleSheets(variableThemeSheet, packageManagerCommon, packageManagerTheme);
            resolver.ResolveTo(styleSheet);

            return(styleSheet);
        }