diff --git a/OpenRA.Game/Network/OrderManager.cs b/OpenRA.Game/Network/OrderManager.cs index 624bbd2a35..55dbb7f15e 100755 --- a/OpenRA.Game/Network/OrderManager.cs +++ b/OpenRA.Game/Network/OrderManager.cs @@ -27,7 +27,7 @@ namespace OpenRA.Network public readonly string Host; public readonly int Port; - public string ServerError; + public string ServerError = "Server is not responding."; public int NetFrameNumber { get; private set; } public int LocalFrameNumber; diff --git a/OpenRA.Mods.RA/Widgets/Logic/ConnectionLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/ConnectionLogic.cs index 43ed14b4d0..e865618b3c 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/ConnectionLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/ConnectionLogic.cs @@ -17,8 +17,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic public class ConnectionLogic { Action onConnect, onRetry, onAbort; - string host; - int port; void ConnectionStateChanged(OrderManager om) { @@ -29,14 +27,12 @@ namespace OpenRA.Mods.RA.Widgets.Logic } else if (om.Connection.ConnectionState == ConnectionState.NotConnected) { - // Show connection failed dialog CloseWindow(); Ui.OpenWindow("CONNECTIONFAILED_PANEL", new WidgetArgs() { + { "orderManager", om }, { "onAbort", onAbort }, - { "onRetry", onRetry }, - { "host", host }, - { "port", port } + { "onRetry", onRetry } }); } } @@ -50,8 +46,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic [ObjectCreator.UseCtor] public ConnectionLogic(Widget widget, string host, int port, Action onConnect, Action onRetry, Action onAbort) { - this.host = host; - this.port = port; this.onConnect = onConnect; this.onRetry = onRetry; this.onAbort = onAbort; @@ -82,14 +76,14 @@ namespace OpenRA.Mods.RA.Widgets.Logic public class ConnectionFailedLogic { [ObjectCreator.UseCtor] - public ConnectionFailedLogic(Widget widget, string host, int port, Action onRetry, Action onAbort) + public ConnectionFailedLogic(Widget widget, OrderManager orderManager, Action onRetry, Action onAbort) { var panel = widget; panel.Get("ABORT_BUTTON").OnClick = () => { Ui.CloseWindow(); onAbort(); }; panel.Get("RETRY_BUTTON").OnClick = () => { Ui.CloseWindow(); onRetry(); }; widget.Get("CONNECTING_DESC").GetText = () => - "Could not connect to {0}:{1}".F(host, port); + "Could not connect to {0}:{1}\n{2}".F(orderManager.Host, orderManager.Port, orderManager.ServerError); } } } \ No newline at end of file diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs index 42056810d9..5c69d4a6d0 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs @@ -63,10 +63,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic Ui.OpenWindow("CONNECTIONFAILED_PANEL", new WidgetArgs() { + { "orderManager", om }, { "onAbort", onExit }, - { "onRetry", onRetry }, - { "host", om.Host }, - { "port", om.Port } + { "onRetry", onRetry } }); } }