123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- // Learn TypeScript:
- // - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
- // Learn Attribute:
- // - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
- // Learn life-cycle callbacks:
- // - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
- import EventName from "../EventName/EventName";
- import LocalData from "../LocalData";
- export default class RewardMnr {
- private static _instance: RewardMnr = null;
- public static getInstance() {
- if (!this._instance) {
- this._instance = new RewardMnr();
- }
- return this._instance;
- }
- //还原
- Reset() {
- this.HasPropName = []
- }
- HasPropName: string[] = []
- ParabolaCount = 0
- //添加辅助线次数
- addParabola(name: string, Count: number) {
- if (!this.HasPropName.includes(name)) {
- this.HasPropName.push(name)
- this.ParabolaCount += Count
- cc.systemEvent.emit(EventName.Tips, `您获得了 ${Count} 次完整辅助线机会`)
- }
- }
- addGold(name: string, Count: number) {
- if (!this.HasPropName.includes(name)) {
- this.HasPropName.push(name)
- LocalData.getInstance().setGold(Count, '+')
- cc.systemEvent.emit(EventName.Tips, `您获得了 ${Count} 枚金币`)
- }
- }
- isEnable(name: string) {
- if (!this.HasPropName.includes(name)) {
- return true
- }
- return false
- }
- useOnceParabola() {
- if (this.ParabolaCount > 0) {
- this.ParabolaCount--
- }
- }
- // update (dt) {}
- }
|