Exemplo n.º 1
0
    public void SetNewItemDetail(baseGroceryItemSO.GROCERY_ID newItemID)
    {
        baseGroceryItemSO newItem = GroceryItemDatabase.Instance.GetGroceryItem(newItemID);

        currentItem = newItem;

        m_ItemName.text    = newItem.GetItemName();
        m_ItemPrice.text   = "$" + newItem.GetItemPrice().ToString();
        m_ItemImage.sprite = newItem.GetItemImage();

        if (!newItem.IsItemEdible())
        {
            m_ItemNutritionParent.SetActive(false);
            m_ItemDietary.gameObject.SetActive(false);
            return;
        }
        if (!newItem.IsItemHalal() && !newItem.IsItemHealthierChoice())
        {
            m_ItemDietary.gameObject.SetActive(false);
        }
        else
        {
            m_ItemDietary.SetHalal(newItem.IsItemHalal());
            m_ItemDietary.SetHealhier(newItem.IsItemHealthierChoice());
        }

        m_ItemEnergy.text       = newItem.GetNutrition_Energy().ToString() + "kcal";
        m_ItemTransfat.text     = newItem.GetNutrition_TransFat().ToString() + "g";
        m_ItemSaturatedFat.text = newItem.GetNutrition_SaturatedFat().ToString() + "g";
        m_ItemCholesterol.text  = newItem.GetNutrition_Cholesterol().ToString() + "mg";
        m_ItemSodium.text       = newItem.GetNutrition_Sodium().ToString() + "mg";
        m_ItemProtein.text      = newItem.GetNutrition_Protein().ToString() + "g";
        m_ItemCarbohydrate.text = newItem.GetNutrition_Carbohydrate().ToString() + "g";
        m_ItemDietaryFibre.text = newItem.GetNutrition_DietaryFibre().ToString() + "g";
    }