From f448b6a460d133b46a22c8c8fd69b178cfb54f51 Mon Sep 17 00:00:00 2001 From: wcko87 Date: Fri, 5 May 2017 11:18:53 +0800 Subject: [PATCH] Temp feature: Write deaths/restarts to text file --- rabi_splitter_WPF/RabiRibiDisplay.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) 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();