| 
									
										
										
										
											2024-12-13 20:50:18 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 文件名:Equipment.nut | 
					
						
							|  |  |  | 路径:User/Asset/Item/Equipment.nut | 
					
						
							|  |  |  | 创建日期:2024-12-12	19:03 | 
					
						
							|  |  |  | 文件用途: | 
					
						
							|  |  |  | */ | 
					
						
							| 
									
										
										
										
											2025-01-04 20:03:17 +08:00
										 |  |  | //装备信息窗口 | 
					
						
							|  |  |  | class GameItem.EquipmentInfo extends Yosin_Window { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //装备 | 
					
						
							|  |  |  |     Equipment = null; | 
					
						
							|  |  |  |     //画布 | 
					
						
							|  |  |  |     Canvas = null; | 
					
						
							|  |  |  |     //稀有度边框颜色对应Idx表 | 
					
						
							|  |  |  |     RarityColorIdx = [ | 
					
						
							|  |  |  |         0, //白装 普通 | 
					
						
							|  |  |  |         1, //蓝装 高级 | 
					
						
							|  |  |  |         2, //紫装 稀有 | 
					
						
							|  |  |  |         4, //粉装 神器 | 
					
						
							|  |  |  |         6, //金装 史诗 | 
					
						
							|  |  |  |         3, //红装 勇者 | 
					
						
							|  |  |  |         5, //橙装 传说 | 
					
						
							|  |  |  |     ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     constructor(Equipment) { | 
					
						
							|  |  |  |         this.Equipment = Equipment.weakref(); | 
					
						
							|  |  |  |         base.constructor(clock() + "EquipmentInfo" + Equipment.Idx, 0, 0, 0, 0, 0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         local background = Yosin_NineBoxStretch(0, 0, 210, 50, "sprite/interface/lenheartwindowcommon.img", 213); | 
					
						
							|  |  |  |         AddUIChild(background); | 
					
						
							|  |  |  |         //210 | 
					
						
							|  |  |  |         Init(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function Init() { | 
					
						
							|  |  |  |         Canvas = CL_CanvasObject(); | 
					
						
							|  |  |  |         Canvas.ResizeAndClear(210, 600); | 
					
						
							|  |  |  |         Canvas.SetFillBrush(sq_RGBA(255, 255, 255, 250)); | 
					
						
							|  |  |  |         Canvas.SetStrokeBrush(sq_RGBA(255, 255, 255, 250)); | 
					
						
							|  |  |  |         Canvas.BeginDraw(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //构造图标 及图标边框 | 
					
						
							|  |  |  |         if (Equipment.Icon) { | 
					
						
							|  |  |  |             local Icon = CL_SpriteFrameObject(Equipment.Icon.path, Equipment.Icon.index); | 
					
						
							|  |  |  |             Canvas.DrawSpriteFrame(Icon, 7, 7); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             local IconFrame = CL_SpriteFrameObject("sprite/item/iconmark.img", 62 + RarityColorIdx[Equipment.Rarity]); | 
					
						
							|  |  |  |             Canvas.DrawSpriteFrame(IconFrame, 7, 7); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //绘制装备名称 | 
					
						
							|  |  |  |         if (Equipment.Name.len() > 0) { | 
					
						
							|  |  |  |             local EquName = FontAssetManager.GenerateNormal(Equipment.Name, true, { | 
					
						
							|  |  |  |                 color = sq_RGBA(255, 0, 255 255) | 
					
						
							|  |  |  |             }); | 
					
						
							|  |  |  |             Canvas.DrawActor(EquName, 41, 7); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         Canvas.EndDraw(); | 
					
						
							|  |  |  |         Addchild(Canvas); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-13 20:50:18 +08:00
										 |  |  | class GameItem.Equipment extends GameItem.Item { | 
					
						
							|  |  |  |     //装备ID | 
					
						
							|  |  |  |     Idx = -1; | 
					
						
							|  |  |  |     //装备名称 | 
					
						
							|  |  |  |     Name = ""; | 
					
						
							|  |  |  |     //装备类型 | 
					
						
							|  |  |  |     Type = -1; | 
					
						
							|  |  |  |     //装备槽位 | 
					
						
							|  |  |  |     SlotType = -1; | 
					
						
							|  |  |  |     //装备可穿戴等级 | 
					
						
							|  |  |  |     Minimum_level = -1; | 
					
						
							|  |  |  |     //装备等级组 | 
					
						
							|  |  |  |     Grade = null; | 
					
						
							| 
									
										
										
										
											2025-01-04 20:03:17 +08:00
										 |  |  |     //装备稀有度 | 
					
						
							|  |  |  |     Rarity = 0; | 
					
						
							| 
									
										
										
										
											2024-12-13 20:50:18 +08:00
										 |  |  |     //装备可穿戴职业 | 
					
						
							|  |  |  |     Job = 0; | 
					
						
							|  |  |  |     //装备图标 | 
					
						
							| 
									
										
										
										
											2025-01-04 20:03:17 +08:00
										 |  |  |     Icon = null; | 
					
						
							| 
									
										
										
										
											2024-12-13 20:50:18 +08:00
										 |  |  |     //动画 | 
					
						
							|  |  |  |     Animation_Job = null; | 
					
						
							|  |  |  |     //装备描述 | 
					
						
							|  |  |  |     Description = ""; | 
					
						
							|  |  |  |     //文件路径 | 
					
						
							|  |  |  |     DirPath = null; | 
					
						
							| 
									
										
										
										
											2024-12-17 09:41:42 +08:00
										 |  |  |     //光环特效 | 
					
						
							|  |  |  |     Aurora_effects = null; | 
					
						
							| 
									
										
										
										
											2024-12-13 20:50:18 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     //装备属性 | 
					
						
							|  |  |  |     Property = null; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     constructor(...) { | 
					
						
							|  |  |  |         //直接裸构造 | 
					
						
							|  |  |  |         if (vargv.len() == 0) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         //通过参数构造 | 
					
						
							|  |  |  |         else if (vargv.len() == 1) { | 
					
						
							|  |  |  |             //通过ID构造 | 
					
						
							|  |  |  |             if (typeof vargv[0] == "integer") { | 
					
						
							|  |  |  |                 local EquInfo = AssetManager.GetEquipment(vargv[0]); | 
					
						
							|  |  |  |                 if (EquInfo) { | 
					
						
							|  |  |  |                     Idx = vargv[0]; | 
					
						
							| 
									
										
										
										
											2025-01-04 20:03:17 +08:00
										 |  |  |                     //名称 | 
					
						
							| 
									
										
										
										
											2024-12-15 20:16:48 +08:00
										 |  |  |                     if (EquInfo.rawin("name")) Name = EquInfo["name"]; | 
					
						
							| 
									
										
										
										
											2025-01-04 20:03:17 +08:00
										 |  |  |                     //类型 | 
					
						
							| 
									
										
										
										
											2024-12-15 20:16:48 +08:00
										 |  |  |                     if (EquInfo.rawin("type")) GetRealEquipmentType(EquInfo["type"].path); | 
					
						
							| 
									
										
										
										
											2025-01-04 20:03:17 +08:00
										 |  |  |                     //最低使用等级 | 
					
						
							| 
									
										
										
										
											2024-12-15 20:16:48 +08:00
										 |  |  |                     if (EquInfo.rawin("minimum level")) Minimum_level = EquInfo["minimum level"]; | 
					
						
							| 
									
										
										
										
											2025-01-04 20:03:17 +08:00
										 |  |  |                     //等级组 | 
					
						
							| 
									
										
										
										
											2024-12-15 20:16:48 +08:00
										 |  |  |                     if (EquInfo.rawin("grade")) Grade = EquInfo["grade"]; | 
					
						
							| 
									
										
										
										
											2025-01-04 20:03:17 +08:00
										 |  |  |                     //稀有度 | 
					
						
							|  |  |  |                     if (EquInfo.rawin("rarity")) Rarity = EquInfo["rarity"]; | 
					
						
							|  |  |  |                     //职业 | 
					
						
							| 
									
										
										
										
											2024-12-15 20:16:48 +08:00
										 |  |  |                     if (EquInfo.rawin("usable_job")) Job = EquInfo["usable_job"]; | 
					
						
							| 
									
										
										
										
											2025-01-04 20:03:17 +08:00
										 |  |  |                     //图标 | 
					
						
							| 
									
										
										
										
											2024-12-15 20:16:48 +08:00
										 |  |  |                     if (EquInfo.rawin("icon")) Icon = EquInfo["icon"]; | 
					
						
							|  |  |  |                     if (EquInfo.rawin("Ani")) Animation_Job = EquInfo["Ani"]; | 
					
						
							|  |  |  |                     if (EquInfo.rawin("DirPath")) DirPath = EquInfo["DirPath"]; | 
					
						
							| 
									
										
										
										
											2024-12-17 09:41:42 +08:00
										 |  |  |                     if (EquInfo.rawin("aurora_effects")) Aurora_effects = EquInfo["aurora_effects"]; | 
					
						
							| 
									
										
										
										
											2024-12-13 20:50:18 +08:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //设置真实装备类型 | 
					
						
							|  |  |  |     function SetRealEquipmentType(AType, BType) { | 
					
						
							|  |  |  |         SlotType = AType; | 
					
						
							|  |  |  |         Type = BType; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     //获取真实装备类型 | 
					
						
							|  |  |  |     function GetRealEquipmentType(EType) { | 
					
						
							|  |  |  |         if (EType == "skin avatar") SetRealEquipmentType("skin", "avatar"); | 
					
						
							|  |  |  |         else if (EType == "weapon") SetRealEquipmentType("weapon", "equipment"); | 
					
						
							|  |  |  |         else if (EType == "hat avatar") SetRealEquipmentType("hat", "avatar"); | 
					
						
							|  |  |  |         else if (EType == "hair avatar") SetRealEquipmentType("hair", "avatar"); | 
					
						
							|  |  |  |         else if (EType == "coat avatar") SetRealEquipmentType("coat", "avatar"); | 
					
						
							|  |  |  |         else if (EType == "pants avatar") SetRealEquipmentType("pants", "avatar"); | 
					
						
							|  |  |  |         else if (EType == "waist avatar") SetRealEquipmentType("waist", "avatar"); | 
					
						
							|  |  |  |         else if (EType == "shoes avatar") SetRealEquipmentType("shoes", "avatar"); | 
					
						
							|  |  |  |         else if (EType == "breast avatar") SetRealEquipmentType("breast", "avatar"); | 
					
						
							|  |  |  |         else if (EType == "face avatar") SetRealEquipmentType("face", "avatar"); | 
					
						
							| 
									
										
										
										
											2024-12-17 09:41:42 +08:00
										 |  |  |         else if (EType == "aurora avatar") SetRealEquipmentType("aurora", "aurora"); | 
					
						
							| 
									
										
										
										
											2024-12-13 20:50:18 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-04 20:03:17 +08:00
										 |  |  |     //获取装备信息窗口 | 
					
						
							|  |  |  |     function GetEquipmentInfoWindow() { | 
					
						
							|  |  |  |         if (Property) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             return GameItem.EquipmentInfo(this); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-13 20:50:18 +08:00
										 |  |  |     //穿戴装备回调 | 
					
						
							|  |  |  |     function OnWearStart() { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //穿戴时 | 
					
						
							|  |  |  |     function OnWearProc(Dt) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //卸载时 | 
					
						
							|  |  |  |     function OnWearEnd() { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |