cc.Class({ extends: cc.Component, properties: { needMergeEventNodes: { default: [], type: cc.Node, displayName: "需要合并的事件节点" }, startDelayTime: { default: 0, displayName: "起始延迟的时间" }, isAutomatic: { default: false, displayName: "是否自动触发" }, yinyue: { default: "", displayName: "播放的声音名" }, soundTime: { default: 0, displayName: "声音起始延迟的时间" } }, onLoad: function () { this.node.switchEvent = this.switchEvent.bind(this); }, start: function () { 1 == this.isAutomatic && this.switchEvent(); }, switchEvent: function () { var e = this; setTimeout(function () { if (e.yinyue) { cc.global.Source.onStopBjM(); cc.global.Source.onPlayBtnEffect(e.yinyue); } }, this.soundTime); this.node.stopAllActions(); cc.tween(this.node).delay(this.startDelayTime).call(function () { for (var o = 0; o < e.needMergeEventNodes.length; o++) { e.needMergeEventNodes[o] && e.needMergeEventNodes[o].switchEvent(); } }).start(); } });