public void SetStats() { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(configFile); DataForSave data = new DataForSave(); //data.MaxScore = MaxScore; data.StatusUISequence = StatusUISequence; data.isGameOver = isGameOver; data.isGoodEnding = isGoodEnding; data.playerScore = playerScore; bf.Serialize(file, data); file.Close(); }
public void GetStats() { if (File.Exists(configFile)) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(configFile, FileMode.Open); DataForSave data = (DataForSave)bf.Deserialize(file); //MaxScore = data.MaxScore; StatusUISequence = data.StatusUISequence; isGameOver = data.isGameOver; isGoodEnding = data.isGoodEnding; playerScore = data.playerScore; file.Close(); } else { StatusUISequence = true; } }