diff --git a/rabi_splitter_WPF/RabiRibiDisplay.cs b/rabi_splitter_WPF/RabiRibiDisplay.cs index 0280f07..4ef0d6a 100644 --- a/rabi_splitter_WPF/RabiRibiDisplay.cs +++ b/rabi_splitter_WPF/RabiRibiDisplay.cs @@ -106,6 +106,7 @@ namespace rabi_splitter_WPF if (InGame()) { inGameState.nRestarts++; + UpdateTextFile(); } DebugLog("Reload Game! " + snapshot.playtime + " <- " + inGameState.lastNonZeroPlayTime); } @@ -123,6 +124,7 @@ namespace rabi_splitter_WPF if (InGame()) { inGameState.nDeaths++; + UpdateTextFile(); } DebugLog("Death!"); } @@ -197,6 +199,14 @@ namespace rabi_splitter_WPF } } + private void UpdateTextFile() + { + string text = $"Deaths: {inGameState.nDeaths}\nResets: {inGameState.nRestarts}"; + System.IO.StreamWriter file = new System.IO.StreamWriter("deaths_restarts.txt"); + file.WriteLine(text); + file.Close(); + } + private void StartNewGame() { inGameState = new InGameState();