Example #1
0
    private void LoadRecipes()
    {
        var path = $"{Application.persistentDataPath}/recipes.dat";

        if (File.Exists(path))
        {
            discoveredRecipes.ints = BinaryIO.ReadFile <List <int> >(path);
        }
    }
Example #2
0
 private void LoadInventories()
 {
     for (int i = 0; i < inventories.Length; i++)
     {
         var path = $"{Application.persistentDataPath}/{i}.inv";
         if (File.Exists(path))
         {
             inventories[i].value = BinaryIO.ReadFile <SerializableInventory>(path).Deserialize(itemDB);
         }
     }
 }
Example #3
0
    public void LoadScriptables()
    {
        LoadRecipes();
        LoadInventories();

        for (int i = 0; i < objects.Count; i++)
        {
            var objPath = Application.persistentDataPath + string.Format("/{0}.json", i);
            if (File.Exists(objPath))
            {
                var json = BinaryIO.ReadFile <string>(objPath);
                JsonUtility.FromJsonOverwrite(json, objects[i]);
            }
        }
    }