| 
									
										
										
										
											2024-12-11 15:08:57 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 文件名:SpriteFrameClass.nut | 
					
						
							|  |  |  | 路径:BaseClass/SpriteObject/SpriteFrameClass.nut | 
					
						
							|  |  |  | 创建日期:2024-05-05	09:36 | 
					
						
							|  |  |  | 文件用途:精灵帧类 | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | class CL_SpriteFrameObject extends CL_BaseObject { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-17 09:42:05 +08:00
										 |  |  |     ImgPath = null; | 
					
						
							|  |  |  |     ImgIndex = null; | 
					
						
							| 
									
										
										
										
											2024-12-11 15:08:57 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-03 19:49:49 +08:00
										 |  |  |     function _typeof() { | 
					
						
							|  |  |  |         return "SpriteFrame"; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-11 15:08:57 +08:00
										 |  |  |     constructor(...) { | 
					
						
							|  |  |  |         if (vargv.len() == 2) { | 
					
						
							| 
									
										
										
										
											2024-12-17 09:42:05 +08:00
										 |  |  |             ImgPath = vargv[0]; | 
					
						
							|  |  |  |             ImgIndex = vargv[1]; | 
					
						
							|  |  |  |             C_Object = SpriteFrame_Create(ImgPath, ImgIndex); | 
					
						
							| 
									
										
										
										
											2024-12-11 15:08:57 +08:00
										 |  |  |         } else { | 
					
						
							|  |  |  |             C_Object = vargv[0]; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         // base.constructor(C_Object); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-03 19:49:49 +08:00
										 |  |  |     //重写获取大小 | 
					
						
							|  |  |  |     function GetSize() { | 
					
						
							|  |  |  |         return SpriteFrame_GetSize(this.C_Object); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //重写设置坐标 | 
					
						
							|  |  |  |     function SetPosition(Value, ...) { | 
					
						
							|  |  |  |         if (vargv.len() == 0) { | 
					
						
							|  |  |  |             X = Value.x; | 
					
						
							|  |  |  |             Y = Value.y; | 
					
						
							|  |  |  |             SpriteFrame_SetPosition(this.C_Object, Value); | 
					
						
							|  |  |  |         } else if (vargv.len() == 1) { | 
					
						
							|  |  |  |             X = Value; | 
					
						
							|  |  |  |             Y = vargv[0]; | 
					
						
							|  |  |  |             SpriteFrame_SetPosition(this.C_Object, Value, vargv[0]); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //返回一个画布精灵 | 
					
						
							|  |  |  |     function CreateOutLine(Color) { | 
					
						
							|  |  |  |         return CL_SpriteObject(SpriteFrame_CreateOutLine(this.C_Object, Color)); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-12-11 15:08:57 +08:00
										 |  |  | } |