CoinMgr.ts 402 B

123456789101112131415161718
  1. import { math } from "cc"
  2. import { ItemMgr } from "./ItemMgr"
  3. import { PREVIEW } from "cc/env"
  4. export class CoinMgr {
  5. public static get CurCoin(): number {
  6. return ItemMgr.ItemDic[0] ?? 0
  7. }
  8. public static set CurCoin(v: number) {
  9. ItemMgr.setItem(0, math.clamp(v, 0, 9999999))
  10. }
  11. public static fakeCoin: number = 0
  12. }
  13. if (PREVIEW) {
  14. globalThis.CoinMgr = CoinMgr
  15. }