コード例 #1
0
        public MapBlockManager(string terrainFileName, int BlocksMapSide, int VerticesBlockSide)
        {
            string ElvFileName = System.IO.Path.ChangeExtension(terrainFileName, "elv");

            this.VerticesBlockSide = VerticesBlockSide;
            MapElvFile terrainElvFile = new MapElvFile(MechCommanderUnity.Instance.FileManager.File(MCGExtensions.PathCombine(new string[] { "terrain", ElvFileName })), BlocksMapSide, VerticesBlockSide);

            blocks = terrainElvFile.GetVertices();
        }
コード例 #2
0
        public TerrainTiles(string terrainFileName, string TerrainTileFile, int NumBlocks, int NumVertices)
        {
            this.terrainFileName = terrainFileName;
            this.TerrainTileFile = TerrainTileFile;



            /*  string PreFileName = System.IO.Path.ChangeExtension(terrainFileName, "pre");
             *
             * MapPreFile terrainPreFile = new MapPreFile(MCGExtensions.PathCombine(new string[] { MechCommanderUnity.Instance.MCGPath, "terrain", PreFileName }));
             *
             * var lstPreloadTiles = terrainPreFile.GetLstTileIndex();*/

            string ElvFileName = Path.ChangeExtension(terrainFileName, "elv");

            MapElvFile terrainElvFile = new MapElvFile(MechCommanderUnity.Instance.FileManager.File(MCGExtensions.PathCombine(new string[]
                                                                                                                              { "terrain", ElvFileName })), NumBlocks, NumVertices);

            LstTileIndexes = terrainElvFile.GetDifferentTileIds();



            /*
             * MCBitmap atlas;
             * Dictionary<string, Rect> rects;
             * var result = ImageProcessing.CreateAtlas(LstTiles.Values.ToArray(), out atlas, out rects);
             *
             * if (result)
             * {
             *     UnityMainThreadDispatcher.Instance().Enqueue(() =>
             *     {
             *         var packed = ImageProcessing.MakeTexture2D(ref atlas, pak.Palette);
             *         ImageProcessing.SaveTextureAsPng(packed, "prefiles");
             *     });
             * }
             */
        }