From 827f54fcffab5bcad27555eee9229f635926d697 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Thu, 23 May 2019 15:10:38 +0300 Subject: [PATCH] (a13c74ce0) Fixed: Loading screen dismissable & escape usable when the game is not active --- .../BarotraumaClient/Source/GameMain.cs | 4 +- .../GameModes/Tutorials/MechanicTutorial.cs | 46 +++++++++---------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Barotrauma/BarotraumaClient/Source/GameMain.cs b/Barotrauma/BarotraumaClient/Source/GameMain.cs index a7e1de746..ee67bb654 100644 --- a/Barotrauma/BarotraumaClient/Source/GameMain.cs +++ b/Barotrauma/BarotraumaClient/Source/GameMain.cs @@ -618,7 +618,7 @@ namespace Barotrauma GameMain.ResetFrameTime(); if (TitleScreen.LoadState >= 100.0f && - (!waitForKeyHit || PlayerInput.GetKeyboardState.GetPressedKeys().Length>0 || PlayerInput.LeftButtonClicked())) + (!waitForKeyHit || ((PlayerInput.GetKeyboardState.GetPressedKeys().Length > 0 || PlayerInput.LeftButtonClicked()) && WindowActive))) { loadingScreenOpen = false; } @@ -637,7 +637,7 @@ namespace Barotrauma { SoundPlayer.Update((float)Timing.Step); - if (PlayerInput.KeyHit(Keys.Escape)) + if (PlayerInput.KeyHit(Keys.Escape) && WindowActive) { // Check if a text input is selected. if (GUI.KeyboardDispatcher.Subscriber != null) diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/MechanicTutorial.cs b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/MechanicTutorial.cs index fd85d1bc0..412b8c595 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/MechanicTutorial.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/MechanicTutorial.cs @@ -365,34 +365,11 @@ namespace Barotrauma.Tutorials } while (mechanic.Inventory.FindItemByIdentifier("oxygentank") == null || mechanic.Inventory.FindItemByIdentifier("sodium") == null); // Wait until looted yield return new WaitForSeconds(1.0f, false); SetHighlight(mechanic_craftingCabinet.Item, false); - SetHighlight(mechanic_deconstructor.Item, true); - do { if (IsSelectedItem(mechanic_deconstructor.Item)) { - if (mechanic.Inventory.FindItemByIdentifier("oxygentank") != null) - { - HighlightInventorySlot(mechanic.Inventory, "oxygentank", highlightColor, .5f, .5f, 0f); - - if (mechanic_deconstructor.InputContainer.Inventory.slots != null) - { - for (int i = 0; i < mechanic_deconstructor.InputContainer.Inventory.slots.Length; i++) - { - HighlightInventorySlot(mechanic_deconstructor.InputContainer.Inventory, i, highlightColor, .5f, .5f, 0f); - } - } - } - - if (mechanic_deconstructor.InputContainer.Inventory.FindItemByIdentifier("oxygentank") != null && !mechanic_deconstructor.IsActive) - { - if (mechanic_deconstructor.ActivateButton.Frame.FlashTimer <= 0) - { - mechanic_deconstructor.ActivateButton.Frame.Flash(highlightColor, 1.5f, false); - } - } - if (mechanic_deconstructor.OutputContainer.Inventory.FindItemByIdentifier("aluminium") != null) { HighlightInventorySlot(mechanic_deconstructor.OutputContainer.Inventory, "aluminium", highlightColor, .5f, .5f, 0f); @@ -402,6 +379,29 @@ namespace Barotrauma.Tutorials if (mechanic.Inventory.Items[i] == null) HighlightInventorySlot(mechanic.Inventory, i, highlightColor, .5f, .5f, 0f); } } + else + { + if (mechanic.Inventory.FindItemByIdentifier("oxygentank") != null && mechanic_deconstructor.InputContainer.Inventory.FindItemByIdentifier("oxygentank") == null) + { + HighlightInventorySlot(mechanic.Inventory, "oxygentank", highlightColor, .5f, .5f, 0f); + + if (mechanic_deconstructor.InputContainer.Inventory.slots != null) + { + for (int i = 0; i < mechanic_deconstructor.InputContainer.Inventory.slots.Length; i++) + { + HighlightInventorySlot(mechanic_deconstructor.InputContainer.Inventory, i, highlightColor, .5f, .5f, 0f); + } + } + } + + if (mechanic_deconstructor.InputContainer.Inventory.FindItemByIdentifier("oxygentank") != null && !mechanic_deconstructor.IsActive) + { + if (mechanic_deconstructor.ActivateButton.Frame.FlashTimer <= 0) + { + mechanic_deconstructor.ActivateButton.Frame.Flash(highlightColor, 1.5f, false); + } + } + } } yield return null; } while (mechanic.Inventory.FindItemByIdentifier("aluminium") == null); // Wait until deconstructed