Currency

개요

The page shows an in-game currency wallet and two buttons that deposit into it. GS2-Money2 keeps currency granted for free and currency the player paid for as separate balances, so you can see which balance moves depending on the button you press. Every reading and button on the page is a UI component generated from the package; no demo-specific script is involved.

체험 방법

  1. Your coins shows Free balance, Paid balance, and Total balance.
  2. Press Deposit under Get coins (labeled Deposit 100 free coins); Free balance and Total balance go up by 100.
  3. Press Deposit under Get paid coins (labeled Deposit 50 paid coins); Paid balance and Total balance go up by 50. This deposit is recorded as a purchase for 120 JPY.

The wallet is shared by every showroom demo, so currency spent in other demos such as the shop is reflected in the balances here.

사용하는 GS2 서비스

  • GS2-Money2: A GS2-Money2 wallet holds the free and paid balances separately. A paid deposit is recorded with a price and a currency code, which keeps it apart from free deposits.
  • GS2-Exchange: Two GS2-Exchange rates define the transactions each Deposit button runs to deposit into GS2-Money2, executed server-side automatically.

GS2 Studio에서 사용하기

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

https://github.com/gs2io/gs2-studio-package/tree/main/foundation-economy-currency/packages/foundation-economy-currency
  • Owner: gs2io
  • Repository: gs2-studio-package
  • Subdirectory: foundation-economy-currency/packages/foundation-economy-currency

소스 코드