From 0fb7f1e7eee8f21c2ac0cd4f93d50dfe495d60d9 Mon Sep 17 00:00:00 2001 From: nathan Date: Mon, 18 May 2026 21:08:14 -0700 Subject: [PATCH] Add MVP inventory UI toggle --- AGRARIAN_DEVELOPMENT_ROADMAP.md | 2 +- Scripts/verify_mvp_inventory_ui_toggle.py | 55 +++++++++++++++++++ .../AgrarianGamePlayerController.cpp | 14 +++++ .../AgrarianGamePlayerController.h | 3 + 4 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 Scripts/verify_mvp_inventory_ui_toggle.py diff --git a/AGRARIAN_DEVELOPMENT_ROADMAP.md b/AGRARIAN_DEVELOPMENT_ROADMAP.md index 8b958eb..146ecb4 100644 --- a/AGRARIAN_DEVELOPMENT_ROADMAP.md +++ b/AGRARIAN_DEVELOPMENT_ROADMAP.md @@ -799,7 +799,7 @@ Target deliverable: A small group can join a server, spawn into one biome, gathe - [x] Add join server screen. Added a native `JoinServer` frontend screen showing the selected character and `play.agrariangame.com:7777`, with keyboard flow from character selection and a dev command to display the screen directly. - [x] Add loading screen. Added a native `Loading` frontend screen with Ground Zero preparation copy, selected character/server context, a deterministic placeholder progress bar, and join-screen keyboard flow into loading. - [x] Add HUD. Completed the MVP HUD pass with a separate `bShowMvpHudFrame` top status frame showing Ground Zero context, alive/dead state, health, food, water, and body temperature, while keeping the deeper developer overlay separately toggleable. -- [ ] Add inventory UI. +- [x] Add inventory UI. Promoted the existing compact replicated-inventory HUD panel into the 0.1.N UI pass with `AgrarianToggleInventoryUI`, keeping the MVP inventory surface lightweight while full drag/drop inventory remains later work. - [ ] Add crafting UI. - [ ] Add interaction prompts. - [ ] Add death/respawn UI. diff --git a/Scripts/verify_mvp_inventory_ui_toggle.py b/Scripts/verify_mvp_inventory_ui_toggle.py new file mode 100644 index 0000000..4505e0b --- /dev/null +++ b/Scripts/verify_mvp_inventory_ui_toggle.py @@ -0,0 +1,55 @@ +from pathlib import Path + + +ROOT = Path(__file__).resolve().parents[1] +FILES = { + "AgrarianDebugHUD.h": ROOT / "Source" / "AgrarianGame" / "AgrarianDebugHUD.h", + "AgrarianDebugHUD.cpp": ROOT / "Source" / "AgrarianGame" / "AgrarianDebugHUD.cpp", + "AgrarianGamePlayerController.h": ROOT / "Source" / "AgrarianGame" / "AgrarianGamePlayerController.h", + "AgrarianGamePlayerController.cpp": ROOT / "Source" / "AgrarianGame" / "AgrarianGamePlayerController.cpp", + "AGRARIAN_DEVELOPMENT_ROADMAP.md": ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md", +} + +EXPECTED = { + "AgrarianDebugHUD.h": [ + "bShowInventoryHUD", + "DrawInventoryPanel", + ], + "AgrarianDebugHUD.cpp": [ + "DrawInventoryPanel(AgrarianCharacter)", + "INVENTORY %d/%d slots %.1f wt", + "InventoryComponent->GetTotalWeight()", + ], + "AgrarianGamePlayerController.h": [ + "AgrarianToggleInventoryUI", + ], + "AgrarianGamePlayerController.cpp": [ + "#include \"AgrarianDebugHUD.h\"", + "AgrarianToggleInventoryUI", + "bShowInventoryHUD = !AgrarianHUD->bShowInventoryHUD", + "MVP inventory UI shown.", + "MVP inventory UI hidden.", + ], + "AGRARIAN_DEVELOPMENT_ROADMAP.md": [ + "[x] Add inventory UI.", + "`AgrarianToggleInventoryUI`", + ], +} + + +def main(): + missing = [] + for label, path in FILES.items(): + text = path.read_text(encoding="utf-8") + for snippet in EXPECTED[label]: + if snippet not in text: + missing.append(f"{label}: {snippet}") + + if missing: + raise RuntimeError("MVP inventory UI toggle verification failed: " + "; ".join(missing)) + + print("Agrarian MVP inventory UI toggle verification complete.") + + +if __name__ == "__main__": + main() diff --git a/Source/AgrarianGame/AgrarianGamePlayerController.cpp b/Source/AgrarianGame/AgrarianGamePlayerController.cpp index e66bdb7..a16e850 100644 --- a/Source/AgrarianGame/AgrarianGamePlayerController.cpp +++ b/Source/AgrarianGame/AgrarianGamePlayerController.cpp @@ -4,6 +4,7 @@ #include "AgrarianGamePlayerController.h" #include "AgrarianCampfire.h" #include "AgrarianCraftingComponent.h" +#include "AgrarianDebugHUD.h" #include "AgrarianGameCharacter.h" #include "AgrarianInventoryComponent.h" #include "AgrarianItemPickup.h" @@ -280,6 +281,19 @@ void AAgrarianGamePlayerController::AgrarianCraftStatus() } } +void AAgrarianGamePlayerController::AgrarianToggleInventoryUI() +{ + AAgrarianDebugHUD* AgrarianHUD = GetHUD(); + if (!AgrarianHUD) + { + ClientMessage(TEXT("No Agrarian HUD is active.")); + return; + } + + AgrarianHUD->bShowInventoryHUD = !AgrarianHUD->bShowInventoryHUD; + ClientMessage(AgrarianHUD->bShowInventoryHUD ? TEXT("MVP inventory UI shown.") : TEXT("MVP inventory UI hidden.")); +} + void AAgrarianGamePlayerController::AgrarianSelectCharacter(FName Archetype) { if (!MvpFrontendWidget) diff --git a/Source/AgrarianGame/AgrarianGamePlayerController.h b/Source/AgrarianGame/AgrarianGamePlayerController.h index d52a722..67c195a 100644 --- a/Source/AgrarianGame/AgrarianGamePlayerController.h +++ b/Source/AgrarianGame/AgrarianGamePlayerController.h @@ -91,6 +91,9 @@ public: UFUNCTION(Exec) void AgrarianCraftStatus(); + UFUNCTION(Exec) + void AgrarianToggleInventoryUI(); + UFUNCTION(Exec) void AgrarianSelectCharacter(FName Archetype);