# Wonderland Engine

Wonderland 패키지(`packages/sdk-engines/wonderland`)는 **Wonderland Engine 1.x** 웹 프로젝트용 TypeScript 패키지입니다. `ZokoSDK`는 `window.ZokoGames.SDK`를 감싼 프로미스 기반 래퍼로 이름이 JavaScript SDK와 같습니다(`ZokoSDK.game.gameplayStart()`). **zoko-sdk** 컴포넌트는 이를 초기화하고 다른 모든 컴포넌트에서 접근할 수 있게 하며, 광고가 재생되는 동안 씬을 멈추고 오디오를 음소거하고, 포털의 음소거 설정을 따르고, 포털의 로딩 바를 끝내고, 피드백 양식에 캔버스 그림으로 답합니다. "midgame", "rewarded" 같은 용어는 [용어집](https://docs.zokogames.com/kr/getting-started/glossary)에 있습니다.

> [!NOTE]
> 플러그인 1.7.3. `@wonderlandengine/api` 1.6.1에 대해 strict 모드로 타입 검사했고 엔진 스텁으로 단위 테스트했습니다. 2026-11-23에 Wonderland Editor 1.6.1로 검증했습니다. 에디터가 패키징한 프로젝트는 실제 런타임에서 플러그인을 실행하며 프로덕션 검사 12개 영역을 모두 통과합니다. 런타임에서 확인한 것: SDK는 한 번만 시작되고, 일시 중지 대상 타입의 컴포넌트는 광고 중 비활성화되었다가 복원되며, 플러그인이 추적하는 오디오 컨텍스트는 광고 중 일시 중단되었다가 재개되고, 배너 투영은 타당한 사각형을 냅니다. 아직 미검증: 엔진 자체 내장 오디오 소스, XR 세션, 부분 뷰포트를 가진 카메라. 문제가 있으면 에디터 버전과 정확한 오류를 [지원](https://docs.zokogames.com/kr/business/support)으로 보내 주세요. 1.7.3 릴리스는 스크립트 로드 제한 시간만 추가하며 단위 테스트로 검증했습니다. 2026-11-23 엔진과 운영에서 재실행(12개 영역).

## 설치 {#install}

Wonderland 패키지를 내려받으세요: [/sdk-engines/zokogames-wonderland-1.7.3.zip](https://www.zokogames.com/sdk-engines/zokogames-wonderland-1.7.3.zip) (저장소의 폴더와 같은 파일입니다).

[/sdk-engines/wonderland.zip](https://www.zokogames.com/sdk-engines/wonderland.zip)은 항상 최신 버전입니다. 체크섬: [`/sdk-engines/SHA256SUMS`](https://www.zokogames.com/sdk-engines/SHA256SUMS). 모든 엔진 패키지의 버전, 크기, SHA-256 목록: [`/sdk-engines/engines.json`](https://www.zokogames.com/sdk-engines/engines.json).

1. 패키지의 `src/` 폴더를 프로젝트의 `js/` 폴더에 `js/zokogames/`로 복사하세요(`ZokoSDK.ts`, `ZokoSdkComponent.ts`, `ZokoClient.ts`, `ZokoTypes.ts`, `ZokoSimulator.ts`, 도우미 `ZokoPause.ts`, `ZokoAdFlow.ts`, `ZokoProjection.ts`). 에디터는 `js/` 아래의 `.ts` 파일을 컴파일합니다.
2. 에디터가 컴포넌트를 인식하게 하세요. 에디터 1.6.1은 `js/` 바로 아래 파일에서만 컴포넌트를 나열하고 하위 폴더는 보지 않습니다. `export { ZokoSdkComponent } from './zokogames/index';`를 담은 `js/zoko-sdk-component.ts`를 만들고(`examples/zoko-sdk-component.ts` 참고), `js/index.js`에 `engine.registerComponent(ZokoSdkComponent)`(`./zokogames/index`에서 가져옴)를 추가한 뒤 **Rebuild**를 누르세요.
3. 첫 씬의 오브젝트에 **zoko-sdk** 컴포넌트를 추가하세요.
4. 에디터가 생성하는 페이지(패키징된 페이지는 자체 HTML 템플릿 사용)의 `<head>`에, 엔진 스크립트보다 앞서 `https://sdk.zokogames.com/zokogames-sdk-v1.js` 스크립트 태그를 하나 넣으세요. 태그가 없으면 래퍼가 첫 `ready()`에서 스크립트를 주입하지만, 업로드 검증기는 이 태그를 찾으므로 꼭 추가하세요.

## 어떤 경로를 따를까

| 해당하는 경우 | 할 일 |
| --- | --- |
| 웹 빌드를 만드는 Wonderland 개발자 | 폴더를 복사하고 컴포넌트를 추가한 뒤, 아래처럼 광고와 저장 호출을 감싸고 패키징해 업로드하세요. |
| 순수 TypeScript 테스트를 작성하는 경우 | `@wonderlandengine/api`를 임포트하는 `ZokoSDK.ts` 대신 `ZokoClient.ts`(엔진 임포트 없음)를 사용하세요. |

## 동작하는 컴포넌트 {#a-working-component}

초기화, 미드게임 광고, 보상형 광고, 게임플레이 시작과 중지, 저장과 불러오기, 리더보드 점수를 다루는 컴포넌트 하나입니다. `ZokoSDK.requestAd` 동안 씬과 오디오는 저절로 멈추므로, 컴포넌트는 자신의 로직만 멈추면 됩니다.

```ts
import { Component } from "@wonderlandengine/api";
import { ZokoSDK } from "./zokogames/index";

export class Boot extends Component {
  static TypeName = "boot";
  private live = false;

  async start() {
    try { await ZokoSDK.ready(); } catch (e) { console.warn("ZokoGames init failed", e); }
    this.live = ZokoSDK.isAvailable;                       // initialised and not "disabled"
    if (!this.live) return this.beginGame();               // the game must run without the portal
    const best = Number(ZokoSDK.data.getItem("best") ?? "0") || 0;   // load: synchronous
    this.beginGame(best);
  }

  update(dt: number) {
    if (ZokoSDK.paused) return;                            // an ad is playing
    // ... your game logic
  }

  async showAd(type: "midgame" | "rewarded"): Promise<boolean> {
    if (!this.live) return false;
    const { finished, error } = await ZokoSDK.requestAd(type);   // never rejects for ad problems
    if (error) console.log("no ad:", error.code);                // adCooldown, unfilled, adblock ...
    return finished;
  }

  async onRewardClicked() { if (await this.showAd("rewarded")) this.grantReward(); }   // reward only when finished
  async onRoundEnded(score: number) {
    this.onPlayStop();
    this.save(score);
    await this.submitScore(score);
    await this.showAd("midgame");                          // natural break
  }

  onPlayStart() { if (this.live) void ZokoSDK.game.gameplayStart().catch(() => {}); }
  onPlayStop()  { if (this.live) void ZokoSDK.game.gameplayStop().catch(() => {}); }

  save(score: number) {
    if (!this.live) return;
    try { ZokoSDK.data.setItem("best", String(score)); }     // synchronous; uploaded in the background
    catch (e) { console.warn((e as { code?: string }).code); } // dataLimitExceeded
  }

  async submitScore(score: number) {
    if (!this.live) return;
    try {
      const user = await ZokoSDK.user.getUser();
      if (!user) return;                                     // guests are not ranked
      // "" works only on a board WITHOUT an encryption key; see leaderboards for the encrypted form.
      await ZokoSDK.user.submitScore({ encryptedScore: "", score });
    } catch (e) { console.warn((e as { code?: string }).code); }
  }

  private beginGame(_best = 0) { this.onPlayStart(); }
  private grantReward() { /* ... */ }
}
```

웹 빌드에서는 Wonderland TypeScript가 Web Crypto API가 있는 페이지 안에서 실행되므로, 키가 있는 리더보드를 여기서 쓰는 것이 현실적입니다. [리더보드 페이지](https://docs.zokogames.com/kr/sdk/leaderboards#client-submission)의 `encryptScore` 함수에 `user.__dangerousUserId`와 게임 id를 넘기고, 그 결과를 `encryptedScore`로 보내세요. 브라우저에 담아 보낸 키는 읽을 수 있다는 점에 유의하세요. 실제로 중요한 경우에는 점수를 서버에서 계산하세요.

## zoko-sdk 컴포넌트

| 속성 | 기본값 | 의미 |
| --- | --- | --- |
| `syncMute` | 켬 | 포털의 `muteAudio` 설정을 따릅니다. |
| `pauseTypes` | `animation` | 씬이 일시 중지된 동안 멈출 컴포넌트 타입 이름을 쉼표로 구분합니다. `animation` 컴포넌트는 일시 중지와 재개되고, 그 밖의 타입(`physx` 같은 네이티브 또는 직접 만든 TypeName)은 비활성화와 재활성화됩니다. |
| `captureAudio` | 켬 | `AudioContext`를 감싸 이후 만들어지는 모든 컨텍스트가 씬과 함께 중지되게 합니다. |
| `reportLoading` | 켬 | 엔진의 로딩 화면이 끝나면 `game.loadingStop()`을 호출합니다. |
| `screenshots` | 켬 | 포털의 피드백 양식에 캔버스의 JPG로 답합니다. |
| `simulator` | 끔 | SDK 스크립트를 불러오지 못할 때(오프라인 미리보기) 내장 시뮬레이터를 사용합니다. |

Wonderland에는 씬 전체를 멈추는 스위치가 없으므로 일시 중지는 명시적입니다. `pauseTypes`가 멈출 대상을 지정하고, 직접 만든 컴포넌트는 `ZokoSDK.paused`를 읽습니다(또는 `ZokoSDK.events.pause`와 `resume`을 수신합니다). 오디오는 래퍼가 추적한 모든 Web Audio `AudioContext`(컴포넌트의 `init()` 이후에 생성된 것. 더 일찍 `ZokoSDK.captureAudio()`를 호출하거나, 직접 가진 것은 `ZokoSDK.audio.track(context)`), Howler, `<audio>`와 `<video>` 요소에서 음소거됩니다. `ZokoSDK.pauseScene(reason)`과 `resumeScene(reason)`은 직접 거는 일시 중지(일시 중지 메뉴)에 같은 일을 하며, 여러 번 건 일시 중지는 횟수를 셉니다. XR 세션 중에는 광고가 거부되고(먼저 세션을 끝내세요), 피드백 스크린샷은 XR이나 숨겨진 탭에서 `null`입니다. `pauseTypes`는 나열한 타입만 비활성화하며 `physx`는 속도를 잃습니다.

## 상태와 시뮬레이터

<!-- search: headings-only -->

| 멤버 | 의미 |
| --- | --- |
| `ZokoSDK.ready()`(또는 `init()`) | 가장 먼저 한 번 호출합니다. 두 번 호출해도 안전합니다. 스크립트를 불러오지 못하면 시뮬레이터가 켜져 있지 않은 한 `sdkNotLoaded`로 거부됩니다. |
| `ZokoSDK.isInitialized`, `isAvailable`, `isSimulated`, `isSupportedPlatform` | 초기화됨, 초기화되었고 비활성화되지 않음, 시뮬레이터가 응답 중, 브라우저에서 실행 중. |
| `ZokoSDK.environment` | `"local"`, `"zokogames"`, `"disabled"` 중 하나입니다. |
| `ZokoSDK.isQaTool` | QA 도구에서 실행 중입니다. |
| `ZokoSDK.paused` | 광고나 `pauseScene()`으로 씬이 일시 중지되었습니다. |
| `ZokoSDK.events` | Wonderland 이미터: `ready`, `adStarted`, `adFinished`, `adError`, `settingsChange`, `offlineChange`, `roomLeft`, `pause`, `resume`. |

`ZokoSDK.configureSimulator(options)`는 시뮬레이터를 조정하며, `ready()` 전에 호출하세요. 옵션: `disabled`, `accountAvailable`, `loggedIn`, `username`, `userId`, `friendCount`, `adBehaviour`(`"fill"`, `"no_fill"`, `"error"`), `adDurationMs`(기본값 1500), `adblock`, `muteAudio`, `disableChat`, `kidsMode`, `instantMultiplayer`, `offline`, `storeAvailable`, `verbose`.

## 매핑 {#mapping}

<!-- search: headings-only -->

이름은 JavaScript와 같고 호출은 프로미스를 반환합니다(`data` 호출은 동기입니다). 오류는 일반 `{ code, message }` 객체입니다.

| JavaScript | Wonderland (TypeScript) |
| --- | --- |
| `SDK.init()` | `await ZokoSDK.ready()` |
| `SDK.ad.hasAdblock()` | `await ZokoSDK.ad.hasAdblock()` |
| `SDK.ad.requestAd(type, cbs)` | `await ZokoSDK.requestAd(type, cbs?)`(씬과 오디오를 멈추고 `{ finished, error? }`로 이행) 또는 원시 `await ZokoSDK.ad.requestAd(type, { adStarted, adFinished, adError })` |
| `SDK.banner.requestBanner(...)` | `ZokoSDK.banner.requestBanner(...)`(DOM 컨테이너 필요) 또는 `ZokoSDK.requestBannerForObject(id, object, width, height, size?)` |
| `SDK.banner.requestResponsiveBanner(id)`, `clearBanner(id)`, `clearAllBanners()` | `ZokoSDK.banner`의 같은 이름 |
| `SDK.game.*`, `SDK.user.*`, `SDK.data.*`, `SDK.store.*`, `SDK.analytics.*` | 같은 이름입니다(`game.loadingProgress`, `addOfflineListener` / `removeOfflineListener`가 있는 `game.isOffline`, 초대 파라미터, `store.getPurchaseToken` 포함). `game.gameId`는 `ZokoSDK.gameId`입니다 |
| `SDK.achievements.*` | `ZokoSDK.achievements.list()`, `unlock(key)`, `onUnlock(cb)`(구독 해제 함수를 반환). [업적](https://docs.zokogames.com/kr/sdk/achievements) 참고 |
| `ERROR_CODES` | `ZOKO_ERROR_CODES.store`, `.ad`, `.banner`, `.user`, `.data`, `.room`, `.general` |

**키즈 모드.** 게임이 키즈 모드로 실행될 때(어린이용 플래그가 있는 게임, 또는 키즈 모드인 플레이어) `ZokoSDK.game.settings.kidsMode` 값은 true입니다. 이때는 채팅, 룸, 로그인 안내, 상점 화면을 숨기세요. 이 필드를 보내지 않는 포털에서는 false가 되므로, 포털이 같은 경우에 true로 설정하는 `disableChat`도 계속 따르세요. [키즈 모드](https://docs.zokogames.com/kr/guides/kids-mode)를 참고하세요.

## 방 데이터 채널

SDK 1.3.0에서 추가되었습니다. 방 데이터 채널을 사용하면 한 방의 플레이어끼리 작은 JSON 메시지를 주고받고, 호스트만 쓸 수 있는 작은 상태를 공유할 수 있어서 간단한 멀티플레이어 게임에 자체 서버가 필요 없습니다. 텍스트 채팅이 아니라 게임 데이터를 위한 것입니다. 채널은 `updateRoom` 이후(또는 초대를 통해 참여한 뒤)에 생기고 `leftRoom`으로 끝나며, 로그인한 플레이어와 실시간 기능이 켜진 포털이 필요합니다(그렇지 않으면 `roomUnavailable`). 한도는 다음과 같습니다. 메시지 또는 패치당 8 KB, 초당 메시지 20개, 상태 64 KB, 상태 키는 `A-Z a-z 0-9 _ . : -` 문자 1~40자. 포털에서 메시지는 보낸 사람에게 되돌아오지 않으며, 방의 첫 번째 플레이어가 호스트입니다. 전체 규칙과 오류 코드(`notInRoom`, `notHost`, `payloadTooLarge`, `stateTooLarge`, `unknownMember`, `rateLimited`, `roomUnavailable`)는 [game 모듈](https://docs.zokogames.com/kr/sdk/game#room-data-channel)과 [멀티플레이어 가이드](https://docs.zokogames.com/kr/guides/multiplayer-invites#6-exchange-game-data-in-the-room)에 있습니다.

`ZokoSDK.game.room`은 JavaScript의 `SDK.game.room`으로 그대로 전달됩니다. 포털의 SDK가 1.3.0보다 오래되었거나 방 채널이 없는 내장 시뮬레이터에서는 `undefined`이므로 사용 전에 확인하고, 방은 웹 빌드에서 테스트하세요. 메서드는 `send(data, { to })`, `setState(patch)`, `getState()`, `members()`, `isHost()`, `selfId`이고, `onMessage`, `onState`, `onMembers`, `onHostChange`, `onError`(각각 구독 해제 함수를 반환) 또는 `add...Listener`와 `remove...Listener` 쌍을 사용합니다.

```ts
async startMatch() {
  await ZokoSDK.ready();
  await ZokoSDK.game.updateRoom({ roomId: "match-1", isJoinable: true });
  const room = ZokoSDK.game.room;
  if (!room) return;                                   // simulator or an older SDK
  room.onMessage((m) => {
    const move = m.data as { cell: number; mark: string };   // data is typed unknown
    this.placeMark(move.cell, move.mark);
  });
  room.onHostChange((_hostId, isHost) => { if (isHost) void room.setState({ turn: "X" }); });
  room.onError((e) => console.warn("room:", e.code));
}
```

## 배너

배너는 캔버스가 아니라 페이지에 그려집니다. 배너가 놓일 자리에 오브젝트를 두면 래퍼가 그 투영된 상자 위에 컨테이너를 배치합니다. 첫 활성 뷰가 카메라이며 캔버스를 가득 채운다고 가정합니다. 배너는 메뉴 씬에서만 요청하세요.

```ts
await ZokoSDK.requestBannerForObject("menu-banner", this.object, 3, 0.75);           // 3 x 0.75 world units, largest size that fits
await ZokoSDK.requestBannerForObject("menu-banner", this.object, 3, 0.75, "300x250"); // a static size
await ZokoSDK.banner.clearBanner("menu-banner");
```

`ZokoSDK.rectOfObject(object, width, height)`는 `ZokoSDK.banner.requestBannerForRect(id, rect, size?)`에 쓸 정규화된 사각형을 반환합니다. 카메라 뒤에 있는 상자나 활성 뷰가 없는 씬은 `invalidArgument`로 실패합니다.

## 구매

```ts
if (ZokoSDK.store.isAvailable) {
  try {
    const items = await ZokoSDK.store.getCatalogItems({ limit: 20 });
    const { itemId } = await ZokoSDK.store.buyItem(items[0].sku);
    const token = await ZokoSDK.store.getPurchaseToken();      // send to your server and verify there
  } catch (e) {
    if ((e as { code?: string }).code === "purchaseCancelled") return;
  }
}
```

소유권은 서버에서 검증하세요([게임 내 구매](https://docs.zokogames.com/kr/sdk/purchases)). `examples/ZokoStoreExample.ts`는 바로 쓸 수 있는 컴포넌트이고, `examples/ZokoProbe.ts`는 래퍼의 스모크 테스트를 실행해 `[zoko-probe] <check> <result>` 줄을 출력합니다.

## 웹 내보내기에서 중요한 설정 {#web-export-settings-that-matter}

- **패키징한 뒤 `deploy/`의 내용물을 zip으로 묶어** `index.html`이 압축 파일의 루트에 오게 하세요. 모든 경로는 상대 경로여야 합니다.
- **사전 압축 금지.** Wonderland는 `.bin`과 `.wasm` 파일을 일반 이름으로 요청합니다. 게임 오리진은 `.br` 또는 `.gz` 접미사를 해당 `Content-Encoding`과 함께 제공하지만, 접미사가 붙은 파일에만 해당합니다. 최초 다운로드 추정치는 압축하지 않은 크기를 기준으로 합니다. 한도: 파일 1,500개, 압축 해제 시 250 MB, 최초 다운로드 약 50 MB(모바일은 20 MB).
- **크기.** 에디터에서 텍스처(Basis 또는 KTX2)와 메시(Draco)를 압축하고, 첫 씬을 작게 유지하며, 이후 씬은 첫 프레임 뒤에 `engine.loadScene`으로 불러오세요.
- **오디오 잠금 해제.** 브라우저는 첫 탭이나 클릭 전까지 오디오를 일시 중단 상태로 둡니다. 음악은 "탭하여 시작" 화면에서 재생하세요.
- **전체 화면.** 포털 프레임 바의 전체 화면 버튼(프레임 전체를 전체 화면으로 만듭니다)을 사용하는 것이 좋습니다.
- **로딩.** 컴포넌트가 시작될 때 씬은 이미 불러온 상태입니다. 내려받는 동안 로딩을 보고하려면 먼저 `await ZokoSDK.ready()`를 호출하고, `const loading = ZokoSDK.trackLoading()`을 만든 뒤 `loading.progress`를 `engine.loadMainScene(file, loading.progress)`에 넘기고 `await loading.done()`을 호출하세요. 그렇지 않으면 엔진의 로딩 화면이 끝날 때 `zoko-sdk` 컴포넌트가 포털의 로딩 바를 끝냅니다.

업로드: 패키징하고 빌드 폴더의 **내용물**을 zip으로 묶어 개발자 콘솔에 업로드하고, 먼저 [미리보기 도구](https://www.zokogames.com/kr/preview)를 실행하세요.

광고, 로그인이나 계정 연결 창, 결제가 끝나면 키보드 포커스가 저절로 게임 프레임과 캔버스로 돌아오므로, 클릭하지 않아도 플레이어의 키가 다시 작동합니다.

## 채팅 신고, 스크린샷, 저장소 미러

SDK 1.4.0부터: `ZokoSDK.game.reportChat(report)`, `ZokoSDK.game.onScreenshotRequest(handler)`, `ZokoSDK.data.mirrorLocalStorage({ prefix: "save_" })`(중지 함수를 반환)가 있습니다. `ready()`는 프레임이 그려진 직후의 마이크로태스크에서 캔버스를 읽는 기본 제공자를 등록합니다(컴포넌트의 `update()`가 프레임을 표시). 끄려면 컴포넌트의 `screenshots` 속성을 쓰거나 `ready()` 전에 `ZokoSDK.useDefaultScreenshots(false)`를 호출하세요.

## 광고 규칙 {#ad-rules}

프리롤은 없습니다. 게임이 시작되기 전에 광고를 요청할 수는 없습니다. 전면 광고 유형은 midgame뿐이므로, 다른 플랫폼의 전면 광고나 커머셜 브레이크는 midgame 광고가 됩니다(`ZokoSDK.requestAd("midgame")`). 그 밖의 유형은 `rewarded`뿐입니다. 로컬 모드(포털 밖의 `localhost`에서 테스트하는 경우)에서는 게임이 `ZokoSDK.game.gameplayStart()`를 호출하거나 페이지가 화면에 보인 시간이 30초가 지나기 전까지 midgame 요청이 `adError` 오류(`adCooldown`)로 실패합니다. 포털에서도 첫 midgame 광고에는 먼저 `ZokoSDK.game.gameplayStart()` 호출이 필요하므로, 플레이어가 조작을 시작할 때 호출하세요(호출하지 않는 게임은 플레이가 시작되고 30초 뒤에 midgame 광고가 나옵니다). 보상형 광고는 이 제한을 받지 않습니다. 자세한 내용: [광고 레퍼런스](https://docs.zokogames.com/kr/sdk/ads#gameplay-first)와 [광고 수익화 가이드](https://docs.zokogames.com/kr/guides/ad-monetisation).

## 로컬에서 테스트 {#test-locally}

- **에디터 미리보기와 `localhost`에서 제공하는 빌드**는 실제 JavaScript SDK의 [로컬 모드](https://docs.zokogames.com/kr/getting-started/local-testing)를 사용합니다. 3초짜리 광고 오버레이, 가짜 플레이어, `localStorage` 저장, `?sdk_debug=true`, `?ad_response=unfilled`가 제공됩니다. 포털이 주변에 없는 다른 호스트에서는 환경이 `disabled`이므로 호출이 `sdkDisabled`로 거부됩니다. 테스트하려면 `?useLocalSdk=true`를 추가하세요.
- **오프라인.** 컴포넌트의 `simulator` 속성을 켜면 스크립트가 없을 때 `ZokoSDK.isSimulated`가 true가 되고 가짜 광고와 가짜 플레이어가 나타납니다. 시뮬레이터는 3분 midgame 쿨다운(`adCooldown`)을 강제하지 않으므로, 광고 처리는 `localhost`에서도 테스트하세요.
- **그다음** 로컬 주소로 [미리보기 도구](https://www.zokogames.com/kr/preview)를 열어 체크리스트 항목이 하나씩 통과하는지 확인하세요.

## API

### `init`

<!-- search: headings-only -->

| JavaScript | Wonderland |
| --- | --- |
| `pauseTypes` | `animation` |
| `init` | `await ZokoSDK.ready()`(또는 `await ZokoSDK.init()`) |
| `environment` | `ZokoSDK.environment` |
| `isQaTool` | `ZokoSDK.isQaTool` |

### `ad.*`

<!-- search: headings-only -->

| JavaScript | Wonderland |
| --- | --- |
| `ad.requestAd` | `await ZokoSDK.requestAd(type)`(일시 중지 포함) 또는 `ZokoSDK.ad.requestAd(type, callbacks)`(원시) |
| `ad.requestAd.adStarted` | `ZokoSDK.requestAd(type, callbacks)` / `ZokoSDK.ad.requestAd(type, callbacks)`의 `callbacks.adStarted`; `ZokoSDK.events.adStarted` |
| `ad.requestAd.adFinished` | `callbacks.adFinished`; `ZokoSDK.requestAd`는 `{ finished: true }`로 이행; `ZokoSDK.events.adFinished` |
| `ad.requestAd.adError` | `callbacks.adError(error)`; `ZokoSDK.requestAd`는 `{ finished: false, error }`로 이행; `ZokoSDK.events.adError` |
| `ad.hasAdblock` | `ZokoSDK.ad.hasAdblock`() |

### `banner.*`

<!-- search: headings-only -->

| JavaScript | Wonderland |
| --- | --- |
| `banner.requestBanner` | `ZokoSDK.banner.requestBanner({ id, width, height })` |
| `banner.requestResponsiveBanner` | `ZokoSDK.banner.requestResponsiveBanner`() |
| `banner.clearBanner` | `ZokoSDK.banner.clearBanner`() |
| `banner.clearAllBanners` | `ZokoSDK.banner.clearAllBanners`() |

### `game.*`

<!-- search: headings-only -->

| JavaScript | Wonderland |
| --- | --- |
| `game.settings` | `ZokoSDK.game.settings` |
| `game.addSettingsChangeListener` | `ZokoSDK.game.addSettingsChangeListener(fn)` / `ZokoSDK.events.settingsChange.add(fn)` |
| `game.removeSettingsChangeListener` | `ZokoSDK.game.removeSettingsChangeListener`() |
| `game.gameplayStart` | `ZokoSDK.game.gameplayStart`() |
| `game.gameplayStop` | `ZokoSDK.game.gameplayStop`() |
| `game.loadingStart` | `ZokoSDK.game.loadingStart()` |
| `game.loadingStop` | `ZokoSDK.game.loadingStop()` |
| `game.loadingProgress` | `ZokoSDK.game.loadingProgress(percentage)` |
| `game.happytime` | `ZokoSDK.game.happytime`() |
| `game.reportGameCompletedPercentage` | `ZokoSDK.game.reportGameCompletedPercentage`() |
| `game.reportChat` | `ZokoSDK.game.reportChat(report)` |
| `game.onScreenshotRequest` | `ZokoSDK.game.onScreenshotRequest(handler)` / `ZokoSDK.setDefaultScreenshotProvider()` |
| `game.setGameContext` | `ZokoSDK.game.setGameContext`() |
| `game.clearGameContext` | `ZokoSDK.game.clearGameContext`() |
| `game.isInstantMultiplayer` | `ZokoSDK.game.isInstantMultiplayer` |
| `game.isInstantJoin` | `ZokoSDK.game.isInstantJoin` |
| `game.isOffline` | `ZokoSDK.game.isOffline` |
| `game.gameId` | `ZokoSDK.gameId` |
| `game.addOfflineListener` | `ZokoSDK.game.addOfflineListener(fn)` / `ZokoSDK.events.offlineChange.add(fn)` |
| `game.removeOfflineListener` | `ZokoSDK.game.removeOfflineListener(fn)` |
| `game.updateRoom` | `ZokoSDK.game.updateRoom`() |
| `game.leftRoom` | `ZokoSDK.game.leftRoom`() |
| `game.addJoinRoomListener` | `ZokoSDK.game.addJoinRoomListener`() |
| `game.removeJoinRoomListener` | `ZokoSDK.game.removeJoinRoomListener`() |
| `game.inviteParams` | `ZokoSDK.game.inviteParams` |
| `game.inviteLink` | `ZokoSDK.game.inviteLink`() |
| `game.getInviteParam` | `ZokoSDK.game.getInviteParam`() |
| `game.showInviteButton` | `ZokoSDK.game.showInviteButton(params)` |
| `game.hideInviteButton` | `ZokoSDK.game.hideInviteButton()` |
| `game.room` | `ZokoSDK.game.room` |
| `game.room.send` | `ZokoSDK.game.room.send(data, { to })` |
| `game.room.onMessage` | `ZokoSDK.game.room.onMessage(cb)` |
| `game.room.addMessageListener` | `ZokoSDK.game.room.addMessageListener(cb)` |
| `game.room.removeMessageListener` | `ZokoSDK.game.room.removeMessageListener(cb)` |
| `game.room.setState` | `ZokoSDK.game.room.setState(patch)` |
| `game.room.getState` | `ZokoSDK.game.room.getState()` |
| `game.room.onState` | `ZokoSDK.game.room.onState(cb)` |
| `game.room.addStateListener` | `ZokoSDK.game.room.addStateListener(cb)` |
| `game.room.removeStateListener` | `ZokoSDK.game.room.removeStateListener(cb)` |
| `game.room.members` | `ZokoSDK.game.room.members()` |
| `game.room.onMembers` | `ZokoSDK.game.room.onMembers(cb)` |
| `game.room.addMembersListener` | `ZokoSDK.game.room.addMembersListener(cb)` |
| `game.room.removeMembersListener` | `ZokoSDK.game.room.removeMembersListener(cb)` |
| `game.room.isHost` | `ZokoSDK.game.room.isHost()` |
| `game.room.onHostChange` | `ZokoSDK.game.room.onHostChange(cb)` |
| `game.room.addHostChangeListener` | `ZokoSDK.game.room.addHostChangeListener(cb)` |
| `game.room.removeHostChangeListener` | `ZokoSDK.game.room.removeHostChangeListener(cb)` |
| `game.room.selfId` | `ZokoSDK.game.room.selfId` |
| `game.room.onError` | `ZokoSDK.game.room.onError(cb)` |
| `game.room.addLeftListener` | `ZokoSDK.game.room.addLeftListener(cb)` / `ZokoSDK.events.roomLeft.add(cb)` |
| `game.room.removeLeftListener` | `ZokoSDK.game.room.removeLeftListener(cb)` |
| `game.room.addErrorListener` | `ZokoSDK.game.room.addErrorListener(cb)` |
| `game.room.removeErrorListener` | `ZokoSDK.game.room.removeErrorListener(cb)` |

### `user.*`

<!-- search: headings-only -->

| JavaScript | Wonderland |
| --- | --- |
| `user.isUserAccountAvailable` | `ZokoSDK.user.isUserAccountAvailable` |
| `user.systemInfo` | `ZokoSDK.user.systemInfo` |
| `user.getUser` | `ZokoSDK.user.getUser`() |
| `user.listFriends` | `ZokoSDK.user.listFriends`() |
| `user.getUserToken` | `ZokoSDK.user.getUserToken`() |
| `user.showAuthPrompt` | `ZokoSDK.user.showAuthPrompt`() |
| `user.addAuthListener` | `ZokoSDK.user.addAuthListener`() |
| `user.removeAuthListener` | `ZokoSDK.user.removeAuthListener`() |
| `user.showAccountLinkPrompt` | `ZokoSDK.user.showAccountLinkPrompt`() |
| `user.submitScore` | `ZokoSDK.user.submitScore`() |
| `user.getXsollaUserToken` | `ZokoSDK.user.getXsollaUserToken()` |

### `data.*`

<!-- search: headings-only -->

| JavaScript | Wonderland |
| --- | --- |
| `data.getItem` | `ZokoSDK.data.getItem(key)` |
| `data.setItem` | `ZokoSDK.data.setItem(key, value)` |
| `data.removeItem` | `ZokoSDK.data.removeItem`() |
| `data.clear` | `ZokoSDK.data.clear`() |
| `data.mirrorLocalStorage` | `ZokoSDK.data.mirrorLocalStorage(options)` |

### `store.*`

<!-- search: headings-only -->

| JavaScript | Wonderland |
| --- | --- |
| `store.isAvailable` | `ZokoSDK.store.isAvailable` |
| `store.getCatalogItems` | `ZokoSDK.store.getCatalogItems({ limit, offset })` |
| `store.getPlayerInventory` | `ZokoSDK.store.getPlayerInventory({ limit, offset })` |
| `store.buyItem` | `ZokoSDK.store.buyItem(itemId)` |
| `store.consumeItem` | `ZokoSDK.store.consumeItem`() |
| `store.getPurchaseToken` | `ZokoSDK.store.getPurchaseToken()` |
| `store.setSandbox` | `ZokoSDK.store.setSandbox`() |

### `achievements.*`

<!-- search: headings-only -->

| JavaScript | Wonderland |
| --- | --- |
| `achievements.list` | `ZokoSDK.achievements.list()` |
| `achievements.unlock` | `ZokoSDK.achievements.unlock(key)` |
| `achievements.onUnlock` | `ZokoSDK.achievements.onUnlock(fn)` |

### `analytics.*`

<!-- search: headings-only -->

| JavaScript | Wonderland |
| --- | --- |
| `analytics.track` | `ZokoSDK.analytics.track(name, params)` |
| `analytics.trackOrder` | `ZokoSDK.analytics.trackOrder`() |

### `constants`

<!-- search: headings-only -->

| JavaScript | Wonderland |
| --- | --- |
| `ERROR_CODES` | `ZOKO_ERROR_CODES.<module>` |
| `SDK_VERSION` | `ZokoSDK.version` |

## 알려진 함정

<!-- search: headings-only -->

- **`sdkNotLoaded`.** SDK 스크립트를 불러오지 못했습니다(오프라인, 차단됨, 또는 스크립트 태그 누락).
- **`sdkNotInitialized`.** 먼저 `await ZokoSDK.ready()`를 호출하세요.
- **광고 중에도 소리가 계속 재생됨.** 오디오가 컴포넌트의 `init()` 이후에 생성된 Web Audio 컨텍스트에 있지 않습니다. 더 일찍 `ZokoSDK.captureAudio()`를 호출하거나 `ZokoSDK.audio.track(context)`를 쓰세요.
- **광고 중에도 컴포넌트가 계속 실행됨.** TypeName을 `pauseTypes`에 추가하거나, `ZokoSDK.paused`인 동안 `update()`에서 일찍 반환하세요.
- **배너가 엉뚱한 위치에 있음.** 상자는 첫 활성 뷰로 투영되며 그 뷰가 캔버스를 가득 채워야 합니다. 그렇지 않으면 사각형을 직접 계산해 `requestBannerForRect`를 사용하세요.
- **피드백 양식의 스크린샷이 검게 나옴.** 에디터 버전과 함께 보고해 주세요. 캔버스는 프레임 직후에 읽으며, 그때까지 캔버스가 그림을 유지하는지에 달려 있습니다.

## 다음 단계

- 빌드를 [빌드 검증 규칙](https://docs.zokogames.com/kr/requirements/build-validation)과 [출시 체크리스트](https://docs.zokogames.com/kr/requirements/checklist)에 맞춰 확인하세요.
- 업로드와 게시: [제출 안내](https://docs.zokogames.com/kr/getting-started/submission-walkthrough).
- 다른 엔진과 공통 규칙: [엔진 개요](https://docs.zokogames.com/kr/engines/overview).
