/// <summary> /// 角色卸下装备 /// </summary> /// <param name="equipment">Equipment.</param> /// <param name="equipmentIndexInPanel">Equipment index in panel.</param> public PropertyChange UnloadEquipment(Equipment equipment, int equipmentIndexInPanel, int indexInBag = -1) { SoundManager.Instance.PlayAudioClip("UI/sfx_UI_Equipment"); equipment.equiped = false; Debug.LogFormat("卸下装备{0}/{1}", equipmentIndexInPanel, allEquipedEquipments.Length); if (equipment.itemId < 0) { return(new PropertyChange()); } if (indexInBag == -1) { allItemsInBag.Add(equipment); } else { allItemsInBag.Insert(indexInBag, equipment); } for (int i = 0; i < equipment.attachedSkills.Count; i++) { TriggeredSkill attachedSkill = equipment.attachedSkills [i]; attachedTriggeredSkills.Remove(attachedSkill); if (!(battleAgentCtr as BattlePlayerController).isInFight) { equipment.attachedSkills.Remove(attachedSkill); Destroy(attachedSkill.gameObject); i--; } } Equipment emptyEquipment = new Equipment(); allEquipedEquipments [equipmentIndexInPanel] = emptyEquipment; PropertyChange pc = ResetBattleAgentProperties(false); Transform exploreManager = TransformManager.FindTransform("ExploreManager"); if (exploreManager != null) { ExploreManager manager = exploreManager.GetComponent <ExploreManager> (); manager.UpdatePlayerPropertyCalculator(); manager.UpdateTriggeredCallBacks(); manager.UpdatePlayerStatusPlane(); } return(pc); }
/// <summary> /// 角色穿上装备 /// </summary> /// <param name="equipment">Equipment.</param> /// <param name="equipmentIndexInPanel">Equipment index in panel.</param> public PropertyChange EquipEquipment(Equipment equipment, int equipmentIndexInPanel) { SoundManager.Instance.PlayAudioClip("UI/sfx_UI_Equipment"); equipment.equiped = true; Debug.LogFormat("穿上装备{0}", equipmentIndexInPanel); allEquipedEquipments [equipmentIndexInPanel] = equipment; // equipmentDragControl.item = equipment; if (equipment.attachedSkills.Count == 0) { for (int i = 0; i < equipment.attachedSkillInfos.Length; i++) { TriggeredSkill attachedSkill = SkillGenerator.Instance.GenerateTriggeredSkill(equipment, equipment.attachedSkillInfos [i], triggeredSkillsContainer); equipment.attachedSkills.Add(attachedSkill); attachedTriggeredSkills.Add(attachedSkill); attachedSkill.transform.SetParent(triggeredSkillsContainer); } } else { for (int i = 0; i < equipment.attachedSkills.Count; i++) { TriggeredSkill attachedSkill = equipment.attachedSkills [i]; attachedTriggeredSkills.Add(attachedSkill); } } allItemsInBag.Remove(equipment); PropertyChange pc = ResetBattleAgentProperties(false); Transform exploreManager = TransformManager.FindTransform("ExploreManager"); if (exploreManager != null) { ExploreManager manager = exploreManager.GetComponent <ExploreManager> (); manager.UpdatePlayerPropertyCalculator(); manager.UpdateTriggeredCallBacks(); manager.UpdatePlayerStatusPlane(); } return(pc); }