示例#1
0
        public static GridInfo LoadMapData(int mapId)
        {
            string mapPathFull = Map2DUtil.GetMapPathFull(mapId);

            byte[]       source = File.ReadAllBytes(mapPathFull);
            Deserializer reader = new Deserializer(source);

            return(TileMapDeserializer.ReadGrid(reader));
        }
示例#2
0
        public static void SaveLevel(Grid grid, int level)
        {
            bool flag = grid == null;

            if (!flag)
            {
                CheckLoadTileIDMap();
                byte[] array = TileMapSerializer.WriteGrid(grid, new Func <TileBase, ushort>(UnityMap2DUtil.Tile2ID));
                bool   flag2 = array != null;
                if (flag2)
                {
                    File.WriteAllBytes(Map2DUtil.GetMapPathFull(level), array);
                }
            }
        }