public void addToList(string mapName) { currentMapList.Add(mapName); listOfMapsSave mapSave = new listOfMapsSave(currentMapList); saveList(mapSave); }
public void deleteLast() { int i = currentMapList.Count - 1; currentMapList.RemoveAt(i); listOfMapsSave mapSave = new listOfMapsSave(currentMapList); saveList(mapSave); }
public void saveList(listOfMapsSave save) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(Application.persistentDataPath + "listOfMaps_saveFile.save"); bf.Serialize(file, save); file.Close(); Debug.Log("Game Saved"); }
public void loadList() { if (!File.Exists(Application.persistentDataPath + "listOfMaps_saveFile.save")) { return; } BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "listOfMaps_saveFile.save", FileMode.Open); listOfMapsSave save = (listOfMapsSave)bf.Deserialize(file); currentMapList = save.listOfMaps; file.Close(); }