Stamina

개요

The page shows a stamina gauge that recovers over time, plus two buttons that spend and restore stamina. The meter holds 50 and recovers 5 every minute on its own, so leaving the page open shows the gauge and the time to the next recovery moving. The recover button also demonstrates overflow, which lets stamina go past the maximum up to 100.

체험 방법

  1. The Stamina gauge under Your stamina shows the current value, e.g. 50/50. A new player starts full at 50.
  2. Press Spend to consume 10 stamina.
  3. Once the meter is below full, Next recovery counts down to the next tick, and stamina recovers by 5 every minute. The row is hidden while the meter is full.
  4. Press Recover to restore 5 stamina immediately. Pressing it while full is not wasted: the value goes past the maximum, e.g. 55/50, up to 100.

Automatic recovery stops at the maximum of 50. Stamina above 50 from Recover does not grow further on its own until spending brings it back below 50.

사용하는 GS2 서비스

  • GS2-Stamina: A GS2-Stamina model defines a maximum of 50, recovery of 5 every minute, and an overflow ceiling of 100, and tracks each player’s current value and next recovery time.
  • GS2-Exchange: Two GS2-Exchange rates define the transactions behind Spend (consume 10 stamina) and Recover (restore 5), executed server-side automatically.

GS2 Studio에서 사용하기

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

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

소스 코드