From cc6e2206916ab7d31ee454367eccd64f585f4552 Mon Sep 17 00:00:00 2001 From: CommanderMark Date: Sat, 10 Jun 2017 23:24:24 -0400 Subject: [PATCH] Moved the execution of the save coroutine to JobNamePreferences' setter. Juanjp pointed out that it would run the coroutine if you modified changes in the settings without yet pressing "Apply". Also reworded the job descriptions. --- Barotrauma/Content/Jobs.xml | 10 +++++----- Barotrauma/Source/GameSettings.cs | 15 ++++++++------- Barotrauma/Source/Screens/NetLobbyScreen.cs | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Barotrauma/Content/Jobs.xml b/Barotrauma/Content/Jobs.xml index 86b9ab96c..0b98e6c24 100644 --- a/Barotrauma/Content/Jobs.xml +++ b/Barotrauma/Content/Jobs.xml @@ -1,6 +1,6 @@  - + @@ -18,7 +18,7 @@ - + @@ -36,7 +36,7 @@ - + @@ -54,7 +54,7 @@ - + @@ -74,7 +74,7 @@ - + diff --git a/Barotrauma/Source/GameSettings.cs b/Barotrauma/Source/GameSettings.cs index 7f969eb44..c032645d5 100644 --- a/Barotrauma/Source/GameSettings.cs +++ b/Barotrauma/Source/GameSettings.cs @@ -61,7 +61,14 @@ namespace Barotrauma public List JobNamePreferences { get { return jobNamePreferences; } - set { UnsavedSettings = true; jobNamePreferences = value; } + set + { + // Begin saving coroutine. Remove any existing save coroutines if one is running. + if (CoroutineManager.IsCoroutineRunning("saveCoroutine")) { CoroutineManager.StopCoroutines("saveCoroutine"); } + CoroutineManager.StartCoroutine(ApplyUnsavedChanges(), "saveCoroutine"); + + jobNamePreferences = value; + } } public string MasterServerUrl { get; set; } @@ -81,12 +88,6 @@ namespace Barotrauma private set { unsavedSettings = value; - // Beging saving coroutine. Remove any existing save coroutines if one is running. - if (CoroutineManager.IsCoroutineRunning("saveCoroutine")) { CoroutineManager.StopCoroutines("saveCoroutine"); } - if (unsavedSettings == true) - { - CoroutineManager.StartCoroutine(ApplyUnsavedChanges(), "saveCoroutine"); - } if (applyButton != null) { diff --git a/Barotrauma/Source/Screens/NetLobbyScreen.cs b/Barotrauma/Source/Screens/NetLobbyScreen.cs index fb77c397a..8d1ea20ff 100644 --- a/Barotrauma/Source/Screens/NetLobbyScreen.cs +++ b/Barotrauma/Source/Screens/NetLobbyScreen.cs @@ -546,7 +546,7 @@ namespace Barotrauma if (job == null) { continue; } GUITextBlock jobText = new GUITextBlock(new Rectangle(0, 0, 0, 20), i + ". " + job.Name + " ", - "",Alignment.Left, Alignment.Right, jobList, false, + "", Alignment.Left, Alignment.Right, jobList, false, GameMain.GraphicsWidth<1000 ? GUI.SmallFont : GUI.Font); jobText.UserData = job;