| 
									
										
										
										
											2025-05-28 18:47:51 +08:00
										 |  |  | import type { TrophyRecord } from "../../types/global" | 
					
						
							|  |  |  | import { config } from "../../constants/config" | 
					
						
							|  |  |  | import { MONTH_LIST } from "../../models/DCManager" | 
					
						
							| 
									
										
										
										
											2025-06-05 14:57:04 +08:00
										 |  |  | import { ResourceManager } from "../../models/ResourceManager" | 
					
						
							| 
									
										
										
										
											2025-05-22 14:54:48 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-28 18:47:51 +08:00
										 |  |  | const { regClass, property } = Laya | 
					
						
							| 
									
										
										
										
											2025-05-22 14:54:48 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | @regClass() | 
					
						
							|  |  |  | export class TrophyClaim extends Laya.Script { | 
					
						
							| 
									
										
										
										
											2025-05-28 18:47:51 +08:00
										 |  |  |   declare owner: Laya.Box | 
					
						
							| 
									
										
										
										
											2025-05-22 14:54:48 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-28 18:47:51 +08:00
										 |  |  |   @property(Laya.Image) | 
					
						
							|  |  |  |   public icon: Laya.Image | 
					
						
							| 
									
										
										
										
											2025-05-22 14:54:48 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-28 18:47:51 +08:00
										 |  |  |   @property(Laya.Label) | 
					
						
							|  |  |  |   public label_date: Laya.Label | 
					
						
							| 
									
										
										
										
											2025-05-22 14:54:48 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-28 18:47:51 +08:00
										 |  |  |   @property(Laya.Box) | 
					
						
							|  |  |  |   public btn_close: Laya.Box | 
					
						
							| 
									
										
										
										
											2025-05-22 14:54:48 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-28 18:47:51 +08:00
										 |  |  |   public onSetShow(record: TrophyRecord): void { | 
					
						
							|  |  |  |     for (let i = 0; i < MONTH_LIST.length; i++) { | 
					
						
							|  |  |  |       const obj = MONTH_LIST[i] | 
					
						
							| 
									
										
										
										
											2025-05-28 19:15:32 +08:00
										 |  |  |       if (obj.year === record.year && obj.month === record.month) { | 
					
						
							| 
									
										
										
										
											2025-06-05 14:57:04 +08:00
										 |  |  |         ResourceManager.getInstance().loadTexture(obj.icon_res, this.icon) | 
					
						
							| 
									
										
										
										
											2025-05-28 18:47:51 +08:00
										 |  |  |         break | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2025-05-22 14:54:48 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-28 18:47:51 +08:00
										 |  |  |     this.label_date.text = `${config.MONTH_ABBRS[record.month - 1]} ${record.day},${record.year}` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     this.btn_close.on(Laya.Event.CLICK, this, () => { | 
					
						
							|  |  |  |       this.owner.destroy() | 
					
						
							|  |  |  |     }) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } |