94 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
		
		
			
		
	
	
			94 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
|  | /* | ||
|  | 文件名:Equipment.nut | ||
|  | 路径:User/Asset/Item/Equipment.nut | ||
|  | 创建日期:2024-12-12	19:03 | ||
|  | 文件用途: | ||
|  | */ | ||
|  | class GameItem.Equipment extends GameItem.Item { | ||
|  |     //装备ID | ||
|  |     Idx = -1; | ||
|  |     //装备名称 | ||
|  |     Name = ""; | ||
|  |     //装备类型 | ||
|  |     Type = -1; | ||
|  |     //装备槽位 | ||
|  |     SlotType = -1; | ||
|  |     //装备可穿戴等级 | ||
|  |     Minimum_level = -1; | ||
|  |     //装备等级组 | ||
|  |     Grade = null; | ||
|  |     //装备可穿戴职业 | ||
|  |     Job = 0; | ||
|  |     //装备图标 | ||
|  |     Icon = ""; | ||
|  |     //动画 | ||
|  |     Animation_Job = null; | ||
|  |     //装备描述 | ||
|  |     Description = ""; | ||
|  |     //文件路径 | ||
|  |     DirPath = null; | ||
|  | 
 | ||
|  |     //装备属性 | ||
|  |     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]; | ||
|  |                     Name = EquInfo["name"]; | ||
|  |                     GetRealEquipmentType(EquInfo["type"].path); | ||
|  |                     Minimum_level = EquInfo["minimum level"]; | ||
|  |                     Grade = EquInfo["grade"]; | ||
|  |                     Job = EquInfo["usable_job"]; | ||
|  |                     Icon = EquInfo["icon"]; | ||
|  |                     Animation_Job = EquInfo["Ani"]; | ||
|  |                     DirPath = EquInfo["DirPath"]; | ||
|  |                 } | ||
|  |             } | ||
|  |         } | ||
|  |     } | ||
|  | 
 | ||
|  |     //设置真实装备类型 | ||
|  |     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"); | ||
|  |     } | ||
|  | 
 | ||
|  |     //穿戴装备回调 | ||
|  |     function OnWearStart() { | ||
|  | 
 | ||
|  |     } | ||
|  | 
 | ||
|  |     //穿戴时 | ||
|  |     function OnWearProc(Dt) { | ||
|  | 
 | ||
|  |     } | ||
|  | 
 | ||
|  |     //卸载时 | ||
|  |     function OnWearEnd() { | ||
|  | 
 | ||
|  |     } | ||
|  | 
 | ||
|  | 
 | ||
|  | } |