import { Node,_decorator,AudioClip, Button } from "cc"; import { GameMng } from "../GameMng"; import AudioMng from "./AudioMng"; const { ccclass, property } = _decorator; @ccclass('UIButton') export class UIButton { public static BindClick(node: Node, func: Function, obj: any, audioClip: AudioClip = GameMng.Instance.buttonclick): void { if(node.getComponent(Button)==null){ console.log(node.name,"null") }else{ node.on('click', () => { func.call(obj); AudioMng.Instance.PlaySoundByName(audioClip); }, obj); } } }