Show the host/port in the dialogs. Show the failed dialog in the lobby when the server vanishes.

This commit is contained in:
Paul Chote
2011-05-08 16:33:53 +12:00
parent 5c59f7703d
commit fd6c0a90c6
2 changed files with 46 additions and 12 deletions

View File

@@ -88,12 +88,34 @@ namespace OpenRA.Mods.Cnc.Widgets
// Listen for connection failures
void ConnectionStateChanged(OrderManager om)
{
// TODO: Show a connection failed dialog
if (om.Connection.ConnectionState == ConnectionState.NotConnected)
onExit();
//Widget.CloseWindow();
//Widget.OpenWindow("CONNECTION_FAILED_BG", new Dictionary<string, object> { { "orderManager", orderManager } });
{
// Show connection failed dialog
Widget.CloseWindow();
Action onConnect = new Action(() =>
{
Game.OpenWindow("SERVER_LOBBY", new Dictionary<string, object>()
{
{ "onExit", onExit },
{ "onStart", onGameStart }
});
});
Action onRetry = new Action(() =>
{
Widget.CloseWindow();
CncConnectingLogic.Connect(om.Host, om.Port, onConnect, onExit);
});
Widget.OpenWindow("CONNECTIONFAILED_PANEL", new Dictionary<string, object>()
{
{ "onAbort", onExit },
{ "onRetry", onRetry },
{ "host", om.Host },
{ "port", om.Port }
});
}
}
readonly Action onGameStart;