当前位置: 首页>>代码示例>>C#>>正文


C# TileMap.Export方法代码示例

本文整理汇总了C#中TileMap.Export方法的典型用法代码示例。如果您正苦于以下问题:C# TileMap.Export方法的具体用法?C# TileMap.Export怎么用?C# TileMap.Export使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TileMap的用法示例。


在下文中一共展示了TileMap.Export方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExportAll

    //
    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;

//.........这里部分代码省略.........
开发者ID:MagnusRunesson,项目名称:TinyDataTool,代码行数:101,代码来源:bmp2tile.cs


注:本文中的TileMap.Export方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。