58 lines
1.8 KiB
Python
58 lines
1.8 KiB
Python
#!/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, FMath::Clamp(MasterVolume * UiVolume, 0.0f, 1.0f));",
|
|
"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()
|