示例#1
0
 // Sets the selected recipe in the table of contents.
 public void SetSelectedRecipe(Recipe recipe)
 {
     if (currentSelectedRecipe != null)
     {
         currentSelectedRecipe.SetNotSelected();
     }
     if (!recipes[recipe].gameObject.activeSelf)
     {
         if (recipes[recipe].recipeNumber > currentSelectedRecipe.recipeNumber)
         {
             // Scroll down
             firstDisplayedRecipe++;
         }
         else
         {
             // Scroll up
             firstDisplayedRecipe--;
         }
         UpdateTableOfContentsList();
     }
     currentSelectedRecipe = recipes[recipe];
     currentSelectedRecipe.SetSelected();
 }
示例#2
0
    // Use this for initialization
    void Start()
    {
        totalRecipes = itemManager.Recipes.Count;
        int count = 0;

        foreach (Recipe recipe in itemManager.Recipes)
        {
            TableOfContentsRecipe tocRecipe = (TableOfContentsRecipe)Instantiate(tocItemPrefab);
            tocRecipe.itemManager             = itemManager;
            tocRecipe.transform.parent        = this.transform;
            tocRecipe.transform.localScale    = new Vector3(1.0f, 1.0f, 1.0f);
            tocRecipe.transform.localRotation = Quaternion.Euler(new Vector3(0.0f, 0.0f, 0.0f));
            tocRecipe.SetRecipe(recipe, count);
            tocRecipe.bookPageManager = bookPageManager;
            tocRecipe.gameObject.SetActive(false);

            recipes.Add(recipe, tocRecipe);
            tocRecipes.Add(tocRecipe);

            count++;
        }
        UpdateTableOfContentsList();
    }