import { math } from "cc"
import { ItemMgr } from "./ItemMgr"
import { PREVIEW } from "cc/env"

export class CoinMgr {
    public static get CurCoin(): number {
        return ItemMgr.ItemDic[0] ?? 0
    }
    public static set CurCoin(v: number) {
        ItemMgr.setItem(0, math.clamp(v, 0, 9999999))
    }

    public static fakeCoin: number = 0
}

if (PREVIEW) {
    globalThis.CoinMgr = CoinMgr
}
