/// <summary>
/// A text displayed if the player died
/// </summary>
/// <param name="message"></param>
/// <param name="title"></param>
private void _ShowEndGame(string message = "You have failed in your mission. Better luck next time.", string title = "Game over!")
{
if (_focus is Window)
{
_focus.Dispose();
_interfaceElements.Remove(_focus);
_toolbar.HandleEvent(true, Backend.Events.ContinueGame, 13);
_status = Backend.GameStatus.Running;
}
_status = Backend.GameStatus.GameOver;
// _logic.map.Save("savedroom" + _logic.map.id + ".xml");
Rectangle rect = center(GraphicsDevice.Viewport.Bounds, 500, 150);
Window _gameOver = new Window(this, _spriteBatch, Content, rect);
Statusbox stat;
rect = inner(rect);
if (_logic is PureLogic)
{
_gameOver.AddChild(new Button(_gameOver, _spriteBatch, Content, new Rectangle(rect.Left, rect.Bottom - 40, 80, 32), "New Maps", (int)Backend.Buttons.NewMap));
if (_logic.map.actors[_playerID].lives > 0)
{
_gameOver.AddChild(new Button(_gameOver, _spriteBatch, Content, new Rectangle(rect.Left + 90, rect.Bottom - 40, 150, 32), "Respawn (" + _logic.map.actors[_playerID].lives.ToString() + " left)", (int)Backend.Buttons.Load));
}
bool hasSave = false;
foreach (string dir in Directory.GetDirectories(".\\save"))
{
string tmp = dir.ToLower().Trim();
if (tmp.Substring(tmp.LastIndexOf('\\') + 1) != "auto")
{
hasSave = true;
break;
}
}
if (hasSave)
_gameOver.AddChild(new Button(_gameOver, _spriteBatch, Content, new Rectangle(rect.Right - 215, rect.Bottom - 40, 65, 32), "Restore", (int)Backend.Buttons.Restore));
_gameOver.AddChild(new Button(_gameOver, _spriteBatch, Content, new Rectangle(rect.Right - 140, rect.Bottom - 40, 65, 32), "Restart", (int)Backend.Buttons.Restart));
_gameOver.AddChild(new Button(_gameOver, _spriteBatch, Content, new Rectangle(rect.Right - 65, rect.Bottom - 40, 65, 32), "Quit", (int)Backend.Buttons.Quit));
}
else
{
_gameOver.AddChild(new Button(_gameOver, _spriteBatch, Content, new Rectangle(rect.Left, rect.Bottom - 40, 80, 32), "Resurrect", (int)Backend.Buttons.Load));
_gameOver.AddChild(new Button(_gameOver, _spriteBatch, Content, new Rectangle(rect.Right - 170, rect.Bottom - 40, 80, 32), "Disconnect", (int)Backend.Buttons.Connect));
_gameOver.AddChild(new Button(_gameOver, _spriteBatch, Content, new Rectangle(rect.Right - 80, rect.Bottom - 40, 80, 32), "Quit", (int)Backend.Buttons.Quit));
}
_gameOver.AddChild(stat = new Statusbox(_gameOver, _spriteBatch, Content, center(rect, 450, 200, 0), false, true));
stat.AddLine(title + "\n \n" + message);
_interfaceElements.Add(_gameOver);
_focus = _interfaceElements[_interfaceElements.Count - 1];
}