// Use this for initialization IEnumerator Start() { uiDisplay = gameObject.GetComponent <UIDisplay> (); getPage(); uiDisplay.getCountData(catName, (int count) => { if (count > 0) { //StartCoroutine (delayAddPage ()); GetComponent <Animation> ().Play("openBook"); if (count == 1) { StartCoroutine(uiDisplay.LoadBookData(bookLeftImg, bookLeftText, curPageNumber, catName, true)); } else if (count >= 2) { StartCoroutine(uiDisplay.LoadBookData(bookLeftImg, bookLeftText, curPageNumber, catName, true)); StartCoroutine(uiDisplay.LoadBookData(pageLeftImg, pageLeftText, nextPageNumber, catName, false)); } } else { bookActive.SetActive(true); StartCoroutine(delayAddPage()); } }); yield return(new WaitForSeconds(3f)); bookActive.SetActive(false); animationAvailable = true; }
public void getPage() { if (catName == "science") { curPageNumber = 230001; minPage = 230001; } else if (catName == "nature") { curPageNumber = 210001; minPage = 210001; } else if (catName == "fairytale") { curPageNumber = 220001; minPage = 220001; } else if (catName == "fiction") { curPageNumber = 240001; minPage = 240001; } nextPageNumber = curPageNumber + 1; Debug.Log("catName:== " + catName); uiDisplay.getCountData(catName, (int count) => { maxPage = minPage + count - 1; }); }