Exemple #1
0
    ////////////////
    private void UpdateIngredientsView()
    {
        MaterialData ingredient1 = GameDataStorage.Instance.GetMaterialByName(m_CurrentRecipe.Ingredient1);
        MaterialData ingredient2 = GameDataStorage.Instance.GetMaterialByName(m_CurrentRecipe.Ingredient2);

        // если у рецепта 2 ингредиента, то показываем вторую ячейку
        if (ingredient2 != null)
        {
            m_Ingredient2Icon.gameObject.SetActive(true);
            m_Ingredient2Amount.gameObject.SetActive(true);

            m_Ingredient2Icon.overrideSprite = ingredient2.GetIcon();

            string ingredient2text = string.Format("{0} / {1}", InventoryContent.Instance.GetMaterialAmount(ingredient2), m_CurrentRecipe.Ingredient2Amount);
            m_Ingredient2Amount.text = ingredient2text;
        }
        else
        {
            m_Ingredient2Icon.gameObject.SetActive(false);
            m_Ingredient2Amount.gameObject.SetActive(false);
        }

        m_Ingredient1Icon.overrideSprite = ingredient1.GetIcon();

        string ingredient1text = string.Format("{0} / {1}", InventoryContent.Instance.GetMaterialAmount(ingredient1), m_CurrentRecipe.Ingredient1Amount);

        m_Ingredient1Amount.text = ingredient1text;
    }
Exemple #2
0
    ///////////////
    public void Init(CraftingData data)
    {
        m_Recipe = data;

        if (m_Recipe.CraftItemType == ItemType.equipment)
        {
            EquipmentItem item = GameDataStorage.Instance.GetEquipmentByName(m_Recipe.CraftItemName);

            m_Icon.overrideSprite = item.GetIcon();
        }
        else
        {
            MaterialData item = GameDataStorage.Instance.GetMaterialByName(m_Recipe.CraftItemName);

            m_Icon.overrideSprite = item.GetIcon();
        }
    }