Example #1
0
        public CraftingBlueprintEditor(string singleName, string pluralName, EditorWindow window, EmptyEditor parentEditor, CraftingCategory category) : base(singleName, pluralName, window)
        {
            //            this._parentEditor = parentEditor;

            this.category = category;

            forceUpdateIDsWhenOutOfSync = false; // Don't sync ID's are global over all categories.
            canReOrderItems             = true;
        }
        public virtual void Repaint(CraftingCategory category, ItemCategory itemCategory)
        {
            title.text = category.name;

            if (icon != null)
            {
                icon.sprite = itemCategory.icon;
            }
        }
Example #3
0
 public ModItem(ItemType type, string name, string description)
 {
     this.type             = type;
     this.name             = name;
     this.displayName      = name;
     this.description      = description;
     this.stackSize        = this.stackSize;
     this.inventoryIcon    = null;
     this.craftingCategory = CraftingCategory.Nothing;
     this.durability       = 0;
     this.stackSize        = 20;
 }
Example #4
0
    // Token: 0x06000074 RID: 116
    public static void AddItem(Mod mod, ModItem item)
    {
        ItemType         itemType         = (ItemType)1;
        CraftingCategory craftingCategory = (CraftingCategory)2;
        int       id        = 399 + ModHelper.modItems.Count;
        Item_Base item_Base = new Item_Base();

        item_Base.Initialize(id, item.name, itemType, item.durability);
        item_Base.name = item.name;
        item_Base.settings_Inventory             = new ItemInstance_Inventory(item.inventoryIcon, "Item/" + item.name, item.stackSize);
        item_Base.settings_Inventory.DisplayName = item.displayName;
        item_Base.settings_Inventory.Description = item.description;
        item_Base.settings_usable         = new ItemInstance_Usable("LMD", 0f, 0, false, false, 0, 0, false, false, false, "LMD");
        item_Base.settings_recipe         = new ItemInstance_Recipe(craftingCategory, item.isUnlocked, item.isUnlocked, "", 0);
        item_Base.settings_recipe.NewCost = new CostMultiple[]
        {
            new CostMultiple(new Item_Base[]
            {
                ItemManager.GetItemByName("Scrap")
            }, 1)
        };
        item_Base.settings_equipment   = new ItemInstance_Equipment(0);
        item_Base.settings_cookable    = new ItemInstance_Cookable(0, 0f, null);
        item_Base.settings_consumeable = new ItemInstance_Consumeable(0f, 0f, false, null, 0);
        item_Base.settings_buildable   = new ItemInstance_Buildable(null, false, false);
        try
        {
            BindingFlags     accessPrivateStatic = (BindingFlags)40;
            FieldInfo        field = typeof(ItemManager).GetField("allAvailableItems", accessPrivateStatic);
            List <Item_Base> list  = (List <Item_Base>)field.GetValue(null);
            list.Add(item_Base);
            field.SetValue(null, list);
            item.Initialize(item_Base);
            if (!ModHelper.modItems.ContainsKey(mod))
            {
                ModHelper.modItems[mod] = new List <ModItem>();
            }
            ModHelper.modItems[mod].Add(item);
            RConsole.Log(string.Concat(new object[]
            {
                "Adding item at id ",
                id,
                " ",
                item.displayName,
                " (",
                item.description,
                ")"
            }));
        }
        catch (Exception ex)
        {
            RConsole.Log(string.Concat(new object[]
            {
                "Failed to add item at id ",
                id,
                " and displayName ",
                item.displayName,
                ": ",
                ex.ToString()
            }));
        }
    }