public void CreateItem(Character c, ItemShort[] items) { bool created = false; for(int i=0; i<this.recipe.Length; i++) { if(this.recipe[i].CanCreate(items)) { this.recipe[i].CreateItem(c, items); created = true; break; } } if(!created) { for(int i=0; i<items.Length; i++) { items[i].RemoveFromInventory(); } } }
public bool Equals(ItemShort item) { return (this.type == item.type && this.id == item.id && this.quantity == item.quantity); }
private ItemShort ItemSettings(ItemShort ingredient) { ItemDropType tmp = ingredient.type; ingredient.type = (ItemDropType)this.EnumToolbar("Type", (int)ingredient.type, typeof(ItemDropType)); if(tmp != ingredient.type) ingredient.id = 0; if(ItemDropType.ITEM.Equals(ingredient.type)) { ingredient.id = EditorGUILayout.Popup("Item", ingredient.id, DataHolder.Items().GetNameList(true), GUILayout.Width(pw.mWidth)); } else if(ItemDropType.WEAPON.Equals(ingredient.type)) { ingredient.id = EditorGUILayout.Popup("Weapon", ingredient.id, DataHolder.Weapons().GetNameList(true), GUILayout.Width(pw.mWidth)); } else if(ItemDropType.ARMOR.Equals(ingredient.type)) { ingredient.id = EditorGUILayout.Popup("Armor", ingredient.id, DataHolder.Armors().GetNameList(true), GUILayout.Width(pw.mWidth)); } ingredient.quantity = EditorGUILayout.IntField("Quantity", ingredient.quantity, GUILayout.Width(pw.mWidth)); if(ingredient.quantity < 1) ingredient.quantity = 1; EditorGUILayout.Separator(); return ingredient; }
public static ItemShort[] Remove(int index, ItemShort[] list) { ArrayList tmp = new ArrayList(); foreach(ItemShort str in list) tmp.Add(str); tmp.RemoveAt(index); return tmp.ToArray(typeof(ItemShort)) as ItemShort[]; }
public static ItemShort[] Add(ItemShort n, ItemShort[] list) { ArrayList tmp = new ArrayList(); foreach(ItemShort str in list) tmp.Add(str); tmp.Add(n); return tmp.ToArray(typeof(ItemShort)) as ItemShort[]; }