Пример #1
0
        static void Main(string[] args)
        {
            TileMap tileMap = new TileMap(10, 10);
              //string[] spriteSheets = new string[1];
              //spriteSheets[0] = "FirstGame - Girl Farmer";
              //tileMap.SpriteSheets = spriteSheets;
              tileMap.SpriteSheets.Add("FirstGame - Girl Farmer");
              TileMap.WriteToFile("test.json", tileMap);

              string fromFile = File.ReadAllText("test.json");
              System.Console.WriteLine(fromFile);

              TileMap readMap = TileMap.ReadFromFile("test.json");
              if (readMap != null) {
            System.Console.WriteLine(readMap.SpriteSheets[0]);
              }
        }
Пример #2
0
        public static void WriteToFile(string outputPath, TileMap tileMap)
        {
            string serTileMap = JsonConvert.SerializeObject(tileMap);

            File.WriteAllText(outputPath, serTileMap);
        }
Пример #3
0
 public static void WriteToFile(string outputPath, TileMap tileMap)
 {
     string serTileMap = JsonConvert.SerializeObject(tileMap);
     File.WriteAllText(outputPath, serTileMap);
 }