Client name is saved in config.xml (no need to re-enter every time you start the game). Closes #224
This commit is contained in:
@@ -61,6 +61,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 30, 0, 30), TextManager.Get("YourName"), "", menu);
|
new GUITextBlock(new Rectangle(0, 30, 0, 30), TextManager.Get("YourName"), "", menu);
|
||||||
clientNameBox = new GUITextBox(new Rectangle(0, 60, 200, 30), "", menu);
|
clientNameBox = new GUITextBox(new Rectangle(0, 60, 200, 30), "", menu);
|
||||||
|
clientNameBox.Text = GameMain.Config.DefaultPlayerName;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 100, 0, 30), TextManager.Get("ServerIP"), "", menu);
|
new GUITextBlock(new Rectangle(0, 100, 0, 30), TextManager.Get("ServerIP"), "", menu);
|
||||||
ipBox = new GUITextBox(new Rectangle(0, 130, 200, 30), "", menu);
|
ipBox = new GUITextBox(new Rectangle(0, 130, 200, 30), "", menu);
|
||||||
@@ -348,6 +349,8 @@ namespace Barotrauma
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GameMain.Config.DefaultPlayerName = clientNameBox.Text;
|
||||||
|
|
||||||
string ip = ipBox.Text;
|
string ip = ipBox.Text;
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(ip))
|
if (string.IsNullOrWhiteSpace(ip))
|
||||||
@@ -358,7 +361,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
CoroutineManager.StartCoroutine(ConnectToServer(ip));
|
CoroutineManager.StartCoroutine(ConnectToServer(ip));
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -105,6 +105,23 @@ namespace Barotrauma
|
|||||||
public bool AutoCheckUpdates { get; set; }
|
public bool AutoCheckUpdates { get; set; }
|
||||||
public bool WasGameUpdated { get; set; }
|
public bool WasGameUpdated { get; set; }
|
||||||
|
|
||||||
|
private string defaultPlayerName;
|
||||||
|
public string DefaultPlayerName
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return defaultPlayerName;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (defaultPlayerName != value)
|
||||||
|
{
|
||||||
|
defaultPlayerName = value;
|
||||||
|
Save("config.xml");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static bool VerboseLogging { get; set; }
|
public static bool VerboseLogging { get; set; }
|
||||||
|
|
||||||
public GameSettings(string filePath)
|
public GameSettings(string filePath)
|
||||||
@@ -217,6 +234,9 @@ namespace Barotrauma
|
|||||||
JobNamePreferences.Add(ele.GetAttributeString("name", ""));
|
JobNamePreferences.Add(ele.GetAttributeString("name", ""));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "player":
|
||||||
|
defaultPlayerName = subElement.GetAttributeString("name", "");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,21 +330,21 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
keyMappingElement.Add(new XAttribute(((InputType)i).ToString(), keyMapping[i].MouseButton));
|
keyMappingElement.Add(new XAttribute(((InputType)i).ToString(), keyMapping[i].MouseButton));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var gameplay = new XElement("gameplay");
|
var gameplay = new XElement("gameplay");
|
||||||
|
|
||||||
var jobPreferences = new XElement("jobpreferences");
|
var jobPreferences = new XElement("jobpreferences");
|
||||||
foreach (string jobName in JobNamePreferences)
|
foreach (string jobName in JobNamePreferences)
|
||||||
{
|
{
|
||||||
jobPreferences.Add(new XElement("job", new XAttribute("name", jobName)));
|
jobPreferences.Add(new XElement("job", new XAttribute("name", jobName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
gameplay.Add(jobPreferences);
|
gameplay.Add(jobPreferences);
|
||||||
doc.Root.Add(gameplay);
|
doc.Root.Add(gameplay);
|
||||||
|
|
||||||
|
var playerElement = new XElement("player");
|
||||||
|
playerElement.Add(new XAttribute("name", defaultPlayerName));
|
||||||
|
doc.Root.Add(playerElement);
|
||||||
|
|
||||||
doc.Save(filePath);
|
doc.Save(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<config masterserverurl="http://www.undertowgames.com/baromaster" autocheckupdates="true" musicvolume="0.5" soundvolume="0.5" verboselogging="false">
|
<config masterserverurl="http://www.undertowgames.com/baromaster" autocheckupdates="true" musicvolume="0.5" soundvolume="0.5" verboselogging="false">
|
||||||
<graphicsmode fullscreen="true" vsync="true" />
|
<graphicsmode fullscreen="true" vsync="true" />
|
||||||
<contentpackage path="Data/ContentPackages/Vanilla 0.7.xml" />
|
<contentpackage path="Data/ContentPackages/Vanilla 0.7.xml" />
|
||||||
|
<player name=""/>
|
||||||
<keymapping Select="E" Use="0" Aim="1" Up="W" Down="S" Left="A" Right="D" Attack="R" Run="LeftShift" Crouch="LeftControl" Chat="Tab" RadioChat="OemTilde" CrewOrders="C" Ragdoll="Space" /> />
|
<keymapping Select="E" Use="0" Aim="1" Up="W" Down="S" Left="A" Right="D" Attack="R" Run="LeftShift" Crouch="LeftControl" Chat="Tab" RadioChat="OemTilde" CrewOrders="C" Ragdoll="Space" /> />
|
||||||
<gameplay>
|
<gameplay>
|
||||||
<jobpreferences>
|
<jobpreferences>
|
||||||
|
|||||||
Reference in New Issue
Block a user