const {ccclass, property} = cc._decorator; @ccclass export default class TouchScaleScript extends cc.Component { @property({ type: cc.Node, displayName: '触发节点' }) scaleNode: cc.Node = null @property(cc.Float) scaleTimes: number = 1.1; // LIFE-CYCLE CALLBACKS: onLoad () { if (!this.scaleNode) { this.scaleNode = this.node } this.openTouchEvent(this.node) } openTouchEvent(node) { node.on(cc.Node.EventType.TOUCH_START, this.touchStartNode, this) node.on(cc.Node.EventType.TOUCH_CANCEL, this.touchEndNode, this) node.on(cc.Node.EventType.TOUCH_END, this.touchEndNode, this) } touchStartNode(event) { this.scaleNode.scale = this.scaleTimes } touchEndNode(event) { this.scaleNode.scale = 1 } }