Merge branch 'master' into dedicated-server

# Conflicts:
#	BarotraumaClient/Source/GameSettings.cs
#	BarotraumaClient/Source/Screens/NetLobbyScreen.cs
This commit is contained in:
juanjp600
2017-06-23 10:21:02 -03:00
16 changed files with 288 additions and 92 deletions
+58 -8
View File
@@ -18,7 +18,17 @@ namespace Barotrauma
{
private GUIFrame settingsFrame;
private GUIButton applyButton;
private float soundVolume, musicVolume;
private WindowMode windowMode;
public List<string> jobNamePreferences;
private KeyOrMouse[] keyMapping;
private bool unsavedSettings;
public GUIFrame SettingsFrame
{
get
@@ -28,12 +38,6 @@ namespace Barotrauma
}
}
private float soundVolume, musicVolume;
private WindowMode windowMode;
private KeyOrMouse[] keyMapping;
public KeyOrMouse KeyBind(InputType inputType)
{
return keyMapping[(int)inputType];
@@ -53,9 +57,20 @@ namespace Barotrauma
get { return windowMode; }
set { windowMode = value; }
}
public List<string> JobNamePreferences
{
get { return jobNamePreferences; }
set
{
// Begin saving coroutine. Remove any existing save coroutines if one is running.
if (CoroutineManager.IsCoroutineRunning("saveCoroutine")) { CoroutineManager.StopCoroutines("saveCoroutine"); }
CoroutineManager.StartCoroutine(ApplyUnsavedChanges(), "saveCoroutine");
private bool unsavedSettings;
jobNamePreferences = value;
}
}
public bool UnsavedSettings
{
get
@@ -65,6 +80,7 @@ namespace Barotrauma
private set
{
unsavedSettings = value;
if (applyButton != null)
{
//applyButton.Selected = unsavedSettings;
@@ -100,7 +116,16 @@ namespace Barotrauma
{
GraphicsWidth = 1024;
GraphicsHeight = 678;
MasterServerUrl = "";
SelectedContentPackage = ContentPackage.list.Any() ? ContentPackage.list[0] : new ContentPackage("");
JobNamePreferences = new List<string>();
foreach (JobPrefab job in JobPrefab.List)
{
JobNamePreferences.Add(job.Name);
}
return;
}
@@ -170,6 +195,13 @@ namespace Barotrauma
}
}
break;
case "gameplay":
JobNamePreferences = new List<string>();
foreach (XElement ele in subElement.Element("jobpreferences").Elements("job"))
{
JobNamePreferences.Add(ToolBox.GetAttributeString(ele, "name", ""));
}
break;
}
}
@@ -253,6 +285,17 @@ namespace Barotrauma
}
var gameplay = new XElement("gameplay");
var jobPreferences = new XElement("jobpreferences");
foreach (string jobName in JobNamePreferences)
{
jobPreferences.Add(new XElement("job", new XAttribute("name", jobName)));
}
gameplay.Add(jobPreferences);
doc.Root.Add(gameplay);
doc.Save(filePath);
}
@@ -462,6 +505,13 @@ namespace Barotrauma
yield return CoroutineStatus.Success;
}
private IEnumerable<object> ApplyUnsavedChanges()
{
yield return new WaitForSeconds(10.0f);
Save("config.xml");
}
private bool ApplyClicked(GUIButton button, object userData)
{
Save("config.xml");