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

# Yandex Games SDK API

<!-- source: tr/_includes/script-common.md -->
<!-- source: tr/_includes/script/index-js.md -->

<!-- endsource: tr/_includes/script/index-js.md -->

<!-- source: tr/_includes/script/requirements-js.md -->

<!-- endsource: tr/_includes/script/requirements-js.md -->

<!-- source: tr/_includes/script/image-modal-js.md -->

<!-- endsource: tr/_includes/script/image-modal-js.md -->
<!-- endsource: tr/_includes/script-common.md -->

Eklentiyi kurduktan sonra, [Yandex Oyun SDK'sındaki aynı adlı nesnenin](https://yandex.com.tr/dev/games/doc/tr/sdk/sdk-game-events.md) tip atanmış bir eşdeğeri olan `ysdk` nesnesini bulacaksınız. Bu nesne, SDK'nın tüm yöntemlerine erişmenizi sağlar.

İşte Yandex Oyun SDK'sından [çevre değişkenlerini](https://yandex.com.tr/dev/games/doc/tr/sdk/sdk-environment.md) nasıl kullanacağınıza dair bir örnek.

```tsx showLineNumbers
import { Component } from 'cc';
import { ysdk } from 'db://yandex-games-sdk/ysdk';
const { ccclass, property } = _decorator;

@ccclass('YourGameComponent')
export class YourGameComponent extends Component {
    start() {
        console.debug(`App ID: ${ysdk.environment.app.id}`);
        console.debug(`User Language: ${ysdk.environment.i18n.lang}`);
        console.debug(`URL Payload: ${ysdk.environment.payload}`);
    }

    update(deltaTime: number) {}
}
```

## Reklamı Gösterme Bileşeni {#ads-display-component}

Örneğin, ödüllü video reklamını başlatacak bir düğme için bir bileşen oluşturalım.

Bunun yanı sıra, `onReward()` metodunu tanımlayıp, ödül alma olayının mantığını gerçekleştirmek için `ysdk.adv.showRewardedVideo()` metoduna callback olarak iletelim.

```tsx showLineNumbers
import { _decorator, Button, Component } from 'cc';
import { ysdk } from 'db://yandex-games-sdk/ysdk';
const { ccclass, property, requireComponent } = _decorator;

@ccclass('RewardADButton')
@requireComponent(Button)
export class RewardADButton extends Component {
    start() {
        this.node.on('click', this.onClick.bind(this));
    }

    onClick() {
        const callbacks = {
            onRewarded: this.onReward.bind(this)
        };

        ysdk.adv.showRewardedVideo({ callbacks });
    }

    onReward() {
        // Kullanıcıyı ödüllendirin.
    }
}
```

Yandex platformunda bu bileşene sahip bir düğmeye bastığınızda, reklam göreceksiniz. Daha basit bir test için [Test](https://yandex.com.tr/dev/games/doc/tr/sdk/cocos/testing.md) bölümüne göz atın.

---


<!-- source: tr/_includes/sdk/button-git.md -->
<a href="https://github.com/yandex-games-plugins/cocos">
  <span class="button">Depo</span>
</a>
<!-- endsource: tr/_includes/sdk/button-git.md -->
