display the last ServerError in the connection failed dialog
closes #2727
This commit is contained in:
@@ -27,7 +27,7 @@ namespace OpenRA.Network
|
|||||||
|
|
||||||
public readonly string Host;
|
public readonly string Host;
|
||||||
public readonly int Port;
|
public readonly int Port;
|
||||||
public string ServerError;
|
public string ServerError = "Server is not responding.";
|
||||||
|
|
||||||
public int NetFrameNumber { get; private set; }
|
public int NetFrameNumber { get; private set; }
|
||||||
public int LocalFrameNumber;
|
public int LocalFrameNumber;
|
||||||
|
|||||||
@@ -17,8 +17,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
public class ConnectionLogic
|
public class ConnectionLogic
|
||||||
{
|
{
|
||||||
Action onConnect, onRetry, onAbort;
|
Action onConnect, onRetry, onAbort;
|
||||||
string host;
|
|
||||||
int port;
|
|
||||||
|
|
||||||
void ConnectionStateChanged(OrderManager om)
|
void ConnectionStateChanged(OrderManager om)
|
||||||
{
|
{
|
||||||
@@ -29,14 +27,12 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
}
|
}
|
||||||
else if (om.Connection.ConnectionState == ConnectionState.NotConnected)
|
else if (om.Connection.ConnectionState == ConnectionState.NotConnected)
|
||||||
{
|
{
|
||||||
// Show connection failed dialog
|
|
||||||
CloseWindow();
|
CloseWindow();
|
||||||
Ui.OpenWindow("CONNECTIONFAILED_PANEL", new WidgetArgs()
|
Ui.OpenWindow("CONNECTIONFAILED_PANEL", new WidgetArgs()
|
||||||
{
|
{
|
||||||
|
{ "orderManager", om },
|
||||||
{ "onAbort", onAbort },
|
{ "onAbort", onAbort },
|
||||||
{ "onRetry", onRetry },
|
{ "onRetry", onRetry }
|
||||||
{ "host", host },
|
|
||||||
{ "port", port }
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -50,8 +46,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public ConnectionLogic(Widget widget, string host, int port, Action onConnect, Action onRetry, Action onAbort)
|
public ConnectionLogic(Widget widget, string host, int port, Action onConnect, Action onRetry, Action onAbort)
|
||||||
{
|
{
|
||||||
this.host = host;
|
|
||||||
this.port = port;
|
|
||||||
this.onConnect = onConnect;
|
this.onConnect = onConnect;
|
||||||
this.onRetry = onRetry;
|
this.onRetry = onRetry;
|
||||||
this.onAbort = onAbort;
|
this.onAbort = onAbort;
|
||||||
@@ -82,14 +76,14 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
public class ConnectionFailedLogic
|
public class ConnectionFailedLogic
|
||||||
{
|
{
|
||||||
[ObjectCreator.UseCtor]
|
[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;
|
var panel = widget;
|
||||||
panel.Get<ButtonWidget>("ABORT_BUTTON").OnClick = () => { Ui.CloseWindow(); onAbort(); };
|
panel.Get<ButtonWidget>("ABORT_BUTTON").OnClick = () => { Ui.CloseWindow(); onAbort(); };
|
||||||
panel.Get<ButtonWidget>("RETRY_BUTTON").OnClick = () => { Ui.CloseWindow(); onRetry(); };
|
panel.Get<ButtonWidget>("RETRY_BUTTON").OnClick = () => { Ui.CloseWindow(); onRetry(); };
|
||||||
|
|
||||||
widget.Get<LabelWidget>("CONNECTING_DESC").GetText = () =>
|
widget.Get<LabelWidget>("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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,10 +63,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
|
|
||||||
Ui.OpenWindow("CONNECTIONFAILED_PANEL", new WidgetArgs()
|
Ui.OpenWindow("CONNECTIONFAILED_PANEL", new WidgetArgs()
|
||||||
{
|
{
|
||||||
|
{ "orderManager", om },
|
||||||
{ "onAbort", onExit },
|
{ "onAbort", onExit },
|
||||||
{ "onRetry", onRetry },
|
{ "onRetry", onRetry }
|
||||||
{ "host", om.Host },
|
|
||||||
{ "port", om.Port }
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user