You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					42 lines
				
				1.1 KiB
			
		
		
			
		
	
	
					42 lines
				
				1.1 KiB
			| 
											10 months ago
										 | import Common5 from "./Common5";
 | ||
|  | 
 | ||
|  | 
 | ||
|  | const {ccclass, property} = cc._decorator;
 | ||
|  | 
 | ||
|  | @ccclass
 | ||
|  | export default class TouchSpineScript extends cc.Component {
 | ||
|  | 
 | ||
|  |     @property({
 | ||
|  |         type: cc.Node,
 | ||
|  |         displayName: '动画节点'
 | ||
|  |     })
 | ||
|  |     spineNode: cc.Node = null
 | ||
|  |     
 | ||
|  |     // LIFE-CYCLE CALLBACKS:
 | ||
|  | 
 | ||
|  |     onLoad () {
 | ||
|  |         
 | ||
|  |         this.openTouchEvent(this.node)
 | ||
|  |     }
 | ||
|  | 
 | ||
|  |     openTouchEvent(node) {
 | ||
|  |         node.on(cc.Node.EventType.TOUCH_START, this.touchStartNode, this)
 | ||
|  |     }
 | ||
|  |     touchStartNode(event) {
 | ||
|  |         Common5.playEffectCustom('CommonRes',"sound/按键点击")
 | ||
|  |         this.node['_touchListener'].setSwallowTouches(false);
 | ||
|  |         let target = event.target
 | ||
|  |         let posi = event.getLocation()//世界坐标
 | ||
|  |         posi = target.parent.convertToNodeSpaceAR(posi)
 | ||
|  |         this.spineNode.setPosition(posi)
 | ||
|  | 
 | ||
|  |         this.spineNode.stopAllActions()
 | ||
|  |         this.spineNode.active = true
 | ||
|  |         this.spineNode.getComponent(sp.Skeleton).setAnimation(0,'animation',false)
 | ||
|  |         cc.tween(this.spineNode)
 | ||
|  |             .delay(0.5)
 | ||
|  |             .set({active:false})
 | ||
|  |         .start()
 | ||
|  |     }
 | ||
|  | }
 |