static public void SaveLevel(Level level) { if (!Directory.Exists(Path.Combine(Application.persistentDataPath, "Levels"))) { Directory.CreateDirectory(Path.Combine(Application.persistentDataPath, "Levels")); } if (level.id == -1) { int id = Random.Range(0, 1000000); string[] paths = Directory.GetFiles(Path.Combine(Application.persistentDataPath, "Levels")); List <string> ids = new List <string>(); for (int i = 0; i < paths.Length; ++i) { ids.Add(Path.GetFileName(paths[i])); } while (!CheckIds(ids, id)) { id = Random.Range(0, 1000000); } level.id = id; } BinarySaveSystem.SaveFile(Path.Combine(Application.persistentDataPath, "Levels", level.id.ToString()), level); LevelManager.instance.ShowSaveLevelMenu(false); LevelManager.instance.ShowSuccessMenu(); }
void SaveAccountFile(string username, string password) { BinarySaveSystem.SaveFile(accountDataPath, new AccountFile(username, password)); }