// void ExportAll() { // string outFileName = EditorUtility.SaveFilePanel( "Select folder to export to", m_lastExportDirectory, "filenameignored", "bin" ); // m_lastExportDirectory = System.IO.Path.GetDirectoryName( outFileName ); SaveLastExportDirectory(); m_project.Export( m_lastExportDirectory ); // // Export all images // string[] imageFiles = m_project.m_imageFiles; foreach( string imageFile in imageFiles ) { Debug.Log( "Exporting file '" + imageFile + "'" ); string outFileNameNoExt = System.IO.Path.GetFileNameWithoutExtension( imageFile ).ToLower(); string outBaseName = m_lastExportDirectory + System.IO.Path.DirectorySeparatorChar + outFileNameNoExt; // PalettizedImageConfig imageConfig = new PalettizedImageConfig( imageFile + ".config" ); PalettizedImage imageData = PalettizedImage.LoadImage( imageFile, imageConfig ); // if( imageData != null ) { // imageConfig.SetImage( imageData ); // Convert to tile banks / planar images // PlanarImage planarImage = new PlanarImage( imageData); TileBank tileBank = new TileBank( imageData, (imageConfig.m_importAsSprite==false) ); TilePalette tilePalette = new TilePalette( imageData ); // Export it if( imageConfig.m_importAsSprite ) { Sprite sprite = new Sprite( imageConfig ); string alternativeAmigaSpriteName; if( imageConfig.m_importAsBSprite ) { AmigaSprite amigaSprite = new AmigaSprite( imageData, imageConfig); alternativeAmigaSpriteName = "_sprite_bank_amiga_b_hw.bin"; amigaSprite.Export( outBaseName + alternativeAmigaSpriteName ); } else { AmigaBob amigaBob = new AmigaBob( imageData, imageConfig); alternativeAmigaSpriteName = "_sprite_bank_amiga_a_bob.bin"; amigaBob.Export( outBaseName + alternativeAmigaSpriteName ); } tileBank.ExportMegaDrive( outBaseName + "_sprite_bank.bin" ); tilePalette.Export( outBaseName + "_palette.bin" ); sprite.Export( outBaseName + "_sprite.bin" ); } else { TileMap tileMap = new TileMap( tileBank, imageData ); tileBank.ExportMegaDrive( outBaseName + "_bank.bin" ); tileBank.ExportAmiga( outBaseName + "_bank_amiga.bin" ); tileMap.Export( outBaseName + "_map.bin" ); tilePalette.Export( outBaseName + "_palette.bin" ); } } } // // Export all maps // string[] mapFiles = m_project.m_mapFiles; foreach( string mapFile in mapFiles ) { Debug.Log( "Exporting map '" + mapFile + "'" ); string outFileNameNoExt = System.IO.Path.GetFileNameWithoutExtension( mapFile ).ToLower(); string outBaseName = m_lastExportDirectory + System.IO.Path.DirectorySeparatorChar + outFileNameNoExt; // TileMap tileMap = TileMap.LoadJson( mapFile ); CollisionMap collisionmap = new CollisionMap( tileMap ); tileMap.Export( outBaseName + "_map.bin" ); collisionmap.Export( outBaseName + "_collisionmap.bin" ); } // // Export all game objects // foreach( string goFile in m_project.m_gameObjectCollectionFiles ) { Debug.Log( "Exporting game object '" + goFile + "'" ); string outFileNameNoExt = m_project.GetOutFileNameNoExt( goFile ); string outBaseName = m_lastExportDirectory + System.IO.Path.DirectorySeparatorChar; GameObjectCollection ggo = new GameObjectCollection( goFile ); ggo.Export( outBaseName + m_project.GetGreatGameObjectName( goFile ), m_project ); } Debug.Log("Export is finished!"); }
// void ExportAll() { // string outFileName = EditorUtility.SaveFilePanel("Select folder to export to", m_lastExportDirectory, "filenameignored", "bin"); // m_lastExportDirectory = System.IO.Path.GetDirectoryName(outFileName); SaveLastExportDirectory(); m_project.Export(m_lastExportDirectory); // // Export all images // string[] imageFiles = m_project.m_imageFiles; foreach (string imageFile in imageFiles) { Debug.Log("Exporting file '" + imageFile + "'"); string outFileNameNoExt = System.IO.Path.GetFileNameWithoutExtension(imageFile).ToLower(); string outBaseName = m_lastExportDirectory + System.IO.Path.DirectorySeparatorChar + outFileNameNoExt; // PalettizedImageConfig imageConfig = new PalettizedImageConfig(imageFile + ".config"); PalettizedImage imageData = PalettizedImage.LoadImage(imageFile, imageConfig); // if (imageData != null) { // imageConfig.SetImage(imageData); // Convert to tile banks / planar images // PlanarImage planarImage = new PlanarImage( imageData); TileBank tileBank = new TileBank(imageData, (imageConfig.m_importAsSprite == false)); TilePalette tilePalette = new TilePalette(imageData); // Export it if (imageConfig.m_importAsSprite) { Sprite sprite = new Sprite(imageConfig); string alternativeAmigaSpriteName; if (imageConfig.m_importAsBSprite) { AmigaSprite amigaSprite = new AmigaSprite(imageData, imageConfig); alternativeAmigaSpriteName = "_sprite_bank_amiga_b_hw.bin"; amigaSprite.Export(outBaseName + alternativeAmigaSpriteName); } else { AmigaBob amigaBob = new AmigaBob(imageData, imageConfig); alternativeAmigaSpriteName = "_sprite_bank_amiga_a_bob.bin"; amigaBob.Export(outBaseName + alternativeAmigaSpriteName); } tileBank.ExportMegaDrive(outBaseName + "_sprite_bank.bin"); tilePalette.Export(outBaseName + "_palette.bin"); sprite.Export(outBaseName + "_sprite.bin"); } else { TileMap tileMap = new TileMap(tileBank, imageData); tileBank.ExportMegaDrive(outBaseName + "_bank.bin"); tileBank.ExportAmiga(outBaseName + "_bank_amiga.bin"); tileMap.Export(outBaseName + "_map.bin"); tilePalette.Export(outBaseName + "_palette.bin"); } } } // // Export all maps // string[] mapFiles = m_project.m_mapFiles; foreach (string mapFile in mapFiles) { Debug.Log("Exporting map '" + mapFile + "'"); string outFileNameNoExt = System.IO.Path.GetFileNameWithoutExtension(mapFile).ToLower(); string outBaseName = m_lastExportDirectory + System.IO.Path.DirectorySeparatorChar + outFileNameNoExt; // TileMap tileMap = TileMap.LoadJson(mapFile); CollisionMap collisionmap = new CollisionMap(tileMap); tileMap.Export(outBaseName + "_map.bin"); collisionmap.Export(outBaseName + "_collisionmap.bin"); } // // Export all game objects // foreach (string goFile in m_project.m_gameObjectCollectionFiles) { Debug.Log("Exporting game object '" + goFile + "'"); string outFileNameNoExt = m_project.GetOutFileNameNoExt(goFile); string outBaseName = m_lastExportDirectory + System.IO.Path.DirectorySeparatorChar; GameObjectCollection ggo = new GameObjectCollection(goFile); ggo.Export(outBaseName + m_project.GetGreatGameObjectName(goFile), m_project); } Debug.Log("Export is finished!"); }