using System.Collections.Generic; using UnityEngine; using UnityEngine.InputSystem; // 임시 테스트용 — 실제 대화 시스템(NPC/StoryDatabase) 없이 UI만 확인한다. // 씬의 아무 빈 오브젝트에 붙이고 Play: // Space → 대사 HUD(DialogHud)에 다음 대사 표시 // Tab → 대화 선택 메뉴(DialogEnterHud) 띄우기 (행 클릭 시 결과 표시) // 확인이 끝나면 이 스크립트/오브젝트는 삭제해도 된다. public class DialogUITester : MonoBehaviour { private readonly string[] _lines = { "안녕, 이건 테스트 대사야.", "UI가 화면 하단에 잘 보이면 성공이다.", "다음 줄로 넘어가려면 스페이스를 눌러.", }; private int _index; private void Update() { var kb = Keyboard.current; if (kb == null) return; // Space → 대사 HUD 표시 if (kb.spaceKey.wasPressedThisFrame && DialogHud.Instance != null) { DialogHud.Instance.Show(null, _lines[_index % _lines.Length], "테스트"); _index++; } // T → 대화 선택 메뉴 표시 if (kb.tKey.wasPressedThisFrame && DialogEnterHud.Instance != null) _ = ShowMenu(); } private async Awaitable ShowMenu() { var options = new List { new() { ChoiceText = "첫 번째 대화" }, new() { ChoiceText = "두 번째 대화" }, new() { ChoiceText = "세 번째 대화" }, }; int picked = await DialogEnterHud.Instance.Show(options); Debug.Log($"[DialogUITester] 선택됨: {picked}"); if (DialogHud.Instance != null) DialogHud.Instance.Show(null, $"{picked + 1}번째 대화를 골랐구나.", "테스트"); } }