| 
									
										
										
										
											2025-05-09 19:10:40 +08:00
										 |  |  | import { UIManager } from "../models/UIManager"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const { regClass, property } = Laya | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @regClass() | 
					
						
							|  |  |  | export class Home extends Laya.Script { | 
					
						
							|  |  |  |     declare owner : Laya.Box; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @property(Laya.Button) | 
					
						
							|  |  |  |     public btn_start: Laya.Button; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-13 20:31:44 +08:00
										 |  |  |     @property(Laya.Button) | 
					
						
							|  |  |  |     public btn_clean: Laya.Button; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-09 19:10:40 +08:00
										 |  |  |     //组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次
 | 
					
						
							|  |  |  |     onAwake(): void { | 
					
						
							|  |  |  |       this.btn_start.on(Laya.Event.CLICK, this, (evt: Laya.Event) => { | 
					
						
							|  |  |  |         console.log("btn_start=", evt); | 
					
						
							| 
									
										
										
										
											2025-05-14 12:17:47 +08:00
										 |  |  |         UIManager.getInstance().loadStage("first"); | 
					
						
							| 
									
										
										
										
											2025-05-12 22:06:04 +08:00
										 |  |  |         this.owner.destroy() | 
					
						
							| 
									
										
										
										
											2025-05-09 19:10:40 +08:00
										 |  |  |       }) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-13 20:31:44 +08:00
										 |  |  |       this.btn_clean.on(Laya.Event.CLICK, this, (evt: Laya.Event) => { | 
					
						
							|  |  |  |         console.log("btn_clean=", evt); | 
					
						
							|  |  |  |         Laya.LocalStorage.clear() | 
					
						
							|  |  |  |       }) | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-05-09 19:10:40 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |