Пример #1
0
    public void CreateBook(Dictionary <RecipeName, Pair <int, int> > gameRecipes, bool tutorial)
    {
        _gameRecipes = gameRecipes;

        bookController.Reset();
        int i = 0;

        bookController.pagesUi.AddDistinct(new AnimatedBookController.Page());
        AnimatedBookController.Page page = bookController.pagesUi[0];


        if (tutorial)
        {
            i = addPageInBook(i, UiIntroTutoPage);

            foreach (var uiTutoPage in UiTutoPages)
            {
                i = addPageInBook(i, uiTutoPage);
            }

            i = addPageInBook(i, UiLastEmptyPage);
        }

        i = addPageInBook(i, UiIntroRecipePage);

        foreach (var gameRecipe in _gameRecipes)
        {
            var recipeName = gameRecipe.Key.ToString();

            foreach (var uiPage in UiRecipePages)
            {
                if (uiPage.name.Contains(recipeName))
                {
                    i = addPageInBook(i, uiPage);
                    break;
                }
            }
        }

        if (i < bookController.pagesUi.Count && bookController.pagesUi[i].UiVerso == null)
        {
            addPageInBook(i, UiLastEmptyPage);
        }

        bookController.OpenBook();
    }
Пример #2
0
    int addPageInBook(int pageIndex, GameObject uiPage)
    {
        if (pageIndex >= bookController.pagesUi.Count)
        {
            bookController.pagesUi.AddDistinct(new AnimatedBookController.Page());
        }

        AnimatedBookController.Page page = bookController.pagesUi[pageIndex];

        if (page.UiRecto == null)
        {
            page.UiRecto = uiPage;
        }
        else
        {
            page.UiVerso = uiPage;
            pageIndex++;
        }

        return(pageIndex);
    }