Ejemplo n.º 1
0
    public GameObject FindClosestPage()
    {
        Page       currPage           = PageEventsManager.currentPage;
        int        currPageIndex      = currPage.transform.GetSiblingIndex();
        GameObject closestEarlierPage = null;

        for (int i = 0; i < transform.childCount; i++)
        {
            GoToChapterDirectly goToChapterDirectly = transform.GetChild(i).GetComponent <GoToChapterDirectly>();
            if (SceneManager.GetActiveScene().name == goToChapterDirectly.SceneName && goToChapterDirectly.SceneName != "")
            {
                GameObject thisPage      = GameObject.Find(goToChapterDirectly.PageName);
                int        thisPageIndex = thisPage.transform.GetSiblingIndex();
                //Page's in the menu selection will need to be linear, so we get assume that the currecnt thisPageIndex is greater then the last one
                if (thisPageIndex <= currPageIndex)
                {
                    closestEarlierPage = goToChapterDirectly.gameObject;
                    Debug.Log("closestEarlierPage", closestEarlierPage);
                }
                else
                {
                    break;
                }
            }
        }
        Debug.Log("Fianl:", closestEarlierPage);
        return(closestEarlierPage);
    }
Ejemplo n.º 2
0
    public GameObject FindClosestPage()
    {
        GameObject closestEarlierPage = null;
        string     lastSceneName      = EpicPrefs.GetString("LastSceneName", true);

        if (lastSceneName != "")
        {
            for (int i = 0; i < transform.childCount; i++)
            {
                GoToChapterDirectly goToChapterDirectly = transform.GetChild(i).GetComponent <GoToChapterDirectly> ();
                if (lastSceneName == goToChapterDirectly.SceneName)
                {
                    closestEarlierPage = goToChapterDirectly.gameObject;
                    break;
                }
            }
        }
        Debug.Log("FindClosestPage: ", closestEarlierPage);
        return(closestEarlierPage);
    }