Example #1
0
    protected void ChangePage(int newSelPage)
    {
        List <int> pageDictionary = BossBookManager.Instance.GetPageDictionary(newSelPage);

        if (pageDictionary == null)
        {
            return;
        }
        this.curPage = newSelPage;
        BossBookManager.Instance.CurrentUITabIndex = this.curPage - 1;
        int i;

        for (i = 0; i < pageDictionary.get_Count(); i++)
        {
            int bossId = pageDictionary.get_Item(i);
            if (this.m_ScrollLayoutLeft.get_childCount() > i)
            {
                GameObject gameObject = this.m_ScrollLayoutLeft.GetChild(i).get_gameObject();
                gameObject.SetActive(true);
                BossBookBossBtn component = gameObject.GetComponent <BossBookBossBtn>();
                if (component != null)
                {
                    component.UpdateBtn(bossId);
                    component.SetSelect(false);
                }
            }
            else
            {
                Transform transform = ResourceManager.GetInstantiate2Prefab("BossBookBossBtn").get_transform();
                transform.SetParent(this.m_ScrollLayoutLeft);
                transform.set_localScale(new Vector3(1f, 1f, 1f));
                transform.get_gameObject().SetActive(true);
                transform.GetComponent <BossBookBossBtn>().InitBtn(new ButtonCustom.VoidDelegateObj(this.OnClickBossBtn));
                BossBookBossBtn component2 = transform.GetComponent <BossBookBossBtn>();
                component2.UpdateBtn(bossId);
                component2.SetSelect(false);
            }
        }
        for (int j = i; j < this.m_ScrollLayoutLeft.get_childCount(); j++)
        {
            GameObject gameObject2 = this.m_ScrollLayoutLeft.GetChild(j).get_gameObject();
            gameObject2.SetActive(false);
        }
        int bossId2;

        if (this.lastSelBoss.get_Item(this.curPage) != 0)
        {
            bossId2 = this.lastSelBoss.get_Item(this.curPage);
        }
        else
        {
            bossId2 = pageDictionary.get_Item(0);
        }
        this.SelBoss(bossId2);
        this.UpdateFightTimes(this.curPage > 2);
    }