| 
									
										
										
										
											2024-03-19 18:03:50 +08:00
										 |  |  | import { _decorator, Node } from 'cc'; | 
					
						
							| 
									
										
										
										
											2024-03-14 14:19:45 +08:00
										 |  |  | import { BaseButton } from '../../GlobalScript/CommonComponent/BaseButton'; | 
					
						
							|  |  |  | import { NpkImage } from '../../Tool/NPKImage'; | 
					
						
							|  |  |  | import { BaseButtonAction } from '../../GlobalScript/CommonComponent/BaseButtonAction'; | 
					
						
							| 
									
										
										
										
											2024-03-19 18:03:50 +08:00
										 |  |  | const { ccclass } = _decorator; | 
					
						
							| 
									
										
										
										
											2024-03-14 14:19:45 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-19 18:03:50 +08:00
										 |  |  | @ccclass('CloseButtonNode') | 
					
						
							|  |  |  | export class CloseButtonNode extends Node { | 
					
						
							| 
									
										
										
										
											2024-03-14 14:19:45 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     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; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-19 18:03:50 +08:00
										 |  |  | }  | 
					
						
							|  |  |  |   |