UI 수정
This commit is contained in:
8
Assets/02_Scripts/_Debug.meta
Normal file
8
Assets/02_Scripts/_Debug.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d446a26b15675f42a35cbd918bb81f8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
51
Assets/02_Scripts/_Debug/DialogUITester.cs
Normal file
51
Assets/02_Scripts/_Debug/DialogUITester.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
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++;
|
||||
}
|
||||
|
||||
// Tab → 대화 선택 메뉴 표시
|
||||
if (kb.tabKey.wasPressedThisFrame && DialogEnterHud.Instance != null)
|
||||
_ = ShowMenu();
|
||||
}
|
||||
|
||||
private async Awaitable ShowMenu()
|
||||
{
|
||||
var options = new List<DialogChoice>
|
||||
{
|
||||
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}번째 대화를 골랐구나.", "테스트");
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/_Debug/DialogUITester.cs.meta
Normal file
2
Assets/02_Scripts/_Debug/DialogUITester.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 343d04c3929d77e4fbc36510d86b8736
|
||||
@@ -52,7 +52,6 @@ private bool EnsureRefs()
|
||||
if (_listView != null)
|
||||
{
|
||||
_listView.selectionType = SelectionType.Single;
|
||||
_listView.fixedItemHeight = 40; // 행 높이 (필요하면 인스펙터의 Fixed Item Height로 조정)
|
||||
_listView.bindItem = BindRow; // item-template(DialogEnterRow)이 makeItem을 담당, 바인딩만 우리가
|
||||
_listView.selectionChanged += OnSelectionChanged;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user