The ordering of job preferences in net lobby are saved in config.xml.

- Added a coroutine which will save the current settings to the config.xml file if no further changes to the preferences are applied after 10 seconds.

-The default ordering is now Engineer, Mechanic, Captain, Security, Doctor and Assistant.
This commit is contained in:
CommanderMark
2017-06-10 22:17:16 -04:00
parent 8886409d56
commit ed5039c43c
5 changed files with 75 additions and 6 deletions
+11 -3
View File
@@ -540,9 +540,12 @@ namespace Barotrauma
int i = 1;
foreach (JobPrefab job in JobPrefab.List)
foreach (string jobName in GameMain.Config.JobNamePreferences)
{
GUITextBlock jobText = new GUITextBlock(new Rectangle(0, 0, 0, 20), i + ". " + job.Name+" ",
JobPrefab job = JobPrefab.List.First(x => x.Name == jobName);
if (job == null) { continue; }
GUITextBlock jobText = new GUITextBlock(new Rectangle(0, 0, 0, 20), i + ". " + job.Name + " ",
"",Alignment.Left, Alignment.Right, jobList, false,
GameMain.GraphicsWidth<1000 ? GUI.SmallFont : GUI.Font);
jobText.UserData = job;
@@ -1199,6 +1202,8 @@ namespace Barotrauma
private void UpdateJobPreferences(GUIListBox listBox)
{
listBox.Deselect();
List<string> jobNamePreferences = new List<string>();
for (int i = 0; i < listBox.children.Count; i++)
{
float a = (float)(i - 1) / 3.0f;
@@ -1210,8 +1215,11 @@ namespace Barotrauma
listBox.children[i].SelectedColor = color;
(listBox.children[i] as GUITextBlock).Text = (i+1) + ". " + (listBox.children[i].UserData as JobPrefab).Name;
jobNamePreferences.Add((listBox.children[i].UserData as JobPrefab).Name);
}
GameMain.Config.JobNamePreferences = jobNamePreferences;
}
public bool TrySelectSub(string subName, string md5Hash, GUIListBox subList)