tidy DirectConnectLogic
This commit is contained in:
@@ -31,9 +31,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
|||||||
|
|
||||||
panel.GetWidget<ButtonWidget>("JOIN_BUTTON").OnClick = () =>
|
panel.GetWidget<ButtonWidget>("JOIN_BUTTON").OnClick = () =>
|
||||||
{
|
{
|
||||||
int port;
|
var port = Exts.WithDefault(1234, () => int.Parse(portField.Text));
|
||||||
if (!int.TryParse(portField.Text, out port))
|
|
||||||
port = 1234;
|
|
||||||
|
|
||||||
Game.Settings.Player.LastServer = "{0}:{1}".F(ipField.Text, port);
|
Game.Settings.Player.LastServer = "{0}:{1}".F(ipField.Text, port);
|
||||||
Game.Settings.Save();
|
Game.Settings.Save();
|
||||||
|
|||||||
@@ -29,9 +29,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
if (addressParts.Length < 1 || addressParts.Length > 2)
|
if (addressParts.Length < 1 || addressParts.Length > 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int port;
|
var port = Exts.WithDefault(1234, () => int.Parse(addressParts[1]));
|
||||||
if (addressParts.Length != 2 || !int.TryParse(addressParts[1], out port))
|
|
||||||
port = 1234;
|
|
||||||
|
|
||||||
Game.Settings.Player.LastServer = address;
|
Game.Settings.Player.LastServer = address;
|
||||||
Game.Settings.Save();
|
Game.Settings.Save();
|
||||||
|
|||||||
Reference in New Issue
Block a user