don't crash on in-game connection loss either
This commit is contained in:
@@ -217,6 +217,9 @@ namespace OpenRa
|
||||
var r = new Rectangle((Game.viewport.Width - w) / 2, (Game.viewport.Height - h) / 2, w, h);
|
||||
DrawDialogBackground(r, optionsSprites, true);
|
||||
DrawCentered(text, new int2(Game.viewport.Width / 2, Game.viewport.Height / 2 - 8), Color.White);
|
||||
|
||||
// don't allow clicks through the dialog
|
||||
AddButton(r, _ => { });
|
||||
}
|
||||
|
||||
public void DrawLobby()
|
||||
@@ -260,6 +263,9 @@ namespace OpenRa
|
||||
DrawDialogBackground(chatBox, panelSprites, false);
|
||||
|
||||
DrawChat(typingBox, chatBox);
|
||||
|
||||
// block clicks `through` the dialog
|
||||
AddButton(r, _ => { });
|
||||
}
|
||||
|
||||
public void TickRadarAnimation()
|
||||
|
||||
@@ -53,6 +53,10 @@ namespace OpenRa.Graphics
|
||||
{
|
||||
Game.world.WorldRenderer.Draw();
|
||||
Game.chrome.Draw();
|
||||
|
||||
if (Game.orderManager.IsNetplay &&
|
||||
Game.orderManager.Sources.OfType<NetworkOrderSource>().First().State == ConnectionState.NotConnected)
|
||||
Game.chrome.DrawDialog("Connection lost.");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -64,7 +68,7 @@ namespace OpenRa.Graphics
|
||||
switch (nos.State)
|
||||
{
|
||||
case ConnectionState.Connecting:
|
||||
Game.chrome.DrawDialog("Connecting to {0}:{1}".F( Game.Settings.NetworkHost, Game.Settings.NetworkPort ));
|
||||
Game.chrome.DrawDialog("Connecting to {0}:{1}...".F( Game.Settings.NetworkHost, Game.Settings.NetworkPort ));
|
||||
break;
|
||||
case ConnectionState.NotConnected:
|
||||
Game.chrome.DrawDialog("Connection failed.");
|
||||
|
||||
@@ -42,6 +42,8 @@ namespace OpenRa.Orders
|
||||
{
|
||||
var reader = new BinaryReader(socket.GetStream());
|
||||
|
||||
try
|
||||
{
|
||||
for (; ; )
|
||||
{
|
||||
var len = reader.ReadInt32();
|
||||
@@ -62,6 +64,12 @@ namespace OpenRa.Orders
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
State = ConnectionState.NotConnected;
|
||||
}
|
||||
|
||||
}) { IsBackground = true }.Start();
|
||||
}
|
||||
catch
|
||||
|
||||
Reference in New Issue
Block a user