Add MVP frontend audio hooks

This commit is contained in:
2026-05-19 12:35:30 -07:00
parent f6e126aabb
commit d0ad64418d
5 changed files with 99 additions and 1 deletions
+57
View File
@@ -0,0 +1,57 @@
#!/usr/bin/env python3
"""Verify MVP frontend UI sound hooks are present."""
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
UI_H = ROOT / "Source" / "AgrarianGame" / "AgrarianMvpFrontendWidget.h"
UI_CPP = ROOT / "Source" / "AgrarianGame" / "AgrarianMvpFrontendWidget.cpp"
TDD = ROOT / "Docs" / "TechnicalDesignDocument.md"
ROADMAP = ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md"
REQUIRED = {
UI_H: [
"TObjectPtr<USoundBase> UiConfirmSound;",
"TObjectPtr<USoundBase> UiBackSound;",
"TObjectPtr<USoundBase> UiSelectionSound;",
"TObjectPtr<USoundBase> UiSaveQuitSound;",
"void PlayUiSound(USoundBase* Sound) const;",
],
UI_CPP: [
"#include \"Kismet/GameplayStatics.h\"",
"UGameplayStatics::PlaySound2D(this, Sound);",
"PlayUiSound(UiConfirmSound);",
"PlayUiSound(UiBackSound);",
"PlayUiSound(UiSelectionSound);",
"PlayUiSound(UiSaveQuitSound);",
"HandlePrimaryActionClicked",
"HandleBackClicked",
"HandleMaleCharacterClicked",
"NativeOnKeyDown",
],
TDD: [
"UI sounds are optional 2D hooks",
"confirm, back, selection, and save/quit sound",
"Keyboard and mouse",
],
ROADMAP: [
"[x] Add UI sounds.",
],
}
def main() -> None:
missing = []
for path, snippets in REQUIRED.items():
text = path.read_text(encoding="utf-8")
for snippet in snippets:
if snippet not in text:
missing.append(f"{path.relative_to(ROOT)} missing {snippet!r}")
if missing:
raise SystemExit("FAILED: " + "; ".join(missing))
print("OK: UI sound hooks are shared across keyboard and mouse actions.")
if __name__ == "__main__":
main()