static private ReserveEquipID ( EquipType type ) : int | ||
type | EquipType | |
리턴 | int |
public int AddEquipTexture(EquipTexture equipTexture, ModItem item, EquipType type, string name, string texture, string armTexture = "", string femaleTexture = "") { int slot = EquipLoader.ReserveEquipID(type); equipTexture.Texture = texture; equipTexture.mod = this; equipTexture.Name = name; equipTexture.Type = type; equipTexture.Slot = slot; equipTexture.item = item; EquipLoader.equipTextures[type][slot] = equipTexture; ModLoader.GetTexture(texture); if (type == EquipType.Body) { EquipLoader.armTextures[slot] = armTexture; EquipLoader.femaleTextures[slot] = femaleTexture.Length > 0 ? femaleTexture : texture; ModLoader.GetTexture(armTexture); ModLoader.GetTexture(femaleTexture); } if (item != null && (type == EquipType.Head || type == EquipType.Body || type == EquipType.Legs)) { EquipLoader.slotToId[type][slot] = item.item.type; } return(slot); }
/// <summary> /// Adds an equipment texture of the specified type, internal name, and associated item to your mod. /// This method is different from the other AddEquipTexture in that you can specify the class of the equipment texture, thus allowing you to override EquipmentTexture's hooks. /// All other parameters are the same as the other AddEquipTexture. /// </summary> /// <param name="equipTexture">The equip texture.</param> /// <param name="item">The item.</param> /// <param name="type">The type.</param> /// <param name="name">The name.</param> /// <param name="texture">The texture.</param> /// <param name="armTexture">The arm texture (for body slots).</param> /// <param name="femaleTexture">The female texture (for body slots), if missing the regular body texture is used.</param> /// <returns></returns> public int AddEquipTexture(EquipTexture equipTexture, ModItem item, EquipType type, string texture) { if (!loading) { throw new Exception("AddEquipTexture can only be called from Mod.Load or Mod.Autoload"); } ModContent.GetTexture(texture); //ensure texture exists equipTexture.Texture = texture; equipTexture.Mod = this; equipTexture.Name = item.Name; equipTexture.Type = type; equipTexture.Item = item; int slot = equipTexture.Slot = EquipLoader.ReserveEquipID(type); EquipLoader.equipTextures[type][slot] = equipTexture; equipTextures[Tuple.Create(item.Name, type)] = equipTexture; if (type == EquipType.Body) { if (!ModContent.TextureExists(item.FemaleTexture)) { EquipLoader.femaleTextures[slot] = texture; } else { EquipLoader.femaleTextures[slot] = item.FemaleTexture; } ModContent.GetTexture(item.ArmTexture); //ensure texture exists EquipLoader.armTextures[slot] = item.ArmTexture; } if (!EquipLoader.idToSlot.TryGetValue(item.Type, out IDictionary <EquipType, int> slots)) { EquipLoader.idToSlot[item.Type] = slots = new Dictionary <EquipType, int>(); } slots[type] = slot; if (type == EquipType.Head || type == EquipType.Body || type == EquipType.Legs) { EquipLoader.slotToId[type][slot] = item.Type; } return(slot); }
public int AddEquipTexture(ModItem item, EquipType type, string texture, string armTexture = "", string femaleTexture = "") { int slot = EquipLoader.ReserveEquipID(type); EquipLoader.equips[type][texture] = slot; ModLoader.GetTexture(texture); if (type == EquipType.Body) { EquipLoader.armTextures[slot] = armTexture; EquipLoader.femaleTextures[slot] = femaleTexture.Length > 0 ? femaleTexture : texture; ModLoader.GetTexture(armTexture); ModLoader.GetTexture(femaleTexture); } if (type == EquipType.Head || type == EquipType.Body || type == EquipType.Legs) { EquipLoader.slotToId[type][slot] = item.item.type; } return(slot); }