29 lines
		
	
	
		
			901 B
		
	
	
	
		
			TypeScript
		
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			901 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.ImgPath = NpkImage.ingame;
 | |
|         buttonComponent.NormalImgIndex = 39;
 | |
|         buttonComponent.HoverImgIndex = 40;
 | |
|         buttonComponent.PressImgIndex = 41;
 | |
|         buttonComponent.DisableImgIndex = 42;
 | |
| 
 | |
|         /// 添加点击事件
 | |
|         const bba = this.addComponent( BaseButtonAction );
 | |
|         bba.onMouseLeftUp = onMouseLeftUp;
 | |
| 
 | |
|     }
 | |
| 
 | |
| } 
 | |
|  
 |