Пример #1
0
    public static void SaveData(List <HexTile> _hexTiles, string _fileName)
    {
        HexTileListContainer hexTileListContainer = new HexTileListContainer(_hexTiles);
        string jsonString = JsonUtility.ToJson(hexTileListContainer);
        string filePath   = Application.persistentDataPath + "/" + _fileName + ".board";

        File.WriteAllText(filePath, jsonString);
    }
Пример #2
0
    public static List <HexTile> LoadData(string _fileName)
    {
        string filePath   = Application.persistentDataPath + "/" + _fileName + ".board";
        string jsonString = File.ReadAllText(filePath);
        HexTileListContainer hexTileListContainer = JsonUtility.FromJson <HexTileListContainer>(jsonString);

        return(hexTileListContainer.hexTiles);
    }