More inventory menu improvements
This commit is contained in:
@@ -57,6 +57,8 @@ ui_accept={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":3,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_select={
|
||||
@@ -74,28 +76,24 @@ ui_cancel={
|
||||
ui_left={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_right={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_up={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_down={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
@@ -151,13 +149,6 @@ Inventory={
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":3,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
Cancel={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":1,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":70,"key_label":0,"unicode":102,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
StrafeLeft={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":4,"axis_value":1.0,"script":null)
|
||||
@@ -172,7 +163,21 @@ StrafeRight={
|
||||
}
|
||||
Pause={
|
||||
"deadzone": 0.5,
|
||||
"events": []
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":6,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
InventorySort={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":2,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":84,"key_label":0,"unicode":116,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
Interact={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":1,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":70,"key_label":0,"unicode":102,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[internationalization]
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace GameJamDungeon
|
||||
AppLogic.Set(AppRepo);
|
||||
Menu.NewGame += OnNewGame;
|
||||
Menu.Quit += OnQuit;
|
||||
Input.MouseMode = Input.MouseModeEnum.Captured;
|
||||
this.Provide();
|
||||
}
|
||||
|
||||
|
||||
175
src/game/Game.cs
175
src/game/Game.cs
@@ -4,7 +4,9 @@ namespace GameJamDungeon;
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Chickensoft.Introspection;
|
||||
using DialogueManagerRuntime;
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public interface IGame : IProvide<IGameRepo>, IProvide<IGame>, INode3D
|
||||
{
|
||||
@@ -36,9 +38,11 @@ public partial class Game : Node3D, IGame
|
||||
#region Nodes
|
||||
[Node] public IMap Map { get; set; } = default!;
|
||||
|
||||
[Node] public IPlayer Player { get; set; } = default!;
|
||||
|
||||
[Node] public InGameUI InGameUI { get; set; } = default!;
|
||||
|
||||
[Node] public FloorClearMenu FloorClearMenu { get; set; } = default!;
|
||||
[Node] public IFloorClearMenu FloorClearMenu { get; set; } = default!;
|
||||
|
||||
[Node] public DeathMenu DeathMenu { get; set; } = default!;
|
||||
|
||||
@@ -54,40 +58,6 @@ public partial class Game : Node3D, IGame
|
||||
Instantiator = new Instantiator(GetTree());
|
||||
}
|
||||
|
||||
private void PlayerInventory_InventoryAtCapacity(string rejectedItem)
|
||||
{
|
||||
InGameUI.PlayerInfoUI.DisplayInventoryFullMessage(rejectedItem);
|
||||
}
|
||||
|
||||
private void OnInventoryAtCapacity(string rejectedItemName) => InGameUI.PlayerInfoUI.DisplayInventoryFullMessage(rejectedItemName);
|
||||
|
||||
private void InventoryMenu_CloseInventory() => GameLogic.Input(new GameLogic.Input.InventoryMenuToggle());
|
||||
|
||||
private void Map_DungeonFinishedGenerating()
|
||||
{
|
||||
GameRepo.SetPlayerGlobalPosition(Map.GetPlayerSpawnPosition());
|
||||
}
|
||||
|
||||
private void Map_DialogueChoiceMade()
|
||||
{
|
||||
GameRepo.Resume();
|
||||
}
|
||||
|
||||
private void Map_TeleportReached()
|
||||
{
|
||||
GameRepo.Pause();
|
||||
}
|
||||
|
||||
private void OnFloorClearTransitionCompleted()
|
||||
{
|
||||
GameLogic.Input(new GameLogic.Input.FloorClearTransitioned());
|
||||
}
|
||||
|
||||
private void OnPauseMenuTransitioned()
|
||||
{
|
||||
GameLogic.Input(new GameLogic.Input.PauseMenuTransitioned());
|
||||
}
|
||||
|
||||
public void OnResolved()
|
||||
{
|
||||
GameBinding = GameLogic.Bind();
|
||||
@@ -101,13 +71,19 @@ public partial class Game : Node3D, IGame
|
||||
{
|
||||
PauseMenu.Show();
|
||||
PauseMenu.FadeIn();
|
||||
Input.MouseMode = Input.MouseModeEnum.Visible;
|
||||
PauseMenu.SetProcessUnhandledInput(true);
|
||||
})
|
||||
.Handle((in GameLogic.Output.LoadNextFloor _) =>
|
||||
{
|
||||
Map.SpawnNextFloor();
|
||||
})
|
||||
.Handle((in GameLogic.Output.HidePauseMenu _) => { PauseMenu.Hide(); })
|
||||
.Handle((in GameLogic.Output.ExitPauseMenu _) => { PauseMenu.FadeOut(); })
|
||||
.Handle((in GameLogic.Output.ExitPauseMenu _) => { PauseMenu.FadeOut(); Input.MouseMode = Input.MouseModeEnum.Captured; PauseMenu.SetProcessUnhandledInput(false); })
|
||||
.Handle((in GameLogic.Output.ShowFloorClearMenu _) => { FloorClearMenu.Show(); FloorClearMenu.FadeIn(); })
|
||||
.Handle((in GameLogic.Output.ExitFloorClearMenu _) => { FloorClearMenu.FadeOut(); })
|
||||
.Handle((in GameLogic.Output.SetInventoryMode _) => { InGameUI.ShowInventoryScreen(); })
|
||||
.Handle((in GameLogic.Output.HideInventory _) => { InGameUI.HideInventoryScreen(); })
|
||||
.Handle((in GameLogic.Output.OpenInventory _) => { InGameUI.ShowInventoryScreen(); InGameUI.InventoryMenu.SetProcessInput(true); })
|
||||
.Handle((in GameLogic.Output.HideInventory _) => { InGameUI.HideInventoryScreen(); InGameUI.InventoryMenu.SetProcessInput(false); })
|
||||
.Handle((in GameLogic.Output.ShowMiniMap _) => { InGameUI.ShowMiniMap(); })
|
||||
.Handle((in GameLogic.Output.HideMiniMap _) => { InGameUI.HideMiniMap(); })
|
||||
.Handle((in GameLogic.Output.ShowLostScreen _) => { DeathMenu.Show(); DeathMenu.FadeIn(); })
|
||||
@@ -118,14 +94,69 @@ public partial class Game : Node3D, IGame
|
||||
|
||||
this.Provide();
|
||||
|
||||
FloorClearMenu.TransitionCompleted += OnFloorClearTransitionCompleted;
|
||||
PauseMenu.TransitionCompleted += OnPauseMenuTransitioned;
|
||||
PauseMenu.UnpauseButtonPressed += PauseMenu_UnpauseButtonPressed;
|
||||
Map.TeleportReached += Map_TeleportReached;
|
||||
Map.DialogueDecisionMade += Map_DialogueChoiceMade;
|
||||
Map.DungeonFinishedGenerating += Map_DungeonFinishedGenerating;
|
||||
InGameUI.InventoryMenu.ClosedMenu += InventoryMenu_CloseInventory;
|
||||
InGameUI.MinimapButtonReleased += Player_MinimapButtonReleased;
|
||||
GameRepo.PlayerData.Inventory.InventoryAtCapacity += PlayerInventory_InventoryAtCapacity;
|
||||
GameRepo.PlayerData.Inventory.RaiseStatRequest += Inventory_RaiseStatRequest;
|
||||
FloorClearMenu.GoToNextFloor += FloorClearMenu_GoToNextFloor;
|
||||
FloorClearMenu.ReturnToHubWorld += ReturnToHubWorld;
|
||||
FloorClearMenu.TransitionCompleted += FloorClearMenu_TransitionCompleted;
|
||||
|
||||
Player.InventoryButtonPressed += Player_InventoryButtonPressed;
|
||||
Player.MinimapButtonHeld += Player_MinimapButtonHeld;
|
||||
Player.PauseButtonPressed += Player_PauseButtonPressed;
|
||||
}
|
||||
|
||||
private void PauseMenu_UnpauseButtonPressed()
|
||||
{
|
||||
GameLogic.Input(new GameLogic.Input.UnpauseGame());
|
||||
}
|
||||
|
||||
private void Player_PauseButtonPressed()
|
||||
{
|
||||
GameLogic.Input(new GameLogic.Input.PauseGame());
|
||||
}
|
||||
|
||||
private void Player_MinimapButtonReleased()
|
||||
{
|
||||
GameLogic.Input(new GameLogic.Input.MiniMapButtonReleased());
|
||||
}
|
||||
|
||||
private void Player_MinimapButtonHeld()
|
||||
{
|
||||
GameLogic.Input(new GameLogic.Input.MiniMapButtonPressed());
|
||||
}
|
||||
|
||||
private void Player_InventoryButtonPressed()
|
||||
{
|
||||
GameLogic.Input(new GameLogic.Input.OpenInventory());
|
||||
}
|
||||
|
||||
private void FloorClearMenu_TransitionCompleted()
|
||||
{
|
||||
GameRepo.Resume();
|
||||
}
|
||||
|
||||
private void FloorClearMenu_GoToNextFloor()
|
||||
{
|
||||
GameLogic.Input(new GameLogic.Input.GoToNextFloor());
|
||||
}
|
||||
|
||||
private void ReturnToHubWorld()
|
||||
{
|
||||
// Implement a return to overworld state
|
||||
// Don't carry over stats/equipment but we'll need to persist the overworld state
|
||||
// Which may include rescued items and npc/questline state
|
||||
GameLogic.Input(new GameLogic.Input.HideFloorClearMenu());
|
||||
}
|
||||
|
||||
public void GoToNextFloor()
|
||||
{
|
||||
GameLogic.Input(new GameLogic.Input.FloorExitReached());
|
||||
}
|
||||
|
||||
private void Inventory_RaiseStatRequest(ConsumableItemStats consumableItemStats)
|
||||
@@ -143,7 +174,7 @@ public partial class Game : Node3D, IGame
|
||||
|
||||
private void RaiseHP(int amountToRaise)
|
||||
{
|
||||
if (GameRepo.PlayerData.CurrentHP == GameRepo.PlayerData.MaximumHP)
|
||||
if (GameRepo.PlayerData.CurrentHP.Value == GameRepo.PlayerData.MaximumHP.Value)
|
||||
{
|
||||
GameRepo.PlayerData.SetMaximumHP(GameRepo.PlayerData.MaximumHP.Value + amountToRaise);
|
||||
GameRepo.PlayerData.SetCurrentHP(GameRepo.PlayerData.MaximumHP.Value);
|
||||
@@ -151,38 +182,6 @@ public partial class Game : Node3D, IGame
|
||||
}
|
||||
}
|
||||
|
||||
public void ToggleInventory()
|
||||
{
|
||||
GameLogic.Input(new GameLogic.Input.InventoryMenuToggle());
|
||||
}
|
||||
|
||||
public override void _UnhandledInput(InputEvent @event)
|
||||
{
|
||||
if (@event.IsActionPressed(GameInputs.Inventory))
|
||||
{
|
||||
GD.Print("Inventory button pressed");
|
||||
GameLogic.Input(new GameLogic.Input.InventoryMenuToggle());
|
||||
}
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.MiniMap))
|
||||
{
|
||||
GD.Print("MiniMap button pressed");
|
||||
GameLogic.Input(new GameLogic.Input.MiniMapButtonPressed());
|
||||
}
|
||||
|
||||
if (@event.IsActionReleased(GameInputs.MiniMap))
|
||||
{
|
||||
GD.Print("MiniMap button released");
|
||||
GameLogic.Input(new GameLogic.Input.MiniMapButtonReleased());
|
||||
}
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.Pause))
|
||||
{
|
||||
GD.Print("Pause button pressed");
|
||||
GameLogic.Input(new GameLogic.Input.PauseButtonPressed());
|
||||
}
|
||||
}
|
||||
|
||||
private void SetPauseMode(bool isPaused)
|
||||
{
|
||||
if (GetTree() != null)
|
||||
@@ -197,7 +196,7 @@ public partial class Game : Node3D, IGame
|
||||
|
||||
private void RaiseVT(int amountToRaise)
|
||||
{
|
||||
if (GameRepo.PlayerData.CurrentVT == GameRepo.PlayerData.MaximumVT)
|
||||
if (GameRepo.PlayerData.CurrentVT.Value == GameRepo.PlayerData.MaximumVT.Value)
|
||||
{
|
||||
GameRepo.PlayerData.SetMaximumVT(GameRepo.PlayerData.MaximumVT.Value + amountToRaise);
|
||||
GameRepo.PlayerData.SetCurrentVT(GameRepo.PlayerData.MaximumVT.Value);
|
||||
@@ -211,5 +210,33 @@ public partial class Game : Node3D, IGame
|
||||
EmitSignal(SignalName.StatRaisedAlert, $"{amountToRaise}VT Up.");
|
||||
}
|
||||
|
||||
private void PlayerInventory_InventoryAtCapacity(string rejectedItem)
|
||||
{
|
||||
InGameUI.PlayerInfoUI.DisplayInventoryFullMessage(rejectedItem);
|
||||
}
|
||||
|
||||
private void OnInventoryAtCapacity(string rejectedItemName) => InGameUI.PlayerInfoUI.DisplayInventoryFullMessage(rejectedItemName);
|
||||
|
||||
private void InventoryMenu_CloseInventory() => GameLogic.Input(new GameLogic.Input.CloseInventory());
|
||||
|
||||
private void Map_DungeonFinishedGenerating()
|
||||
{
|
||||
GameRepo.SetPlayerGlobalPosition(Map.GetPlayerSpawnPosition());
|
||||
GameLogic.Input(new GameLogic.Input.HideFloorClearMenu());
|
||||
}
|
||||
|
||||
private void Map_TeleportReached()
|
||||
{
|
||||
GameRepo.Pause();
|
||||
DialogueManager.GetCurrentScene = (() => this);
|
||||
var dialogueResource = GD.Load<Resource>("res://src/ui/dialogue/FloorExit.dialogue");
|
||||
DialogueController.ShowDialogue(dialogueResource, "floor_exit");
|
||||
}
|
||||
|
||||
private void OnPauseMenuTransitioned()
|
||||
{
|
||||
GameLogic.Input(new GameLogic.Input.PauseMenuTransitioned());
|
||||
}
|
||||
|
||||
public void OnStart() => GameLogic.Input(new GameLogic.Input.StartGame());
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.74459, 1.22144)
|
||||
|
||||
[node name="Map" parent="PauseContainer" instance=ExtResource("3_d8awv")]
|
||||
unique_name_in_owner = true
|
||||
process_mode = 1
|
||||
script = ExtResource("4_f5pye")
|
||||
|
||||
[node name="InGameUI" parent="." instance=ExtResource("5_lxtnp")]
|
||||
@@ -46,7 +47,6 @@ visible = false
|
||||
[node name="FloorClearMenu" parent="." instance=ExtResource("11_rya1n")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
modulate = Color(1, 1, 1, 1)
|
||||
|
||||
[node name="PauseMenu" parent="." instance=ExtResource("12_yev8k")]
|
||||
unique_name_in_owner = true
|
||||
|
||||
@@ -8,21 +8,24 @@
|
||||
|
||||
public readonly record struct Initialize;
|
||||
|
||||
public readonly record struct InventoryMenuToggle;
|
||||
public readonly record struct OpenInventory;
|
||||
|
||||
public readonly record struct CloseInventory;
|
||||
|
||||
public readonly record struct MiniMapButtonPressed;
|
||||
|
||||
public readonly record struct MiniMapButtonReleased;
|
||||
|
||||
public readonly record struct GameOver;
|
||||
|
||||
public readonly record struct FloorExitReached;
|
||||
public readonly record struct HideFloorClearMenu;
|
||||
|
||||
public readonly record struct FloorClearTransitioned;
|
||||
public readonly record struct GameOver;
|
||||
|
||||
public readonly record struct GoToNextFloor;
|
||||
|
||||
public readonly record struct PauseButtonPressed;
|
||||
public readonly record struct PauseGame;
|
||||
|
||||
public readonly record struct UnpauseGame;
|
||||
|
||||
public readonly record struct PauseMenuTransitioned;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace GameJamDungeon
|
||||
|
||||
public readonly record struct ExitPauseMenu;
|
||||
|
||||
public readonly record struct SetInventoryMode();
|
||||
public readonly record struct OpenInventory();
|
||||
|
||||
public readonly record struct HideInventory;
|
||||
|
||||
|
||||
@@ -1,37 +1,33 @@
|
||||
@startuml GameLogic
|
||||
state "GameLogic State" as GameJamDungeon_GameLogic_State {
|
||||
state "FloorCleared" as GameJamDungeon_GameLogic_State_FloorCleared
|
||||
state "GameStarted" as GameJamDungeon_GameLogic_State_GameStarted
|
||||
state "Playing" as GameJamDungeon_GameLogic_State_Playing {
|
||||
state "FloorClearedDecisionState" as GameJamDungeon_GameLogic_State_FloorClearedDecisionState
|
||||
state "InventoryOpened" as GameJamDungeon_GameLogic_State_InventoryOpened
|
||||
state "MenuBackdrop" as GameJamDungeon_GameLogic_State_MenuBackdrop
|
||||
state "MinimapOpen" as GameJamDungeon_GameLogic_State_MinimapOpen
|
||||
state "Paused" as GameJamDungeon_GameLogic_State_Paused
|
||||
state "Playing" as GameJamDungeon_GameLogic_State_Playing
|
||||
state "Quit" as GameJamDungeon_GameLogic_State_Quit
|
||||
state "Resuming" as GameJamDungeon_GameLogic_State_Resuming
|
||||
}
|
||||
state "Quit" as GameJamDungeon_GameLogic_State_Quit
|
||||
}
|
||||
|
||||
GameJamDungeon_GameLogic_State_FloorCleared --> GameJamDungeon_GameLogic_State_FloorCleared : GoToNextFloor
|
||||
GameJamDungeon_GameLogic_State_FloorClearedDecisionState --> GameJamDungeon_GameLogic_State_FloorClearedDecisionState : GoToNextFloor
|
||||
GameJamDungeon_GameLogic_State_FloorClearedDecisionState --> GameJamDungeon_GameLogic_State_Playing : HideFloorClearMenu
|
||||
GameJamDungeon_GameLogic_State_GameStarted --> GameJamDungeon_GameLogic_State_Playing : Initialize
|
||||
GameJamDungeon_GameLogic_State_InventoryOpened --> GameJamDungeon_GameLogic_State_Playing : InventoryMenuToggle
|
||||
GameJamDungeon_GameLogic_State_MenuBackdrop --> GameJamDungeon_GameLogic_State_MenuBackdrop : Initialize
|
||||
GameJamDungeon_GameLogic_State_MenuBackdrop --> GameJamDungeon_GameLogic_State_Playing : StartGame
|
||||
GameJamDungeon_GameLogic_State_InventoryOpened --> GameJamDungeon_GameLogic_State_Playing : CloseInventory
|
||||
GameJamDungeon_GameLogic_State_MinimapOpen --> GameJamDungeon_GameLogic_State_Playing : MiniMapButtonReleased
|
||||
GameJamDungeon_GameLogic_State_Paused --> GameJamDungeon_GameLogic_State_Resuming : PauseButtonPressed
|
||||
GameJamDungeon_GameLogic_State_Playing --> GameJamDungeon_GameLogic_State_FloorCleared : FloorExitReached
|
||||
GameJamDungeon_GameLogic_State_Playing --> GameJamDungeon_GameLogic_State_InventoryOpened : InventoryMenuToggle
|
||||
GameJamDungeon_GameLogic_State_Paused --> GameJamDungeon_GameLogic_State_Resuming : UnpauseGame
|
||||
GameJamDungeon_GameLogic_State_Playing --> GameJamDungeon_GameLogic_State_FloorClearedDecisionState : FloorExitReached
|
||||
GameJamDungeon_GameLogic_State_Playing --> GameJamDungeon_GameLogic_State_InventoryOpened : OpenInventory
|
||||
GameJamDungeon_GameLogic_State_Playing --> GameJamDungeon_GameLogic_State_MinimapOpen : MiniMapButtonPressed
|
||||
GameJamDungeon_GameLogic_State_Playing --> GameJamDungeon_GameLogic_State_Paused : PauseButtonPressed
|
||||
GameJamDungeon_GameLogic_State_Playing --> GameJamDungeon_GameLogic_State_Paused : PauseGame
|
||||
GameJamDungeon_GameLogic_State_Playing --> GameJamDungeon_GameLogic_State_Quit : GameOver
|
||||
GameJamDungeon_GameLogic_State_Resuming --> GameJamDungeon_GameLogic_State_Playing : PauseMenuTransitioned
|
||||
|
||||
GameJamDungeon_GameLogic_State : OnIsPaused() → SetPauseMode
|
||||
GameJamDungeon_GameLogic_State_FloorCleared : OnEnter → ShowFloorClearMenu
|
||||
GameJamDungeon_GameLogic_State_FloorCleared : OnExit → ExitFloorClearMenu
|
||||
GameJamDungeon_GameLogic_State_GameStarted : OnEnter → ShowFloorClearMenu
|
||||
GameJamDungeon_GameLogic_State_GameStarted : OnExit → ExitFloorClearMenu
|
||||
GameJamDungeon_GameLogic_State_FloorClearedDecisionState : OnGoToNextFloor → LoadNextFloor
|
||||
GameJamDungeon_GameLogic_State_GameStarted : OnInitialize → StartGame
|
||||
GameJamDungeon_GameLogic_State_InventoryOpened : OnEnter → SetInventoryMode
|
||||
GameJamDungeon_GameLogic_State_InventoryOpened : OnEnter → OpenInventory
|
||||
GameJamDungeon_GameLogic_State_InventoryOpened : OnExit → HideInventory
|
||||
GameJamDungeon_GameLogic_State_MinimapOpen : OnEnter → ShowMiniMap
|
||||
GameJamDungeon_GameLogic_State_MinimapOpen : OnExit → HideMiniMap
|
||||
|
||||
@@ -8,18 +8,24 @@ namespace GameJamDungeon
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record FloorCleared : State, IGet<Input.GoToNextFloor>
|
||||
public partial record FloorClearedDecisionState : Playing, IGet<Input.GoToNextFloor>, IGet<Input.HideFloorClearMenu>
|
||||
{
|
||||
public FloorCleared()
|
||||
public FloorClearedDecisionState()
|
||||
{
|
||||
this.OnEnter(() => { Get<IGameRepo>().Pause(); Output(new Output.ShowFloorClearMenu()); });
|
||||
this.OnExit(() => { Output(new Output.ExitFloorClearMenu()); });
|
||||
this.OnAttach(() => { Get<IGameRepo>().Pause(); Output(new Output.ShowFloorClearMenu()); });
|
||||
this.OnDetach(() => { Output(new Output.ExitFloorClearMenu()); });
|
||||
}
|
||||
|
||||
public Transition On(in Input.GoToNextFloor input)
|
||||
{
|
||||
Output(new Output.LoadNextFloor());
|
||||
return ToSelf();
|
||||
}
|
||||
|
||||
public Transition On(in Input.HideFloorClearMenu input)
|
||||
{
|
||||
return To<Playing>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ namespace GameJamDungeon
|
||||
{
|
||||
public GameStarted()
|
||||
{
|
||||
this.OnEnter(() => { Get<IGameRepo>().Pause(); Output(new Output.ShowFloorClearMenu()); });
|
||||
this.OnExit(() => { Output(new Output.ExitFloorClearMenu()); });
|
||||
this.OnEnter(() => { Get<IGameRepo>().Pause(); });
|
||||
this.OnExit(() => { Get<IGameRepo>().Resume(); });
|
||||
}
|
||||
|
||||
public Transition On(in Input.Initialize input)
|
||||
|
||||
@@ -8,14 +8,18 @@ namespace GameJamDungeon
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record InventoryOpened : State, IGet<Input.InventoryMenuToggle>
|
||||
public partial record InventoryOpened : Playing, IGet<Input.CloseInventory>
|
||||
{
|
||||
public InventoryOpened()
|
||||
{
|
||||
this.OnEnter(() => { Get<IGameRepo>().Pause(); Output(new Output.SetInventoryMode()); });
|
||||
this.OnEnter(() => { Get<IGameRepo>().Pause(); Output(new Output.OpenInventory()); });
|
||||
this.OnExit(() => { Get<IGameRepo>().Resume(); Output(new Output.HideInventory()); });
|
||||
}
|
||||
public Transition On(in Input.InventoryMenuToggle input) => To<Playing>();
|
||||
|
||||
public Transition On(in Input.CloseInventory input)
|
||||
{
|
||||
return To<Playing>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
using Chickensoft.Introspection;
|
||||
|
||||
namespace GameJamDungeon
|
||||
{
|
||||
public partial class GameLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record MenuBackdrop : State, IGet<Input.StartGame>, IGet<Input.Initialize>
|
||||
{
|
||||
public MenuBackdrop()
|
||||
{
|
||||
OnAttach(() => Get<IAppRepo>().GameEntered += OnGameEntered);
|
||||
OnDetach(() => Get<IAppRepo>().GameEntered -= OnGameEntered);
|
||||
}
|
||||
|
||||
public void OnGameEntered() => Input(new Input.StartGame());
|
||||
|
||||
public Transition On(in Input.StartGame input) => To<Playing>();
|
||||
|
||||
public Transition On(in Input.Initialize input)
|
||||
{
|
||||
return ToSelf();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ namespace GameJamDungeon
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record MinimapOpen : State, IGet<Input.MiniMapButtonReleased>
|
||||
public partial record MinimapOpen : Playing, IGet<Input.MiniMapButtonReleased>
|
||||
{
|
||||
public MinimapOpen()
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace GameJamDungeon
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record Paused : State, IGet<Input.PauseButtonPressed>
|
||||
public partial record Paused : Playing, IGet<Input.UnpauseGame>
|
||||
{
|
||||
public Paused()
|
||||
{
|
||||
@@ -20,7 +20,7 @@ namespace GameJamDungeon
|
||||
this.OnExit(() => Output(new Output.ExitPauseMenu()));
|
||||
}
|
||||
|
||||
public virtual Transition On(in Input.PauseButtonPressed input) => To<Resuming>();
|
||||
public virtual Transition On(in Input.UnpauseGame input) => To<Resuming>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,29 +9,29 @@ namespace GameJamDungeon
|
||||
{
|
||||
[Meta]
|
||||
public partial record Playing : State,
|
||||
IGet<Input.InventoryMenuToggle>,
|
||||
IGet<Input.OpenInventory>,
|
||||
IGet<Input.MiniMapButtonPressed>,
|
||||
IGet<Input.GameOver>,
|
||||
IGet<Input.FloorExitReached>,
|
||||
IGet<Input.PauseButtonPressed>
|
||||
IGet<Input.PauseGame>
|
||||
{
|
||||
public Playing()
|
||||
{
|
||||
OnAttach(() => Get<IGameRepo>().Ended += OnEnded);
|
||||
OnDetach(() => Get<IGameRepo>().Ended -= OnEnded);
|
||||
this.OnEnter(() => Get<IGameRepo>().Ended += OnEnded);
|
||||
this.OnExit(() => Get<IGameRepo>().Ended -= OnEnded);
|
||||
}
|
||||
|
||||
public void OnEnded() => Input(new Input.GameOver());
|
||||
|
||||
public Transition On(in Input.InventoryMenuToggle input) => To<InventoryOpened>();
|
||||
public Transition On(in Input.OpenInventory input) => To<InventoryOpened>();
|
||||
|
||||
public Transition On(in Input.MiniMapButtonPressed input) => To<MinimapOpen>();
|
||||
|
||||
public Transition On(in Input.GameOver input) => To<Quit>();
|
||||
|
||||
public Transition On(in Input.FloorExitReached input) => To<FloorCleared>();
|
||||
public Transition On(in Input.FloorExitReached input) => To<FloorClearedDecisionState>();
|
||||
|
||||
public Transition On(in Input.PauseButtonPressed input) => To<Paused>();
|
||||
public Transition On(in Input.PauseGame input) => To<Paused>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ public partial class GameLogic
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record Resuming : State, IGet<Input.PauseMenuTransitioned>
|
||||
public partial record Resuming : Playing, IGet<Input.PauseMenuTransitioned>
|
||||
{
|
||||
public Resuming()
|
||||
{
|
||||
|
||||
@@ -4,7 +4,6 @@ using Chickensoft.Introspection;
|
||||
using GameJamDungeon;
|
||||
using Godot;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public interface IInventoryMenu : IControl
|
||||
@@ -92,27 +91,18 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
||||
GameRepo.PlayerData.Inventory.EquippedAccessory.Sync += EquippedAccessory_Sync;
|
||||
|
||||
Game.StatRaisedAlert += Game_StatRaisedAlert;
|
||||
|
||||
AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished;
|
||||
}
|
||||
|
||||
private async void AnimationPlayer_AnimationFinished(StringName animName)
|
||||
{
|
||||
if (animName == "status_up")
|
||||
{
|
||||
if (_currentIndex >= ItemSlots.Length - 1)
|
||||
_currentIndex--;
|
||||
if (_currentIndex <= 0)
|
||||
_currentIndex = 0;
|
||||
await RedrawInventory();
|
||||
await ShowInventoryInfo();
|
||||
}
|
||||
SetProcessInput(false);
|
||||
}
|
||||
|
||||
private async void Game_StatRaisedAlert(string statRaisedAlert)
|
||||
{
|
||||
SetProcessInput(false);
|
||||
await HideUserActionPrompt();
|
||||
await ShowInventoryInfo();
|
||||
ItemEffectLabel.Text = statRaisedAlert;
|
||||
AnimationPlayer.Play("status_up");
|
||||
await ToSignal(GetTree().CreateTimer(1.5f), "timeout");
|
||||
await RedrawInventory();
|
||||
SetProcessInput(true);
|
||||
}
|
||||
|
||||
private void EquippedAccessory_Sync(Accessory obj)
|
||||
@@ -164,13 +154,26 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
||||
}
|
||||
|
||||
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||
public override void _UnhandledInput(InputEvent @event)
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
if (ItemSlots.Length == 0 || GetViewport().GuiGetFocusOwner() is Button)
|
||||
return;
|
||||
|
||||
var inventory = GameRepo.PlayerData.Inventory;
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.UiCancel))
|
||||
{
|
||||
if (UseButton.HasFocus() || DropButton.HasFocus() || ThrowButton.HasFocus())
|
||||
{
|
||||
HideUserActionPrompt();
|
||||
ShowInventoryInfo();
|
||||
}
|
||||
else
|
||||
{
|
||||
EmitSignal(SignalName.ClosedMenu);
|
||||
}
|
||||
}
|
||||
|
||||
if (ItemSlots.Length == 0 || UseButton.HasFocus() || DropButton.HasFocus() || ThrowButton.HasFocus())
|
||||
return;
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.UiRight) && _currentPageNumber == InventoryPageNumber.FirstPage && inventory.Items.Count() > _itemsPerPage)
|
||||
ChangeInventoryPage(InventoryPageNumber.SecondPage);
|
||||
|
||||
@@ -193,10 +196,14 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.UiAccept))
|
||||
{
|
||||
if (ItemSlots.Length == 0)
|
||||
return;
|
||||
DisplayUserActionPrompt();
|
||||
}
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.InventorySort))
|
||||
{
|
||||
inventory.Sort();
|
||||
RedrawInventory();
|
||||
}
|
||||
}
|
||||
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||
|
||||
@@ -249,7 +256,7 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
||||
UseButton.Text = "Use";
|
||||
}
|
||||
|
||||
UseButton.GrabFocus();
|
||||
UseButton.CallDeferred(MethodName.GrabFocus);
|
||||
}
|
||||
|
||||
private async Task HideUserActionPrompt()
|
||||
@@ -258,6 +265,9 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
||||
UseButton.Hide();
|
||||
ThrowButton.Hide();
|
||||
DropButton.Hide();
|
||||
UseButton.ReleaseFocus();
|
||||
ThrowButton.ReleaseFocus();
|
||||
DropButton.ReleaseFocus();
|
||||
}
|
||||
|
||||
private async Task ShowInventoryInfo()
|
||||
@@ -335,21 +345,26 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
||||
private async Task EquipOrUnequipItem()
|
||||
{
|
||||
var itemSlot = ItemSlots[_currentIndex];
|
||||
await ToSignal(GetTree().CreateTimer(0.2f), "timeout");
|
||||
if (itemSlot.Item is IEquipable equipableItem)
|
||||
{
|
||||
if (GameRepo.PlayerData.Inventory.IsEquipped(equipableItem))
|
||||
{
|
||||
ItemEffectLabel.Text = $"{itemSlot.Item.GetType()} unequipped.";
|
||||
GameRepo.PlayerData.Inventory.Unequip(equipableItem);
|
||||
AnimationPlayer.Play("status_up");
|
||||
itemSlot.SetSelectedItemStyle();
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemEffectLabel.Text = $"{itemSlot.Item.GetType()} equipped.";
|
||||
GameRepo.PlayerData.Inventory.Equip(equipableItem);
|
||||
itemSlot.SetEquippedSelectedItemStyle();
|
||||
AnimationPlayer.Play("status_up");
|
||||
}
|
||||
SetProcessInput(false);
|
||||
await HideUserActionPrompt();
|
||||
await ShowInventoryInfo();
|
||||
await ToSignal(GetTree().CreateTimer(1.5f), "timeout");
|
||||
await RedrawInventory();
|
||||
SetProcessInput(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,8 +377,6 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
||||
{
|
||||
GameRepo.PlayerData.Inventory.Use(consumable);
|
||||
}
|
||||
|
||||
await HideUserActionPrompt();
|
||||
}
|
||||
|
||||
private async void ThrowButtonPressed()
|
||||
|
||||
@@ -101,6 +101,33 @@ font = ExtResource("3_lm4o1")
|
||||
font_size = 80
|
||||
font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_dg155"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("InventoryInfo/HBoxContainer/PlayerInfo/HBoxContainer/VBoxContainer/ItemEffectLabel:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("InventoryInfo/HBoxContainer/PlayerInfo/HBoxContainer/VBoxContainer/ItemEffectLabel:text")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [""]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_7by7u"]
|
||||
resource_name = "status_up"
|
||||
length = 2.5
|
||||
@@ -129,33 +156,6 @@ tracks/1/keys = {
|
||||
"values": [""]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_dg155"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("InventoryInfo/HBoxContainer/PlayerInfo/HBoxContainer/VBoxContainer/ItemEffectLabel:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("InventoryInfo/HBoxContainer/PlayerInfo/HBoxContainer/VBoxContainer/ItemEffectLabel:text")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [""]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_eivo2"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_dg155"),
|
||||
@@ -415,6 +415,7 @@ autowrap_mode = 2
|
||||
|
||||
[node name="UseItemPrompt" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/HBoxContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(800, 100)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace GameJamDungeon;
|
||||
|
||||
@@ -31,6 +33,8 @@ public interface IInventory : INode
|
||||
|
||||
public void Drop(IInventoryItem inventoryItem);
|
||||
|
||||
public void Sort();
|
||||
|
||||
event Inventory.InventoryAtCapacityEventHandler InventoryAtCapacity;
|
||||
|
||||
event Inventory.AccessoryUnequippedEventHandler AccessoryUnequipped;
|
||||
@@ -137,4 +141,67 @@ public partial class Inventory : Node, IInventory
|
||||
{
|
||||
Remove(item);
|
||||
}
|
||||
|
||||
public void Sort()
|
||||
{
|
||||
var equippedWeapon = Items.OfType<Weapon>().Where(IsEquipped);
|
||||
var equippedArmor = Items.OfType<Armor>().Where(IsEquipped);
|
||||
var equippedAccessory = Items.OfType<Accessory>().Where(IsEquipped);
|
||||
var equippedItems = new List<IInventoryItem>();
|
||||
equippedItems.AddRange(equippedWeapon);
|
||||
equippedItems.AddRange(equippedArmor);
|
||||
equippedItems.AddRange(equippedAccessory);
|
||||
var listToSort = Items.Except(equippedItems);
|
||||
var weapons = listToSort.Where(x => x is Weapon).OrderBy(x => x as Weapon, new WeaponComparer());
|
||||
var armor = listToSort.Where(x => x is Armor).OrderBy(x => x as Armor, new ArmorComparer());
|
||||
var accessories = listToSort.Where(x => x is Accessory).OrderBy(x => x as Accessory, new AccessoryComparer());
|
||||
var consumables = listToSort.Where(x => x is ConsumableItem).OrderBy(x => x as ConsumableItem, new ConsumableComparer());
|
||||
var throwables = listToSort.Where(x => x is ThrowableItem).OrderBy(x => x as ThrowableItem, new ThrowableComparer());
|
||||
Items = [.. consumables, .. equippedItems, .. weapons, .. armor, .. accessories, .. throwables];
|
||||
}
|
||||
|
||||
public class WeaponComparer : IComparer<Weapon>
|
||||
{
|
||||
public int Compare(Weapon x, Weapon y)
|
||||
{
|
||||
if (x.WeaponStats.Damage == y.WeaponStats.Damage)
|
||||
return x.WeaponStats.Name.CompareTo(y.WeaponStats.Name);
|
||||
|
||||
return x.WeaponStats.Damage < y.WeaponStats.Damage ? 1 : -1;
|
||||
}
|
||||
}
|
||||
|
||||
public class ArmorComparer : IComparer<Armor>
|
||||
{
|
||||
public int Compare(Armor x, Armor y)
|
||||
{
|
||||
if (x.ArmorStats.Defense == y.ArmorStats.Defense)
|
||||
return x.ArmorStats.Name.CompareTo(y.ArmorStats.Name);
|
||||
|
||||
return x.ArmorStats.Defense < y.ArmorStats.Defense ? 1 : -1;
|
||||
}
|
||||
}
|
||||
|
||||
public class AccessoryComparer : IComparer<Accessory>
|
||||
{
|
||||
public int Compare(Accessory x, Accessory y)
|
||||
{
|
||||
return x.AccessoryStats.Name.CompareTo(y.AccessoryStats.Name);
|
||||
}
|
||||
}
|
||||
|
||||
public class ConsumableComparer : IComparer<ConsumableItem>
|
||||
{
|
||||
public int Compare(ConsumableItem x, ConsumableItem y)
|
||||
{
|
||||
return x.ConsumableItemInfo.Name.CompareTo(y.ConsumableItemInfo.Name);
|
||||
}
|
||||
}
|
||||
public class ThrowableComparer : IComparer<ThrowableItem>
|
||||
{
|
||||
public int Compare(ThrowableItem x, ThrowableItem y)
|
||||
{
|
||||
return x.ThrowableItemInfo.Name.CompareTo(y.ThrowableItemInfo.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_resource type="Resource" script_class="WeaponInfo" load_steps=3 format=3 uid="uid://cfr100khjkloh"]
|
||||
[gd_resource type="Resource" script_class="WeaponStats" load_steps=3 format=3 uid="uid://cfr100khjkloh"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://blq3nnyostunl" path="res://src/items/weapons/textures/LOVE JUDGEMENT.PNG" id="1_ivlxj"]
|
||||
[ext_resource type="Script" path="res://src/items/weapons/WeaponStats.cs" id="1_vroib"]
|
||||
@@ -15,7 +15,7 @@ IgneousDamageBonus = 0.0
|
||||
FerrumDamageBonus = 0.0
|
||||
WeaponTags = []
|
||||
Name = "Love Judgement"
|
||||
Description = "+12 DEF
|
||||
Description = "+12 ATK
|
||||
A mace only wieldable by the strong of heart."
|
||||
Texture = ExtResource("1_ivlxj")
|
||||
SpawnRate = 0.5
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace GameJamDungeon;
|
||||
public interface IMap : INode3D
|
||||
{
|
||||
event Map.TeleportReachedEventHandler TeleportReached;
|
||||
event Map.DialogueDecisionMadeEventHandler DialogueDecisionMade;
|
||||
event Map.DungeonFinishedGeneratingEventHandler DungeonFinishedGenerating;
|
||||
|
||||
public List<IDungeonFloor> Floors { get; }
|
||||
@@ -32,9 +31,6 @@ public partial class Map : Node3D, IMap
|
||||
[Signal]
|
||||
public delegate void TeleportReachedEventHandler();
|
||||
|
||||
[Signal]
|
||||
public delegate void DialogueDecisionMadeEventHandler();
|
||||
|
||||
[Signal]
|
||||
public delegate void DungeonFinishedGeneratingEventHandler();
|
||||
|
||||
@@ -48,7 +44,6 @@ public partial class Map : Node3D, IMap
|
||||
_currentFloor = Floors.ElementAt(0);
|
||||
Teleport.BodyEntered += OnTeleportEntered;
|
||||
Teleport.GlobalPosition = _currentFloor.GetTeleportSpawnPoint();
|
||||
DialogueManager.DialogueEnded += DecisionMade;
|
||||
}
|
||||
|
||||
public void SpawnNextFloor()
|
||||
@@ -64,16 +59,8 @@ public partial class Map : Node3D, IMap
|
||||
|
||||
public Vector3 GetPlayerSpawnPosition() => _currentFloor.GetPlayerSpawnPoint();
|
||||
|
||||
private void DecisionMade(Resource resource)
|
||||
{
|
||||
EmitSignal(SignalName.DialogueDecisionMade);
|
||||
}
|
||||
|
||||
private void OnTeleportEntered(Node3D body)
|
||||
{
|
||||
DialogueManager.GetCurrentScene = (() => this);
|
||||
var dialogueResource = GD.Load<Resource>("res://src/ui/dialogue/FloorExit.dialogue");
|
||||
DialogueController.ShowDialogue(dialogueResource, "floor_exit");
|
||||
EmitSignal(SignalName.TeleportReached);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public partial class Npc : Node3D
|
||||
|
||||
public override void _UnhandledInput(InputEvent @event)
|
||||
{
|
||||
if (@event.IsActionPressed(GameInputs.Cancel) && _isInDialogueZone)
|
||||
if (@event.IsActionPressed(GameInputs.Interact) && _isInDialogueZone)
|
||||
{
|
||||
if (_isIntroductionComplete)
|
||||
DialogueController.ShowDialogue(Dialogue, "general");
|
||||
|
||||
@@ -17,6 +17,10 @@ namespace GameJamDungeon
|
||||
public float GetLeftStrafeInputVector();
|
||||
|
||||
public float GetRightStrafeInputVector();
|
||||
|
||||
event Player.InventoryButtonPressedEventHandler InventoryButtonPressed;
|
||||
event Player.MinimapButtonHeldEventHandler MinimapButtonHeld;
|
||||
event Player.PauseButtonPressedEventHandler PauseButtonPressed;
|
||||
}
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
@@ -35,6 +39,13 @@ namespace GameJamDungeon
|
||||
[Dependency]
|
||||
public ISaveChunk<GameData> GameChunk => this.DependOn<ISaveChunk<GameData>>();
|
||||
|
||||
[Signal]
|
||||
public delegate void InventoryButtonPressedEventHandler();
|
||||
[Signal]
|
||||
public delegate void MinimapButtonHeldEventHandler();
|
||||
[Signal]
|
||||
public delegate void PauseButtonPressedEventHandler();
|
||||
|
||||
[Export]
|
||||
public PlayerStatResource PlayerStatResource { get; set; } = default!;
|
||||
|
||||
@@ -135,6 +146,24 @@ namespace GameJamDungeon
|
||||
|
||||
public override void _UnhandledInput(InputEvent @event)
|
||||
{
|
||||
if (@event.IsActionPressed(GameInputs.Inventory))
|
||||
{
|
||||
GD.Print("Inventory button pressed");
|
||||
EmitSignal(SignalName.InventoryButtonPressed);
|
||||
}
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.MiniMap))
|
||||
{
|
||||
GD.Print("MiniMap button pressed");
|
||||
EmitSignal(SignalName.MinimapButtonHeld);
|
||||
}
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.Pause))
|
||||
{
|
||||
GD.Print("Pause button pressed");
|
||||
EmitSignal(SignalName.PauseButtonPressed);
|
||||
}
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.Attack))
|
||||
PlayerLogic.Input(new PlayerLogic.Input.Attack());
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://bodfblud4kea3" path="res://src/player/slash_0003_Classic_27.png" id="5_eebal"]
|
||||
[ext_resource type="Texture2D" uid="uid://de55prolicl0u" path="res://src/player/slash_0004_Classic_26.png" id="6_ngag5"]
|
||||
[ext_resource type="Texture2D" uid="uid://bp0msic3uk3kc" path="res://src/player/slash_0005_Layer-1.png" id="7_tp5uu"]
|
||||
[ext_resource type="PackedScene" uid="uid://ctwtksu2406c" path="res://src/player/dont_look_in_here/player_model.tscn" id="10_prmgx"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_btp2w"]
|
||||
script = ExtResource("2_xq68d")
|
||||
@@ -35,9 +36,6 @@ Luck = 0.05
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_dw45s"]
|
||||
height = 1.7
|
||||
|
||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_dmans"]
|
||||
height = 1.7
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_hs4wf"]
|
||||
size = Vector3(1.94531, 2.43945, 1.08447)
|
||||
|
||||
@@ -156,9 +154,6 @@ disabled = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.937567, 0)
|
||||
shape = SubResource("CapsuleShape3D_dw45s")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="CollisionShape3D"]
|
||||
mesh = SubResource("CapsuleMesh_dmans")
|
||||
|
||||
[node name="CollisionDetector" type="Area3D" parent="CollisionShape3D"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.937567, 0)
|
||||
@@ -170,7 +165,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0479561, 0.982638, -0.0402
|
||||
shape = SubResource("BoxShape3D_hs4wf")
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.163955, 1.13605, -0.159032)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00341564, 1.40507, -0.159032)
|
||||
cull_mask = 1048573
|
||||
|
||||
[node name="OmniLight3D" type="OmniLight3D" parent="."]
|
||||
@@ -194,3 +189,6 @@ unique_name_in_owner = true
|
||||
process_mode = 1
|
||||
wait_time = 3.0
|
||||
autostart = true
|
||||
|
||||
[node name="player_model" parent="." instance=ExtResource("10_prmgx")]
|
||||
visible = false
|
||||
|
||||
137
src/player/dont_look_in_here/player_model.tscn
Normal file
137
src/player/dont_look_in_here/player_model.tscn
Normal file
File diff suppressed because one or more lines are too long
BIN
src/player/dont_look_in_here/tendomaya.glb
Normal file
BIN
src/player/dont_look_in_here/tendomaya.glb
Normal file
Binary file not shown.
36
src/player/dont_look_in_here/tendomaya.glb.import
Normal file
36
src/player/dont_look_in_here/tendomaya.glb.import
Normal file
@@ -0,0 +1,36 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://d60ka3oda7au"
|
||||
path="res://.godot/imported/tendomaya.glb-f10208c626b86ebd9779207b611bbe24.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/player/dont_look_in_here/tendomaya.glb"
|
||||
dest_files=["res://.godot/imported/tendomaya.glb-f10208c626b86ebd9779207b611bbe24.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=1
|
||||
gltf/embedded_image_handling=1
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
@@ -0,0 +1,38 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dcf5vnogu2qpl"
|
||||
path.s3tc="res://.godot/imported/tendomaya_Diffuse Texture-Diffuse Texture.png-c133987a802d5d3b355e9b92080e5bbf.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
generator_parameters={
|
||||
"md5": "538abddaba633fa07d06288706267c48"
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/player/dont_look_in_here/tendomaya_Diffuse Texture-Diffuse Texture.png"
|
||||
dest_files=["res://.godot/imported/tendomaya_Diffuse Texture-Diffuse Texture.png-c133987a802d5d3b355e9b92080e5bbf.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
BIN
src/player/dont_look_in_here/tendomaya_body0_tex00.png
Normal file
BIN
src/player/dont_look_in_here/tendomaya_body0_tex00.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 415 KiB |
@@ -0,0 +1,38 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://m6xsyhnt67sh"
|
||||
path.s3tc="res://.godot/imported/tendomaya_body0_tex00.png-2256e86fdf18d5c857533d2038fd1eb6.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
generator_parameters={
|
||||
"md5": "b25486677e476cae8eb50c6d6dc8ea8b"
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/player/dont_look_in_here/tendomaya_body0_tex00.png"
|
||||
dest_files=["res://.godot/imported/tendomaya_body0_tex00.png-2256e86fdf18d5c857533d2038fd1eb6.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
BIN
src/player/dont_look_in_here/tendomaya_face10_tex00.png
Normal file
BIN
src/player/dont_look_in_here/tendomaya_face10_tex00.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
@@ -0,0 +1,38 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://qxq1jjr1cojo"
|
||||
path.s3tc="res://.godot/imported/tendomaya_face10_tex00.png-7cecce20e0644b630e61b58c3cca33f8.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
generator_parameters={
|
||||
"md5": "d4587d57094eebb71486d1ee6d26a975"
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/player/dont_look_in_here/tendomaya_face10_tex00.png"
|
||||
dest_files=["res://.godot/imported/tendomaya_face10_tex00.png-7cecce20e0644b630e61b58c3cca33f8.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
BIN
src/player/dont_look_in_here/tendomaya_face20_tex00.png
Normal file
BIN
src/player/dont_look_in_here/tendomaya_face20_tex00.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
@@ -0,0 +1,38 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://blpqbhjseggd"
|
||||
path.s3tc="res://.godot/imported/tendomaya_face20_tex00.png-b681d471a8f5b5fe143eb3e299e00cfc.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
generator_parameters={
|
||||
"md5": "ad05555f2c06e187cc22ae29c209422b"
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/player/dont_look_in_here/tendomaya_face20_tex00.png"
|
||||
dest_files=["res://.godot/imported/tendomaya_face20_tex00.png-b681d471a8f5b5fe143eb3e299e00cfc.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
@@ -1,6 +1,6 @@
|
||||
~ floor_exit
|
||||
Proceed to the next floor?
|
||||
- Yes
|
||||
do SpawnNextFloor()
|
||||
do GoToNextFloor()
|
||||
- No
|
||||
=> END
|
||||
@@ -4,8 +4,21 @@ using Chickensoft.Introspection;
|
||||
using GameJamDungeon;
|
||||
using Godot;
|
||||
|
||||
public interface IFloorClearMenu : IControl
|
||||
{
|
||||
event FloorClearMenu.GoToNextFloorEventHandler GoToNextFloor;
|
||||
|
||||
event FloorClearMenu.ReturnToHubWorldEventHandler ReturnToHubWorld;
|
||||
|
||||
event FloorClearMenu.TransitionCompletedEventHandler TransitionCompleted;
|
||||
|
||||
void FadeIn();
|
||||
|
||||
void FadeOut();
|
||||
}
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class FloorClearMenu : Control
|
||||
public partial class FloorClearMenu : Control, IFloorClearMenu
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
@@ -14,15 +27,46 @@ public partial class FloorClearMenu : Control
|
||||
|
||||
[Node] public IAnimationPlayer AnimationPlayer { get; set; } = default!;
|
||||
|
||||
[Node] public Button ContinueButton { get; set; } = default!;
|
||||
|
||||
[Node] public Button ReturnToHubButton { get; set; } = default!;
|
||||
|
||||
public void FadeIn() => AnimationPlayer.Play("fade_in");
|
||||
|
||||
public void FadeOut() => AnimationPlayer.Play("fade_out");
|
||||
|
||||
[Signal]
|
||||
public delegate void TransitionCompletedEventHandler();
|
||||
[Signal]
|
||||
public delegate void GoToNextFloorEventHandler();
|
||||
[Signal]
|
||||
public delegate void ReturnToHubWorldEventHandler();
|
||||
|
||||
private void AnimationPlayer_AnimationStarted(StringName animName)
|
||||
public void OnResolved()
|
||||
{
|
||||
AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished;
|
||||
ContinueButton.Pressed += ContinueButton_Pressed;
|
||||
ReturnToHubButton.Pressed += ReturnToHubButton_Pressed;
|
||||
}
|
||||
|
||||
private void ReturnToHubButton_Pressed()
|
||||
{
|
||||
EmitSignal(SignalName.ReturnToHubWorld);
|
||||
}
|
||||
|
||||
private void ContinueButton_Pressed()
|
||||
{
|
||||
EmitSignal(SignalName.GoToNextFloor);
|
||||
}
|
||||
|
||||
private void AnimationPlayer_AnimationFinished(StringName animName)
|
||||
{
|
||||
if (animName == "fade_in")
|
||||
ContinueButton.CallDeferred(MethodName.GrabFocus);
|
||||
if (animName == "fade_out")
|
||||
{
|
||||
CallDeferred(MethodName.ReleaseFocus);
|
||||
EmitSignal(SignalName.TransitionCompleted);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,20 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://pu6gp8de3ck4"]
|
||||
[gd_scene load_steps=11 format=3 uid="uid://pu6gp8de3ck4"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/ui/floor_clear/FloorClearMenu.cs" id="1_q65kq"]
|
||||
[ext_resource type="FontFile" uid="uid://cm8j5vcdop5x0" path="res://src/ui/fonts/Mrs-Eaves-OT-Roman_31443.ttf" id="2_xk0dh"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_nc1gg"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("FloorClearMenu/LoadScreen:color")
|
||||
tracks/0/path = NodePath("FloorClearMenu:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 0)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("FloorClearMenu:modulate")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
@@ -63,14 +52,21 @@ tracks/0/keys = {
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_opfbx"]
|
||||
_data = {
|
||||
&"fade_out": SubResource("Animation_dhyvw"),
|
||||
&"fade_in": SubResource("Animation_p616x"),
|
||||
&"RESET": SubResource("Animation_nc1gg")
|
||||
"RESET": SubResource("Animation_nc1gg"),
|
||||
"fade_in": SubResource("Animation_p616x"),
|
||||
"fade_out": SubResource("Animation_dhyvw")
|
||||
}
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_phrcj"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_tmmmd"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_cyd1c"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_4bdva"]
|
||||
|
||||
[node name="FloorClearMenu" type="Control"]
|
||||
process_mode = 3
|
||||
modulate = Color(1, 1, 1, 0)
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@@ -79,8 +75,14 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_q65kq")
|
||||
|
||||
[node name="LoadScreen" type="ColorRect" parent="."]
|
||||
process_mode = 3
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
root_node = NodePath("../..")
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_opfbx")
|
||||
}
|
||||
|
||||
[node name="BG" type="ColorRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@@ -89,9 +91,49 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0.137255, 0.121569, 0.12549, 1)
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ContinueButton" type="Button" parent="CenterContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
root_node = NodePath("../..")
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_opfbx")
|
||||
}
|
||||
custom_minimum_size = Vector2(200, 50)
|
||||
layout_mode = 2
|
||||
focus_neighbor_left = NodePath(".")
|
||||
focus_neighbor_top = NodePath(".")
|
||||
focus_neighbor_right = NodePath(".")
|
||||
focus_neighbor_bottom = NodePath("../ReturnToHubButton")
|
||||
theme_override_colors/font_focus_color = Color(1, 0.94902, 0, 1)
|
||||
theme_override_colors/font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||
theme_override_fonts/font = ExtResource("2_xk0dh")
|
||||
theme_override_font_sizes/font_size = 36
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_phrcj")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_tmmmd")
|
||||
button_mask = 0
|
||||
text = "Continue"
|
||||
flat = true
|
||||
|
||||
[node name="ReturnToHubButton" type="Button" parent="CenterContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(200, 50)
|
||||
layout_mode = 2
|
||||
focus_neighbor_left = NodePath(".")
|
||||
focus_neighbor_top = NodePath("../ContinueButton")
|
||||
focus_neighbor_right = NodePath(".")
|
||||
focus_neighbor_bottom = NodePath(".")
|
||||
theme_override_colors/font_focus_color = Color(1, 0.94902, 0, 1)
|
||||
theme_override_colors/font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||
theme_override_fonts/font = ExtResource("2_xk0dh")
|
||||
theme_override_font_sizes/font_size = 36
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_cyd1c")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_4bdva")
|
||||
button_mask = 0
|
||||
text = "Return To Overworld"
|
||||
flat = true
|
||||
|
||||
@@ -16,6 +16,8 @@ public interface IInGameUI : IControl
|
||||
public void HideMiniMap();
|
||||
|
||||
public void ShowInventoryFullMessage(string rejectedItemName);
|
||||
|
||||
event InGameUI.MinimapButtonReleasedEventHandler MinimapButtonReleased;
|
||||
}
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
@@ -29,6 +31,20 @@ public partial class InGameUI : Control, IInGameUI
|
||||
|
||||
[Node] public IPlayerInfoUI PlayerInfoUI { get; set; } = default!;
|
||||
|
||||
[Node] public IUseTeleportPrompt UseTeleportPrompt { get; set; } = default!;
|
||||
|
||||
[Signal]
|
||||
public delegate void MinimapButtonReleasedEventHandler();
|
||||
|
||||
public override void _UnhandledInput(InputEvent @event)
|
||||
{
|
||||
if (@event.IsActionReleased(GameInputs.MiniMap))
|
||||
{
|
||||
GD.Print("MiniMap button released");
|
||||
EmitSignal(SignalName.MinimapButtonReleased);
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowInventoryFullMessage(string rejectedItemName)
|
||||
{
|
||||
PlayerInfoUI.DisplayInventoryFullMessage(rejectedItemName);
|
||||
@@ -41,6 +57,7 @@ public partial class InGameUI : Control, IInGameUI
|
||||
|
||||
public void HideMiniMap()
|
||||
{
|
||||
MiniMap.SetProcessUnhandledInput(false);
|
||||
MiniMap.Hide();
|
||||
}
|
||||
|
||||
@@ -52,6 +69,7 @@ public partial class InGameUI : Control, IInGameUI
|
||||
|
||||
public void ShowMiniMap()
|
||||
{
|
||||
MiniMap.Hide();
|
||||
MiniMap.SetProcessUnhandledInput(true);
|
||||
MiniMap.Show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,76 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://b1muxus5qdbeu"]
|
||||
[gd_scene load_steps=17 format=3 uid="uid://b1muxus5qdbeu"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/ui/in_game_ui/InGameUI.cs" id="1_sc13i"]
|
||||
[ext_resource type="PackedScene" uid="uid://bwbofurcvf3yh" path="res://src/minimap/Minimap.tscn" id="2_6sfje"]
|
||||
[ext_resource type="PackedScene" uid="uid://dlj8qdg1c5048" path="res://src/inventory_menu/InventoryMenu.tscn" id="3_4vcdl"]
|
||||
[ext_resource type="PackedScene" uid="uid://dxl8il8f13c2x" path="res://src/ui/player_ui/PlayerInfoUI.tscn" id="4_46s5l"]
|
||||
[ext_resource type="FontFile" uid="uid://cm8j5vcdop5x0" path="res://src/ui/fonts/Mrs-Eaves-OT-Roman_31443.ttf" id="5_pmvvi"]
|
||||
[ext_resource type="Script" path="res://src/ui/in_game_ui/UseTeleportPrompt.cs" id="5_uhl2q"]
|
||||
[ext_resource type="Script" path="res://src/utils/FpsCounter.cs" id="7_c6o8j"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ahhj2"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_1tca4"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_crnka"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_yoep7"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_cmr8o"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_efhb5"]
|
||||
resource_name = "fade_in"
|
||||
length = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ibgld"]
|
||||
resource_name = "fade_out"
|
||||
length = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_xrfau"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_7x216"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_xrfau"),
|
||||
"fade_in": SubResource("Animation_efhb5"),
|
||||
"fade_out": SubResource("Animation_ibgld")
|
||||
}
|
||||
|
||||
[node name="InGameUI" type="Control"]
|
||||
process_mode = 3
|
||||
@@ -32,3 +99,80 @@ unique_name_in_owner = true
|
||||
process_mode = 3
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
|
||||
[node name="UseTeleportPrompt" type="Control" parent="."]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("5_uhl2q")
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="UseTeleportPrompt"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="UseTeleportPrompt/CenterContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="MovePrompt" type="Label" parent="UseTeleportPrompt/CenterContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||
theme_override_fonts/font = ExtResource("5_pmvvi")
|
||||
theme_override_font_sizes/font_size = 50
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_ahhj2")
|
||||
text = "Move to the next floor?"
|
||||
|
||||
[node name="YesButton" type="Button" parent="UseTeleportPrompt/CenterContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(100, 0)
|
||||
layout_mode = 2
|
||||
focus_neighbor_left = NodePath(".")
|
||||
focus_neighbor_top = NodePath(".")
|
||||
focus_neighbor_right = NodePath(".")
|
||||
focus_neighbor_bottom = NodePath("../NoButton")
|
||||
theme_override_colors/font_focus_color = Color(1, 0.94902, 0, 1)
|
||||
theme_override_colors/font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||
theme_override_fonts/font = ExtResource("5_pmvvi")
|
||||
theme_override_font_sizes/font_size = 50
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_1tca4")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_crnka")
|
||||
button_mask = 0
|
||||
text = "Yes"
|
||||
|
||||
[node name="NoButton" type="Button" parent="UseTeleportPrompt/CenterContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
focus_neighbor_left = NodePath(".")
|
||||
focus_neighbor_top = NodePath("../YesButton")
|
||||
focus_neighbor_right = NodePath(".")
|
||||
focus_neighbor_bottom = NodePath(".")
|
||||
theme_override_colors/font_focus_color = Color(1, 0.94902, 0, 1)
|
||||
theme_override_colors/font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||
theme_override_fonts/font = ExtResource("5_pmvvi")
|
||||
theme_override_font_sizes/font_size = 50
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_yoep7")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_cmr8o")
|
||||
button_mask = 0
|
||||
text = "No"
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="UseTeleportPrompt"]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_7x216")
|
||||
}
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_right = 0.021
|
||||
anchor_bottom = 0.021
|
||||
offset_right = -0.320004
|
||||
offset_bottom = 0.319998
|
||||
script = ExtResource("7_c6o8j")
|
||||
|
||||
29
src/ui/in_game_ui/UseTeleportPrompt.cs
Normal file
29
src/ui/in_game_ui/UseTeleportPrompt.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
|
||||
public interface IUseTeleportPrompt : IControl;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class UseTeleportPrompt : Control
|
||||
{
|
||||
[Node] public Button YesButton { get; set; } = default!;
|
||||
|
||||
[Node] public Button NoButton { get; set; } = default!;
|
||||
|
||||
[Node] public AnimationPlayer AnimationPlayer { get; set; } = default!;
|
||||
|
||||
public void OnResolved()
|
||||
{
|
||||
AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished;
|
||||
}
|
||||
|
||||
private void AnimationPlayer_AnimationFinished(StringName animName)
|
||||
{
|
||||
if (animName == "fade_in")
|
||||
YesButton.CallDeferred(MethodName.GrabFocus);
|
||||
if (animName == "fade_out")
|
||||
CallDeferred(MethodName.ReleaseFocus);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Chickensoft.Introspection;
|
||||
using GameJamDungeon;
|
||||
using Godot;
|
||||
|
||||
public interface IPauseMenu : IControl
|
||||
{
|
||||
void FadeIn();
|
||||
void FadeOut();
|
||||
|
||||
event PauseMenu.UnpauseButtonPressedEventHandler UnpauseButtonPressed;
|
||||
event PauseMenu.TransitionCompletedEventHandler TransitionCompleted;
|
||||
}
|
||||
|
||||
@@ -18,10 +19,12 @@ public partial class PauseMenu : Control, IPauseMenu
|
||||
|
||||
[Signal]
|
||||
public delegate void TransitionCompletedEventHandler();
|
||||
[Signal]
|
||||
public delegate void UnpauseButtonPressedEventHandler();
|
||||
|
||||
[Node] public IAnimationPlayer AnimationPlayer { get; set; } = default!;
|
||||
|
||||
public void OnReady()
|
||||
public void OnResolved()
|
||||
{
|
||||
AnimationPlayer.AnimationFinished += OnAnimationFinished;
|
||||
}
|
||||
@@ -30,6 +33,13 @@ public partial class PauseMenu : Control, IPauseMenu
|
||||
|
||||
public void FadeOut() => AnimationPlayer.Play("fade_out");
|
||||
|
||||
public void OnAnimationFinished(StringName name)
|
||||
=> EmitSignal(SignalName.TransitionCompleted);
|
||||
public override void _UnhandledInput(InputEvent @event)
|
||||
{
|
||||
if (@event.IsActionPressed(GameInputs.Pause))
|
||||
EmitSignal(SignalName.UnpauseButtonPressed);
|
||||
}
|
||||
|
||||
public void OnAnimationFinished(StringName name)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user