예제 #1
0
    private void RefreshPage(int pageNum)
    {
        Debug.Log("Currently on page #" + pageNum);

        FoodObject food = levelList[currentPage - 1];

        FoodNameLabel.text = food.getName();
        FoodImage.sprite   = Resources.Load <Sprite>(food.getIcon());

        foreach (GameObject obj in ingredientList)
        {
            Destroy(obj);
        }
        ingredientList.Clear();

        foreach (FoodObject ing in food.getIngNeeded())
        {
            GameObject newObj = Instantiate(ingInfo, ScrollViewContent);

            ingredientList.Add(newObj);

            IngredientInfo ingredientInfo = newObj.GetComponent <IngredientInfo>();
            ingredientInfo.Setup(ing);
        }

        if (currentPage == 1)
        {
            ButtonBackPage.interactable = false;
        }
        else
        {
            ButtonBackPage.interactable = true;
        }

        if (currentPage == maxPage)
        {
            ButtonNextPage.interactable = false;
        }
        else
        {
            ButtonNextPage.interactable = true;
        }
    }