Пример #1
0
    public void CraftSlotted(Ingredient i, InventorySlot iS, InventoryDragDrop iDD)
    {
        if (iS == craftSlot1)
        {
            craftIngredient1 = i;
            craftDD1         = iDD;
        }
        else if (iS == craftSlot2)
        {
            craftIngredient2 = i;
            craftDD2         = iDD;
        }
        if (craftIngredient1 != null && craftIngredient2 != null)
        {
            string craftId = ingredientManager.FindComboID(craftIngredient1.ingredientID, craftIngredient2.ingredientID);
            //print("CraftID: " + craftId);
            if (!craftId.Equals(""))
            {
                //print("cancrafttrue");
                canCraft   = true;
                craftIndex = 0;

                foreach (KeyValuePair <string, Ingredient> entry in ingredientManager.potionList)
                {
                    if (craftId == entry.Key)
                    {
                        break;
                    }

                    craftIndex++;
                }
                //print("changeproductslot");
                invPotionDragDrop[craftIndex].SetActive(true);
                productSlot.GetComponent <Image>().sprite = invPotionDragDrop[craftIndex].GetComponent <IngredientDisplay>().ingredient.sprite;
                if (isOnMatTab)
                {
                    invPotionDragDrop[craftIndex].SetActive(false);
                }
            }
            //print("cancraftfalse");
        }
        else
        {
            canCraft = false;
        }
    }
Пример #2
0
 public void CraftUnslotted(InventoryDragDrop iS)
 {
     if (iS.currSlot == craftSlot1)
     {
         print("craft1 unslotted");
         craftIngredient1 = null;
         productSlot.GetComponent <Image>().sprite = productSlotDefault;
         craftIndex = -1;
         CraftSlotted(null, null, null);
     }
     else if (iS.currSlot == craftSlot2)
     {
         print("craft2 unslotted");
         craftIngredient2 = null;
         productSlot.GetComponent <Image>().sprite = productSlotDefault;
         craftIndex = -1;
         CraftSlotted(null, null, null);
     }
 }