Added functionality to main menu
This commit is contained in:
1 parent
4fe2965a09
commit
ffd9371b2a
5 files changed
+613
-104
No files matched your search
@@ -53,7 +53,7 @@ namespace Fruitomation.Game
|
||||
Buildings = buildings.ToArray();
|
||||
}
|
||||
|
||||
private static string Filepath => Path.Combine(Application.persistentDataPath, "buildings.json");
|
||||
public static string Filepath => Path.Combine(Application.persistentDataPath, "buildings.json");
|
||||
|
||||
private bool[,] InhabitedCells { get; } = new bool[96, 49];
|
||||
private List<Building> Buildings { get; } = new();
|
||||
@@ -84,6 +84,11 @@ namespace Fruitomation.Game
|
||||
}
|
||||
|
||||
string json = File.ReadAllText(Filepath);
|
||||
if (json == "")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SerializedBuilding[] buildings = JsonUtility.FromJson<SerializedBuildings>(json).Get();
|
||||
|
||||
foreach (SerializedBuilding building in buildings)
|
||||
@@ -129,7 +134,7 @@ namespace Fruitomation.Game
|
||||
string json = JsonUtility.ToJson(new SerializedBuildings(serialized), true);
|
||||
File.WriteAllText(Filepath, json);
|
||||
}
|
||||
|
||||
|
||||
public void RemoveBuilding(Building building)
|
||||
{
|
||||
Buildings.Remove(building);
|
||||
|
||||
Reference in new issue
Block a user