Restore Pause functionality

This commit is contained in:
2025-03-04 23:59:40 -08:00
parent 5b57939452
commit ec182e87f0
8 changed files with 27 additions and 53 deletions

View File

@@ -221,8 +221,6 @@ public partial class Game : Node3D, IGame
InGameUI.UseTeleportPrompt.TeleportToNextFloor += UseTeleportPrompt_TeleportToNextFloor;
InGameUI.UseTeleportPrompt.CloseTeleportPrompt += UseTeleportPrompt_CloseTeleportPrompt;
Player.Inventory.InventoryAtCapacity += PlayerInventory_InventoryAtCapacity;
Player.Inventory.PickedUpItem += Inventory_PickedUpItem;
FloorClearMenu.GoToNextFloor += FloorClearMenu_GoToNextFloor;
FloorClearMenu.SaveAndExit += FloorClearMenu_SaveAndExit;
FloorClearMenu.TransitionCompleted += FloorClearMenu_TransitionCompleted;
@@ -244,6 +242,14 @@ public partial class Game : Node3D, IGame
SaveFile.Load();
}
public void TogglePause()
{
if (GameLogic.Value is Paused)
GameLogic.Input(new GameLogic.Input.UnpauseGame());
else
GameLogic.Input(new GameLogic.Input.PauseGame());
}
public void ToggleInventory()
{
if (GameLogic.Value is InventoryOpened)
@@ -263,11 +269,6 @@ public partial class Game : Node3D, IGame
GameEventDepot.OnTeleportEntered();
}
private void Inventory_PickedUpItem(string pickedUpItemName)
{
InGameUI.PlayerInfoUI.DisplayMessage($"{pickedUpItemName} picked up.");
}
public void UseItem(InventoryItem item)
{
if (item is ConsumableItem consumableItem)
@@ -447,7 +448,7 @@ public partial class Game : Node3D, IGame
public async void DoubleEXP(TimeSpan lengthOfEffect)
{
ToggleInventory();
InGameUI.PlayerInfoUI.DisplayMessage("Experience points temporarily doubled.");
AnnounceMessageOnMainScreen("Experience points temporarily doubled.");
DoubleEXPTimer.Start(lengthOfEffect.Seconds);
GameRepo.EXPRate = 2;
}
@@ -456,12 +457,7 @@ public partial class Game : Node3D, IGame
{
DoubleEXPTimer.Stop();
GameRepo.EXPRate = 1;
InGameUI.PlayerInfoUI.DisplayMessage("Experience points effect wore off.");
}
private void PlayerInventory_InventoryAtCapacity(string rejectedItem)
{
InGameUI.PlayerInfoUI.DisplayMessage($"Could not pick up {rejectedItem}.");
AnnounceMessageOnMainScreen("Experience points effect wore off.");
}
private void InventoryMenu_CloseInventory() => GameLogic.Input(new GameLogic.Input.CloseInventory());

View File

@@ -40,4 +40,6 @@ public interface IGame : IProvide<IGameRepo>, IProvide<IGameEventDepot>, IProvid
public void Save();
public void Load();
public void TogglePause();
}