Ejemplo n.º 1
0
    public void AddNewCollection(LanguageTranslaterScript _animal, bool openBook =true)
    {
        gameObject.SetActive(true);
        ApplicationScript.current.animalName = _animal.jsonKey;

        currentPage = null;
        currentPageID = -1;

        foreach (GameObject go in pages)
            if (go.name.ToLower().Contains(ApplicationScript.current.animalName.ToLower()))
                currentPage = go;

        if (currentPage != null)
        {
            currentPageID = pages.IndexOf(currentPage);
            if (!knownPageIds.Contains(currentPageID))
            {
                knownPageIds.Add(currentPageID);
                mappingTable.Add(currentPageID, _animal);
                currentKnownPageID = knownPageIds.Count - 1;
                PlayerPrefs.SetInt(string.Format("{0}_{1:00}", "KnownPagesID",currentKnownPageID), currentPageID);
                if (openBook) OpenTHEBook();
            }
        }
    }
Ejemplo n.º 2
0
    public void AddNewCollection(LanguageTranslaterScript _animal, bool openBook = true)
    {
        gameObject.SetActive(true);
        ApplicationScript.current.animalName = _animal.jsonKey;

        currentPage   = null;
        currentPageID = -1;

        foreach (GameObject go in pages)
        {
            if (go.name.ToLower().Contains(ApplicationScript.current.animalName.ToLower()))
            {
                currentPage = go;
            }
        }

        if (currentPage != null)
        {
            currentPageID = pages.IndexOf(currentPage);
            if (!knownPageIds.Contains(currentPageID))
            {
                knownPageIds.Add(currentPageID);
                mappingTable.Add(currentPageID, _animal);
                currentKnownPageID = knownPageIds.Count - 1;
                PlayerPrefs.SetInt(string.Format("{0}_{1:00}", "KnownPagesID", currentKnownPageID), currentPageID);
                if (openBook)
                {
                    OpenTHEBook();
                }
            }
        }
    }