(e4064088d) Close in-game interfaces when pressing esc. Currently only registered when the mouse is over the interface. Originally I intended to make it so that pressing esc always closes the open interface. But let's test this.

This commit is contained in:
Joonas Rikkonen
2019-03-29 17:23:05 +02:00
parent 817a6100d7
commit ce2131df42
2 changed files with 5 additions and 1 deletions

View File

@@ -200,6 +200,9 @@ namespace Barotrauma
{
public static bool CloseHUD(Rectangle rect)
{
// Always close when hitting escape
if (PlayerInput.KeyHit(Microsoft.Xna.Framework.Input.Keys.Escape)) { return true; }
//don't close when the cursor is on a UI element
if (GUI.MouseOn != null) return false;

View File

@@ -601,8 +601,9 @@ namespace Barotrauma
{
((GUIMessageBox)GUIMessageBox.VisibleBox).Close();
}
else // Otherwise toggle pausing.
else if (GUI.MouseOn == null && Inventory.SelectedSlot == null && CharacterHealth.OpenHealthWindow == null)
{
// Otherwise toggle pausing, unless another window/interface is open.
GUI.TogglePauseMenu();
}
}