Example #1
0
 internal static StyleSheetResolver ResolveFromSheetsFolder(string folder, SkinTarget target, StyleSheetResolver.ResolvingOptions options = null, string sheetPostFix = "")
 {
     return(ResolveFromSheetsFolder(new[] { folder }, target, options, sheetPostFix));
 }
Example #2
0
        internal static StyleSheetResolver ResolveFromSheetsFolder(IEnumerable <string> folders, SkinTarget target, StyleSheetResolver.ResolvingOptions options = null, string sheetPostFix = "")
        {
            var sheetPaths = ConverterUtils.GetSheetPathsFromRootFolders(folders, target, sheetPostFix);

            if (sheetPaths.Length == 0)
            {
                throw new Exception("Cannot find sheets to generate skin");
            }

            var resolver = new StyleSheetResolver(options ?? new StyleSheetResolver.ResolvingOptions()
            {
                ThrowIfCannotResolve = true
            });

            foreach (var sheet in sheetPaths)
            {
                resolver.AddStyleSheets(sheet);
            }

            return(resolver);
        }
Example #3
0
        internal static StyleSheetResolver ResolveFromSheetsFolder(string sheetsPath, SkinTarget target, StyleSheetResolver.ResolvingOptions options = null, string sheetPostFix = "")
        {
            var sheetFolders = AssetDatabase.GetSubFolders(sheetsPath);

            if (sheetFolders.Length == 0)
            {
                throw new Exception("Cannot find EditorStyles: " + sheetsPath);
            }

            var skinSheetName = string.Format("{0}{1}.uss", target == SkinTarget.Light ? "light" : "dark", sheetPostFix);
            var resolver      = new StyleSheetResolver(options ?? new StyleSheetResolver.ResolvingOptions()
            {
                ThrowIfCannotResolve = true
            });
            var themeDir = sheetsPath + "/_Variables";

            if (Directory.Exists(themeDir))
            {
                var themeSheetPath = themeDir + "/" + skinSheetName;
                resolver.AddStyleSheet(themeSheetPath);
            }

            foreach (var sheetFolder in sheetFolders)
            {
                var commonPath    = sheetFolder + "/" + string.Format("{0}{1}.uss", "common", sheetPostFix);
                var skinSheetPath = sheetFolder + "/" + skinSheetName;
                resolver.AddStyleSheets(commonPath, skinSheetPath);
            }

            return(resolver);
        }