30 lines
		
	
	
		
			921 B
		
	
	
	
		
			TypeScript
		
	
	
	
		
		
			
		
	
	
			30 lines
		
	
	
		
			921 B
		
	
	
	
		
			TypeScript
		
	
	
	
|  | import { _decorator, Component, Node } from 'cc'; | ||
|  | import { BaseButton } from '../../GlobalScript/CommonComponent/BaseButton'; | ||
|  | import { NpkImage } from '../../Tool/NPKImage'; | ||
|  | import { BaseButtonAction } from '../../GlobalScript/CommonComponent/BaseButtonAction'; | ||
|  | const { ccclass, property } = _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; | ||
|  | 
 | ||
|  |     } | ||
|  | 
 | ||
|  | } | ||
|  | 
 | ||
|  | 
 |