public void loaddetails() { saveFile data = SaveSystem.LoadFile(); val = data.valueee; textt.GetComponent <Text>().text = val.ToString(); }
public void loadData() { saveFile data = saveSystem.loadData(); if (data == null) { } else { playerlevel = data.playerlevel; playerMoney = data.playerMoney; currentXP = data.currentXP; targetXP = data.targetXP; highScore = data.highScore; totalEnemiesDestroyed = data.totalEnemiesDestroyed; totalScore = data.totalScore; totalGamesPlayed = data.totalGamesPlayed; totalXP = data.totalXP; totalHighScores = data.totalHighScores; gameVolume = data.gameVolume; //Endless progress completedEndlessLevel1 = data.completedEndlessLevel1; completedEndlessLevel2 = data.completedEndlessLevel2; completedEndlessLevel3 = data.completedEndlessLevel3; completedEndlessLevel4 = data.completedEndlessLevel4; completedEndlessLevel5 = data.completedEndlessLevel5; //Survival progress completedSurvivalLevel1 = data.completedSurvivalLevel1; completedSurvivalLevel2 = data.completedSurvivalLevel2; completedSurvivalLevel3 = data.completedSurvivalLevel3; completedSurvivalLevel4 = data.completedSurvivalLevel4; completedSurvivalLevel5 = data.completedSurvivalLevel5; //Elimination progress completedEliminationLevel1 = data.completedEliminationLevel1; completedEliminationLevel2 = data.completedEliminationLevel2; completedEliminationLevel3 = data.completedEliminationLevel3; completedEliminationLevel4 = data.completedEliminationLevel4; completedEliminationLevel5 = data.completedEliminationLevel5; //Skin Unlocks skin1Unlocked = data.skin1Unlocked; skin2Unlocked = data.skin2Unlocked; skin3Unlocked = data.skin3Unlocked; skin4Unlocked = data.skin4Unlocked; skin5Unlocked = data.skin5Unlocked; skin6Unlocked = data.skin6Unlocked; skin7Unlocked = data.skin7Unlocked; skin8Unlocked = data.skin8Unlocked; skin9Unlocked = data.skin9Unlocked; skin10Unlocked = data.skin10Unlocked; skinCount = data.skinCount; skinOfChoice = data.skinOfChoice; } }
public static void saveData(Game_Data Game_Data) { BinaryFormatter formatter = new BinaryFormatter(); string path = Application.persistentDataPath + "/gameData.Sav"; // sets save path relative to correct base destination FileStream stream = new FileStream(path, FileMode.Create); saveFile File = new saveFile(Game_Data); // creates a new save file using current game data as input for the file formatter.Serialize(stream, File); stream.Close(); }
public static void SaveFile(increee i) { BinaryFormatter formatter = new BinaryFormatter(); string path = Application.persistentDataPath + "/player.txt"; FileStream stream = new FileStream(path, FileMode.Create); saveFile data = new saveFile(i); formatter.Serialize(stream, data); stream.Close(); }
public static void Save() { BinaryFormatter bf = new BinaryFormatter(); //Application.persistentDataPath is a string, so if you wanted you can put that into debug.log if you want to know where save games are located FileStream file = File.Create(Application.persistentDataPath + data); //you can call it anything you want saveFile sf = new saveFile(); sf.LevelsComplete = LevelsComplete; sf.LevelsUnlocked = LevelsUnlocked; sf.WeaponsUnlocked = WeaponsUnlocked; sf.Score = Score; bf.Serialize(file, sf); file.Close(); }
public static void Load() { if (File.Exists(Application.persistentDataPath + data)) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + data, FileMode.Open); saveFile sf = (saveFile)bf.Deserialize(file); file.Close(); LevelsUnlocked = sf.LevelsUnlocked; LevelsComplete = sf.LevelsComplete; WeaponsUnlocked = sf.WeaponsUnlocked; if (sf.Score != null) Score = sf.Score; else Score = new int[28]; } }
public static saveFile loadData() { string path = Application.persistentDataPath + "/gameData.Sav"; if (File.Exists(path)) { BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Open); saveFile File = formatter.Deserialize(stream) as saveFile; stream.Close(); return(File); } else // error handling { Debug.LogError("Save file to load not found"); return(null); } }
public static saveFile LoadFile() { string path = Application.persistentDataPath + "/player.txt"; if (File.Exists(path)) { BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Open); saveFile data = formatter.Deserialize(stream) as saveFile; stream.Close(); return(data); } else { Debug.LogError("NO FILE FOUND!" + path); return(null); } }