示例#1
0
 private static void SyncHotScenes()
 {
     SyncUpdated(".scene", ".scene", (srcPath, dstPath) => {
         using (Stream stream = new FileStream(srcPath, FileMode.Open)) {
             var node = new HotSceneImporter(false, srcPath).Import(stream, null, null);
             Serialization.WriteObjectToBundle(AssetBundle, dstPath, node, Serialization.Format.Binary, ".scene", 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);
                    }
                }
            }
        }