//Biggie is the filename that saves the highscores private void saveBiggie() { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(Application.persistentDataPath + "/biff.dat"); biggieData data = new biggieData(); data.setPlayerScore(scores); data.setPlayerName(names); bf.Serialize(file, data); file.Close(); }
//Biggie is the filename that saves the highscores private void loadBiggie() { if (File.Exists(Application.persistentDataPath + "/biff.dat")) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/biff.dat", FileMode.Open); biggieData data = (biggieData)bf.Deserialize(file); file.Close(); data.getPlayerScore().CopyTo(scores, 0); data.getPlayerName().CopyTo(names, 0); } }
//Biggie is the filename that saves the highscores private void resetBiggie() { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(Application.persistentDataPath + "/biff.dat"); biggieData data = new biggieData(); String[] n = new string[10]; int[] s = new int[10]; for (int i = 0; i < 10; i++) { n [i] = " "; s[i] = 0; } data.setPlayerScore(s); data.setPlayerName(n); bf.Serialize(file, data); file.Close(); }