示例#1
0
        public static List <BlockData> ImportBlockData(string filePath)
        {
            List <BlockData> blocks;
            string           extension = Path.GetExtension(filePath).ToLower();

            switch (extension)
            {
            case ".schematic":
                fileType = FileType.FILE_Schematic;
                SchematicProcessor schematicProcessor = new SchematicProcessor(filePath);
                blocks = schematicProcessor.generateBlockData();
                break;

            case ".mcr":
                fileType = FileType.FILE_MCR;
                List <Chunk> chunkList = VoxelTerrainImporter.LoadTerrain(filePath);
                blocks = VoxelTerrainImporter.GenerateBlocks(chunkList);
                break;

            case ".mca":
                fileType  = FileType.FILE_MCA;
                chunkList = VoxelTerrainImporter.LoadTerrain(filePath);
                blocks    = VoxelTerrainImporter.GenerateBlocks(chunkList);
                break;

            default:
                MessageBox.Show(String.Format("The {0} format is not accepted - Aborting", extension));
                blocks = null;
                break;
            }

            return(blocks);
        }
示例#2
0
        private void LoadVoxelTerrain(string fileName)
        {
            Cursor = Cursors.WaitCursor;

            List <BlockData> blocks = VoxelTerrainImporter.ImportBlockData(fileName);

            if (blocks != null)
            {
                VoxelTerrain vt = new VoxelTerrain(blocks);
                gameManifest.VoxelTerrains[fileName] = vt;
                editorViewerControl.VoxelTerrain     = vt;
            }

            Cursor = Cursors.Arrow;
        }