25 lines
		
	
	
		
			719 B
		
	
	
	
		
			TypeScript
		
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			719 B
		
	
	
	
		
			TypeScript
		
	
	
	
| import { _decorator, Node } from 'cc';
 | |
| import { BaseButton } from '../../GlobalScript/CommonComponent/BaseButton';
 | |
| import { NpkImage } from '../../Tool/NPKImage';
 | |
| import { BaseButtonAction } from '../../GlobalScript/CommonComponent/BaseButtonAction';
 | |
| const { ccclass } = _decorator;
 | |
| 
 | |
| @ccclass('CloseButtonNode')
 | |
| export class CloseButtonNode extends Node {
 | |
| 
 | |
|     constructor(onMouseLeftUp?:Function){
 | |
|         super();
 | |
| 
 | |
|         /// 给节点添加 button 组件
 | |
|         const buttonComponent = this.addComponent( BaseButton );
 | |
|         buttonComponent.init(NpkImage.ingame,39);
 | |
| 
 | |
|         /// 添加点击事件
 | |
|         const bba = this.addComponent( BaseButtonAction );
 | |
|         bba.onMouseLeftUp = onMouseLeftUp;
 | |
| 
 | |
|     }
 | |
| 
 | |
| }
 | |
| 
 |