private static string putOnPart(FreeData fd, int weaponType, FreeItemInfo info, string toInv = "", ServerRoom room = null) { WeaponResConfigItem weapon = GetWeapon(fd, weaponType); if (weapon != null) { foreach (EWeaponPartType part in SingletonManager.Get <WeaponPartsConfigManager>().GetAvaliablePartTypes(weapon.Id)) { int p = FreeWeaponUtil.GetWeaponPart(part); int detailId = WeaponUtil.GetRealAttachmentId(info.id, weapon.Id); if (SingletonManager.Get <WeaponPartsConfigManager>().IsPartMatchWeapon(detailId, weapon.Id)) { if ("p" + p == info.subType) { string inv = "w" + weaponType + p; ItemInventory ii = fd.freeInventory.GetInventoryManager().GetInventory(inv); if (ii != null && (ii.posList.Count == 0 || toInv.StartsWith("w" + weaponType))) { if (ii.posList.Count > 0) { DropPart(inv, fd, room); } return(inv); } } } } } return(null); }
private static string putOnPart(FreeData fd, int weaponType, FreeItemInfo info, string toInv = "", ServerRoom room = null) { WeaponResConfigItem weapon = GetWeapon(fd, weaponType); if (weapon != null) { int detailId = WeaponPartUtil.GetWeaponFstMatchedPartId(info.id, weapon.Id); var weaponconfigMngr = SingletonManager.Get <WeaponConfigManagement>().FindConfigById(weapon.Id); foreach (EWeaponPartType part in weaponconfigMngr.ApplyPartsSlot) { int p = FreeWeaponUtil.GetWeaponPart(part); if (weaponconfigMngr.IsPartMatchWeapon(detailId)) { if ("p" + p == info.subType) { string inv = "w" + weaponType + p; ItemInventory ii = fd.freeInventory.GetInventoryManager().GetInventory(inv); if (ii != null && (ii.posList.Count == 0 || toInv.StartsWith("w" + weaponType))) { if (ii.posList.Count > 0) { DropPart(inv, fd, room); } return(inv); } } } } } return(null); }
private void redrawPart(ItemInventory inventory, ISkillArgs args, ItemPosition ip, FreeData fd) { if (inventory.name == "w1" || inventory.name == "w2" || inventory.name == "w3") { int id = (int)((IntPara)ip.GetParameters().Get("itemId")).GetValue(); WeaponResConfigItem config = SingletonManager.Get <WeaponResourceConfigManager>().GetConfigById(id); if (config != null) { HashSet <int> list = new HashSet <int>(); foreach (XmlConfig.EWeaponPartType part in SingletonManager.Get <WeaponPartsConfigManager>().GetAvaliablePartTypes(id)) { list.Add(FreeWeaponUtil.GetWeaponPart(part)); } List <string> showP = new List <string>(); List <string> hideP = new List <string>(); for (int i = 1; i <= 5; i++) { if (list.Contains(i)) { showP.Add(i.ToString()); } else { hideP.Add(i.ToString()); } } ShowPartAction show = new ShowPartAction(); show.show = true; show.SetPlayer("current"); show.SetScope(1); if (inventory.name == "w1") { show.weaponKey = "1"; } else if (inventory.name == "w2") { show.weaponKey = "2"; } else { show.weaponKey = "3"; } show.parts = StringUtil.GetStringFromStrings(showP, ","); show.Act(args); show.show = false; show.parts = StringUtil.GetStringFromStrings(hideP, ","); show.Act(args); } else { Debug.LogError(ip.key.GetName() + " 没有定义配件."); } } }
private void redrawPart(ItemInventory inventory, ISkillArgs args, ItemPosition ip, FreeData fd) { if (inventory.name == ChickenConstant.BagPrimeWeapon || inventory.name == ChickenConstant.BagSecondaryWeapon || inventory.name == ChickenConstant.BagPistolWeapon) { int id = (int)((IntPara)ip.GetParameters().Get("itemId")).GetValue(); WeaponAllConfigs configs = SingletonManager.Get <WeaponConfigManagement>().FindConfigById(id); if (configs != null) { HashSet <int> list = new HashSet <int>(); foreach (XmlConfig.EWeaponPartType part in configs.ApplyPartsSlot) { list.Add(FreeWeaponUtil.GetWeaponPart(part)); } List <string> showP = new List <string>(); List <string> hideP = new List <string>(); for (int i = 1; i <= 5; i++) { if (list.Contains(i)) { showP.Add(i.ToString()); } else { hideP.Add(i.ToString()); } } ShowPartAction show = new ShowPartAction(); show.show = true; show.SetPlayer("current"); show.SetScope(1); if (inventory.name == ChickenConstant.BagPrimeWeapon) { show.weaponKey = "1"; } else if (inventory.name == ChickenConstant.BagSecondaryWeapon) { show.weaponKey = "2"; } else { show.weaponKey = "3"; } show.parts = StringUtil.GetStringFromStrings(showP, ","); show.Act(args); show.show = false; show.parts = StringUtil.GetStringFromStrings(hideP, ","); show.Act(args); } else { Debug.LogError(ip.key.GetName() + " 没有定义配件."); } } }