LogoPixi’VN
내레이션JS/TS로 내레이션

입력 프롬프트

Pixi’VN에서 플레이어에게 입력을 요청하는 방법을 설명합니다. 입력 요청의 사용법, 조회, 제거 방법을 포함합니다.

UI 화면

입력 프롬프트 대화 UI의 예시는 인터페이스 예시 섹션에서 확인할 수 있습니다.

ink

이 메서드는 ink 문법과 함께 사용할 수 있습니다. 자세한 내용은 여기를 참고하세요.

비주얼 노벨에서는 플레이어에게 텍스트, 숫자, 날짜 또는 기타 값을 입력하도록 요청해야 할 수 있습니다.

Pixi’VN은 입력 프롬프트를 처리하는 함수를 제공합니다. 개발자는 플레이어에게 값을 입력하도록 요구할 수 있으며(값이 제공될 때까지 게임이 진행되지 않습니다), UI가 프롬프트를 표시하는 역할을 담당합니다.

요청

To prompt the player for input, use the narration.input.request function.

content/labels/start.label.ts
import { narration, newLabel } from "@drincs/pixi-vn";

export const startLabel = newLabel("start", [
    () => {
        narration.dialogue = "Hello";
    },
    () => {
        narration.dialogue = "What is your name?";
        narration.input.request({ type: "string" });
    },
    () => {
        narration.dialogue = `My name is ${narration.input.value}`;
    },
    () => {
        narration.dialogue = "How old are you?";
        narration.input.request({ type: "number" }, 18);
    },
    () => {
        narration.dialogue = `I am ${narration.input.value} years old`;
    },
    () => {
        narration.dialogue = "Describe who you are:";
        narration.input.request({ type: "html textarea" });
    },
    () => {
        narration.dialogue = `${narration.input.value}`;
    },
    () => {
        narration.dialogue = "Restart";
    },
]);

가져오기

입력 프롬프트 정보를 조회하려면 다음을 사용하세요.

if (narration.input.isRequired) {
    openInputModal(narration.input.type);
}

제거

To remove the input prompt request, use narration.input.removeRequest.

narration.input.removeRequest();

이 페이지에서