UI 수정

This commit is contained in:
2026-07-26 19:25:03 +09:00
parent 880732dd33
commit 887968fcfd
8 changed files with 68 additions and 8 deletions

Binary file not shown.

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1d446a26b15675f42a35cbd918bb81f8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View 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}번째 대화를 골랐구나.", "테스트");
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 343d04c3929d77e4fbc36510d86b8736

View File

@@ -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;
}

View File

@@ -1,7 +1,7 @@
<ui:UXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
<ui:VisualElement name="Body" style="flex-grow: 1; align-items: center; justify-content: center;">
<ui:VisualElement name="Row" style="flex-grow: 0; width: 360px; height: 30px; flex-shrink: 0; background-color: rgb(255, 252, 220); justify-content: center; align-items: center;">
<ui:Label text="Label" style="color: rgb(255, 85, 94); -unity-font-style: bold;"/>
<ui:VisualElement name="Body" style="flex-grow: 1; align-items: center; justify-content: center; width: 800px; height: 100px;">
<ui:VisualElement name="Row" style="flex-grow: 0; width: 720px; height: 72px; flex-shrink: 0; background-color: rgb(255, 252, 220); justify-content: center; align-items: center;">
<ui:Label text="Label" name="Label" style="color: rgb(255, 85, 94); -unity-font-style: bold; font-size: 48px;"/>
</ui:VisualElement>
</ui:VisualElement>
</ui:UXML>

View File

@@ -2,7 +2,7 @@
<ui:VisualElement name="Body" style="flex-grow: 1; width: 1920px; height: 1080px;">
<ui:VisualElement name="Overlay" style="flex-grow: 1; background-color: rgba(0, 0, 0, 0.502); justify-content: center; align-items: center;">
<ui:VisualElement name="DialogList" style="flex-grow: 0; width: 50%; height: 70%; align-self: center; align-content: flex-start; justify-content: center; margin-bottom: 0; flex-shrink: 0; translate: 0 -50px; align-items: center;">
<ui:ListView item-template="project://database/Assets/08_UI/DialogEnterRow.uxml?fileID=9197481963319205126&amp;guid=2e6fe492031ca054a9d695b6ba0120a9&amp;type=3#DialogEnterRow" style="flex-shrink: 0; width: 800px; height: 600px;"/>
<ui:ListView item-template="project://database/Assets/08_UI/DialogEnterRow.uxml?fileID=9197481963319205126&amp;guid=2e6fe492031ca054a9d695b6ba0120a9&amp;type=3#DialogEnterRow" name="ListView" fixed-item-height="120" style="flex-shrink: 0; width: 800px; height: 600px; justify-content: center;"/>
</ui:VisualElement>
</ui:VisualElement>
</ui:VisualElement>