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