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

입력 프롬프트

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

UI 화면

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

ink

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

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

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

요청

플레이어에게 입력을 요청하려면 narration.requestInput 함수를 사용하세요.

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.requestInput({ type: "string" });
    },
    () => {
        narration.dialogue = `My name is ${narration.inputValue}`;
    },
    () => {
        narration.dialogue = "How old are you?";
        narration.requestInput({ type: "number" }, 18);
    },
    () => {
        narration.dialogue = `I am ${narration.inputValue} years old`;
    },
    () => {
        narration.dialogue = "Describe who you are:";
        narration.requestInput({ type: "html textarea" });
    },
    () => {
        narration.dialogue = `${narration.inputValue}`;
    },
    () => {
        narration.dialogue = "Restart";
    },
]);

가져오기

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

if (narration.isRequiredInput) {
    openInputModal(narration.inputType);
}

제거

입력 프롬프트 요청을 제거하려면 narration.removeInputRequest를 사용하세요.

narration.removeInputRequest();

이 페이지에서