> For the complete documentation index, see [llms.txt](/llms.txt)

# Ads

Tracks ad views and manages the points you can use to reward players for watching them.




**이 데모에 대하여**

데모는 익명 계정으로 자동 로그인합니다. 이 계정은 쇼룸의 모든 데모에서 공유되므로 한 데모에서 얻은 아이템이나 재화가 다른 데모에도 반영됩니다. 로딩에 약간 시간이 걸립니다. 화면이 작다면 새 탭에서 열어 사용해 보세요.

## 개요

This demo banks one point each time an ad view completes and spends one point when a reward is claimed. The showroom runs as a WebGL page in the browser, where the mobile-only ad SDKs (Unity Ads, LevelPlay, AdMob) cannot run, so no real advertisement plays. Instead a panel stands in for the ad placement, and everything after the title decides "the view finished", which is GS2's part, runs for real.

## 체험 방법

1. **Balance** under **Ad view point** shows the banked points, e.g. **0 view(s) banked**.
1. Press **Ad break**; an **Advertisement** panel opens and explains why no ad plays. Wait for the **You can continue in 5s.** countdown to finish.
1. Press **I finished watching**; the page tells GS2 the view completed and asks for the point, and **Balance** goes up by 1. Pressing **Close** instead grants nothing.
1. Press **Spend**; one point is consumed and **Balance** goes down by 1.

In a shipped title, the point is granted from the ad network's completion callback where **I finished watching** sits here. Deciding that a view really happened is the title's job.

## 사용하는 GS2 서비스

- [GS2-AdReward](/ko/microservices/ad_reward/): A GS2-AdReward namespace holds each player's view points. Points are granted with `Gs2AdReward:AcquirePointByUserId` and consumed with `Gs2AdReward:ConsumePointByUserId`; granting does not verify the view itself.
- [GS2-Exchange](/ko/microservices/exchange/): Two GS2-Exchange rates define the transactions that grant one point (**I finished watching**) and consume one point (**Spend**), and run them server-side automatically.

## GS2 Studio에서 사용하기

GS2 Studio의 Simple 모드에서 **Add features** 를 열고 **Ads** 의 **Add** 를 누르면 이 기능을 자신의 프로젝트에 가져올 수 있습니다. 패키지를 직접 지정하려면 **Add from GitHub** 를 선택하고 아래 패키지를 입력합니다.

```text
https://github.com/gs2io/gs2-studio-package/tree/main/foundation-economy-ad/packages/foundation-economy-ad
```

- Owner: `gs2io`
- Repository: `gs2-studio-package`
- Subdirectory: `foundation-economy-ad/packages/foundation-economy-ad`

## 소스 코드

- 데모 프로젝트: <https://github.com/gs2io/gs2-studio-package/tree/main/foundation-economy-ad/live-demo>
- 기능 패키지: <https://github.com/gs2io/gs2-studio-package/tree/main/foundation-economy-ad>



