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QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC;mDACgB;IAHhC,iBAAiB;QAFrC,OAAO;OAEa,iBAAiB,CAkCrC;IAAD,wBAAC;KAAA;kBAlCoB,iBAAiB","file":"","sourceRoot":"/","sourcesContent":["// Learn TypeScript:\r\n//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/typescript.html\r\n//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/typescript.html\r\n// Learn Attribute:\r\n//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html\r\n//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/reference/attributes.html\r\n// Learn life-cycle callbacks:\r\n//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html\r\n//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html\r\n\r\nimport { GameBasicSettings } from \"../gameplay/settings/GameBasicSettings\";\r\n\r\nconst { ccclass, property } = cc._decorator;\r\n\r\n@ccclass\r\n\r\nexport default class SoundEffectButton extends cc.Component {\r\n\r\n    @property({ type: cc.AudioClip })\r\n    clip: cc.AudioClip = null as any as cc.AudioClip;\r\n\r\n    interactable: boolean = true;\r\n\r\n    // LIFE-CYCLE CALLBACKS:\r\n\r\n    onLoad() {\r\n    }\r\n\r\n    onEnable() {\r\n        this.node.on(cc.Node.EventType.TOUCH_END, this.onPlaySoundEffectCallback, this);\r\n    }\r\n\r\n    onDisable() {\r\n        this.node.off(cc.Node.EventType.TOUCH_END, this.onPlaySoundEffectCallback, this);\r\n    }\r\n\r\n    onPlaySoundEffectCallback(event) {\r\n        if (!this.clip) {\r\n            console.log(\"current clip is null.\");\r\n        } else if (this.interactable) {\r\n            if (GameBasicSettings.soundVolume != 0)\r\n                cc.audioEngine.playEffect(this.clip, false)\r\n        }\r\n    }\r\n\r\n    start() {\r\n\r\n    }\r\n\r\n    // update (dt) {}\r\n}\r\n"]}