Пример #1
0
 private static void SyncHotFonts()
 {
     SyncUpdated(".fnt", ".fnt", (srcPath, dstPath) => {
         var importer = new HotFontImporter(false);
         var font     = importer.ParseFont(srcPath, dstPath);
         Serialization.WriteObjectToBundle(AssetBundle, dstPath, font, Serialization.Format.Binary, ".fnt", AssetAttributes.None, cookingRulesMap[srcPath].SHA1);
         return(true);
     });
 }
Пример #2
0
        public static void ConvertAssetsAction()
        {
            var           fileEnumerator = The.Workspace.AssetFiles;
            var           tanDataRoot    = Path.Combine(The.Workspace.ProjectDirectory, The.Workspace.AssetsDirectory + "_Tangerine\\");
            DirectoryInfo di             = Directory.CreateDirectory(tanDataRoot);

            using (new DirectoryChanger(fileEnumerator.Directory)) {
                foreach (var fileInfo in fileEnumerator.Enumerate())
                {
                    var path    = fileInfo.Path;
                    var dstPath = Path.Combine(tanDataRoot, path);
                    var dstDir  = Path.GetDirectoryName(dstPath);
                    var srcPath = path;
                    Directory.CreateDirectory(dstDir);
                    if (path.EndsWith(".scene", StringComparison.OrdinalIgnoreCase))
                    {
                        using (Stream stream = new FileStream(srcPath, FileMode.Open)) {
                            var node = new HotSceneImporter(false, srcPath).Import(stream, null, null);
                            dstPath = Path.ChangeExtension(dstPath, "tan");
                            Serialization.WriteObjectToFile(dstPath, node, Serialization.Format.JSON);
                        }
                    }
                    else if (path.EndsWith(".fnt", StringComparison.OrdinalIgnoreCase))
                    {
                        dstPath = Path.ChangeExtension(dstPath, "tft");
                        var importer        = new HotFontImporter(false);
                        var dstRelativePath = Path.ChangeExtension(srcPath, "tft");
                        var font            = importer.ParseFont(srcPath, dstRelativePath);
                        Serialization.WriteObjectToFile(dstPath, font, Serialization.Format.JSON);
                    }
                    else
                    {
                        File.Copy(srcPath, dstPath, true);
                    }
                }
            }
        }