---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://yandex.com/dev/games/doc/en/sdk/sdk-config.md
  - https://yandex.com/dev/games/doc/hi/sdk/sdk-config.md
  - https://yandex.com/dev/games/doc/ko/sdk/sdk-config.md
  - https://yandex.com/dev/games/doc/ru/sdk/sdk-config.md
  - https://yandex.com/dev/games/doc/tr/sdk/sdk-config.md
  - https://yandex.com/dev/games/doc/vi/sdk/sdk-config.md
  - https://yandex.com/dev/games/doc/zh/sdk/sdk-config.md
  - href: ko/sdk/sdk-config.md
    type: text/markdown
    title: Markdown version
  - href: ../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/dev/games/doc/ko/llms.txt

# 원격 구성

Yandex&nbsp;Games&nbsp;SDK의 `getFlags()` 메소드를 이용하여 원격 설정 플래그(Remote Config)를 가져오도록 추가하세요. 게임 시작 시 플래그를 한 번 요청하는 것이 좋습니다.

저장된 플래그의 값을 얻기 위해 `getFlags()` 메소드를 사용하세요.

{% list tabs %}

- await 사용 예

    ```javascript
    const ysdk = await YaGames.init(); // SDK를 초기화합니다.
    const flags = await ysdk.getFlags(); // 메소드가 플래그 객체를 반환합니다.

    // 게임 로직에 조건을 추가할 수 있습니다:
    if (flags.difficult === 'hard') {
        // 높은 난이도를 활성화합니다.
    }
    ```

- await 없는 예

    ```javascript
    YaGames.init()
        .then(ysdk => ysdk.getFlags())
        .then(flags => {
            // flags는 플래그 객체를 포함합니다.

            // 게임 로직에 조건을 추가할 수 있습니다:
            if (flags.difficult === 'hard') {
                // 높은 난이도를 활성화합니다.
            }
        });
    ```

{% endlist %}

## 로컬 설정

네트워크 문제(예: 지하철에서의 연결 문제) 등 어떠한 이유로든 서버에서 원격 설정을 가져올 수 없는 경우를 대비해 게임 코드에 로컬 설정 플래그를 항상 포함시키는 것이 좋습니다. 이는 게임의 운영성을 향상시킵니다.

이를 위해 `getFlags()` 메소드는 추가 파라미터를 지원합니다. 로컬 설정(플랫 객체, 값은 문자열)을 `defaultFlags` 필드에 전달하세요.

결과 객체는 원격 설정과 로컬 설정이 결합된 형태로, 원격 설정이 우선시 됩니다.

```javascript
YaGames.init()
    .then(ysdk => ysdk.getFlags({ defaultFlags: { difficult: 'easy' } }))
    .then(flags => {
        // flags는 { difficult: 'easy' } 객체를 포함합니다.
    });
```

## 클라이언트 파라미터

게임이 플레이어의 상태를 저장하고 있다면, 예를 들어, 플레이어가 한 번이라도 게임 내 화폐를 사용했는지, 얼마나 많은 레벨을 클리어했는지, 사용자를 코어 게이머로 볼 수 있는지 등의 사실을 원격 설정에서 사용할 수 있습니다. 조건에 따라 플래그를 설정하는 방법에 대한 자세한 내용은 [플래그 설정 생성](https://yandex.com/dev/games/doc/ko/config.md#step1-create-flag-config) 섹션을 참조하세요.

클라이언트 파라미터는 `getFlags()` 메소드의 `clientFeatures` 필드에 배열 형태로 전달해야 합니다.

**await 사용 예**

```javascript
const ysdk = await YaGames.init(); // SDK를 초기화합니다.
const player = await ysdk.getPlayer(); // 플레이어를 가져옵니다.
const payingStatus = player.getPayingStatus(); // 플랫폼 내 사용자의 결제 활동 상태를 가져옵니다.

// 사용자의 결제 활동 상태 클라이언트 파라미터로 플래그를 요청합니다.
const flags = await ysdk.getFlags({
    clientFeatures: [
        {name: 'payingStatus', value: payingStatus}
    ]
});
```

**await 없는 예**

```javascript
// 클라이언트 파라미터 levels=5를 전송합니다.
YaGames.init()
    .then(ysdk => ysdk.getFlags({
        defaultFlags: {},
        clientFeatures: [
            { name: 'levels', value: '5' }
        ]})
    )
    .then(flags => {
        // 클라이언트 파라미터 조건이 작동하지 않았습니다.
        // flags.showFullscreenAdOnStart === 'no'
    });

// 클라이언트 파라미터 levels=10를 전송합니다.
YaGames.init()
    .then(ysdk => ysdk.getFlags({
        defaultFlags: {},
        clientFeature를 호출해서 비동기 작업을 수행합니다s: [
            { name: 'levels', value: '10' }
        ]})
    )
    .then(flags => {
        // 클라이언트 파라미터 조건이 작동하여 시작할 때 광고를 표시합니다.
        // flags.showFullscreenAdOnStart === 'yes'
    });

// 두 개의 클라이언트 파라미터 예시:
YaGames.init()
    .then(ysdk => ysdk.getFlags({
        defaultFlags: {},
        clientFeatures: [
            { name: 'levels', value: '10' },
            { name: 'inAppPurchaseUsed', value: 'yes' }
        ]})
    )
    .then(flags => {

    });
```

## `getFlags()` 메소드의 시그니처와 인터페이스

```typescript
interface IFlags {
    [key: string]: string;
}

interface ClientFeature {
    name: string;
    value: string;
}

interface IGetFlagsParams {
    defaultFlags?: IFlags;
    clientFeatures?: ClientFeature[];
}

function getFlags(getFlagsParams: IGetFlagsParams = {}): IFlags {}
```

---

<!-- source: ko/_includes/concepts/troubleshooting/id-troubleshooting/support.md -->
{% note info "참고" %}

지원팀은 완성된 게임을 Yandex Games에 게시하는 데 도움을 드릴 수 있습니다. 개발이나 테스트에 대해 궁금한 점이 있다면, [Discord 채널](https://discord.com/invite/wU4p3whr4T)에서 질문해 주세요.

{% endnote %}


지원 서비스는 얀덱스 게임에서 완성 된 게임을 게시 할 수 있습니다. 개발 또는 테스트에 대한 질문이 있는 경우
<!-- endsource: ko/_includes/concepts/troubleshooting/id-troubleshooting/support.md -->

<!-- source: ko/_includes/button-fos.md -->
Yandex Games SDK 사용과 관련하여 문제가 발생하거나 질문이 있는 경우 다음 방법으로 지원팀에 문의하세요.


<a href="https://yandex.com/chat/#/user/a4fa5c06-75db-9b38-6eea-b1673785f7d5">
  <span class="button">채팅 상담</span>
</a>
<!-- endsource: ko/_includes/button-fos.md -->
