示例#1
0
        public static bool ExportTheme(ChartTheme theme)
        {
#if UNITY_EDITOR
            theme.SyncFontName();
            var themeAssetName = XChartsSettings.THEME_ASSET_NAME_PREFIX + theme.themeName;
            var themeAssetPath = Application.dataPath + "/../" + XChartsSettings.THEME_ASSET_FOLDER;
            if (!Directory.Exists(themeAssetPath))
            {
                Directory.CreateDirectory(themeAssetPath);
            }
            var themeAssetFilePath = string.Format("{0}/{1}.json", themeAssetPath, themeAssetName);
            var json = JsonUtility.ToJson(theme, true);
            File.WriteAllText(themeAssetFilePath, json);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
            return(true);
#else
            return(false);
#endif
        }