Exemplo n.º 1
0
    // Token: 0x06002A1B RID: 10779 RVA: 0x0046788C File Offset: 0x00465A8C
    public void GoTo(int itemidx)
    {
        if (itemidx < 0 || itemidx >= this.m_DataList.Count || this.ContentRect.sizeDelta.x <= this.m_PanelWidth)
        {
            return;
        }
        CScrollRect component = base.gameObject.GetComponent <CScrollRect>();

        if (component != null)
        {
            component.StopMovement();
        }
        this.beginIndex = itemidx;
        float num = 0f;

        if (itemidx > 0)
        {
            num = this.m_Border;
        }
        for (int i = 0; i < itemidx; i++)
        {
            num += this.m_DataList[i].m_Width + this.m_Range;
            if (num > this.m_TotalWidth - this.m_PanelWidth)
            {
                this.beginIndex = i;
                num             = this.m_TotalWidth - this.m_PanelSize.x;
                break;
            }
        }
        this.m_FirstIdx = 0;
        this.m_LastIdx  = this.m_MaxItemOfPage - 1;
        this.UpdatePanelPostion(this.m_FirstIdx);
        this.ContentRect.anchoredPosition = new Vector2(-num, 0f);
        this.MyUpdate();
    }
Exemplo n.º 2
0
    // Token: 0x06002A19 RID: 10777 RVA: 0x00467668 File Offset: 0x00465868
    public void AddNewDataHeight(List <float> _DataHeight, float newWidth, bool IsSetBeginPos = true)
    {
        this.m_TotalWidth = newWidth;
        this.m_DataList.Clear();
        this.m_TotalWidth = this.m_Border;
        for (int i = 0; i < _DataHeight.Count; i++)
        {
            ItemData_H itemData_H = new ItemData_H();
            itemData_H.m_Width     = _DataHeight[i];
            itemData_H.m_LimitLeft = this.m_TotalWidth;
            this.m_DataList.Add(itemData_H);
            this.m_TotalWidth += _DataHeight[i] + this.m_Range;
        }
        this.ContentRect.sizeDelta = new Vector2(this.m_TotalWidth, 0f);
        if (IsSetBeginPos)
        {
            this.ContentRect.anchoredPosition = new Vector2(0f, 0f);
            this.beginIndex = 0;
            this.m_FirstIdx = 0;
            this.m_LastIdx  = 0;
        }
        this.UpdatePanelPostion(this.m_FirstIdx);
        this.MyUpdate();
        CScrollRect component = base.gameObject.GetComponent <CScrollRect>();

        if (component != null)
        {
            component.StopMovement();
        }
    }
Exemplo n.º 3
0
    // Token: 0x060029FB RID: 10747 RVA: 0x004661A4 File Offset: 0x004643A4
    public void AddNewDataHeight(List <float> _DataHeight, float newHeight, bool IsSetBeginPos = true)
    {
        this.m_PanelHeight = newHeight;
        this.m_DataList.Clear();
        this.m_TotalHeight = this.m_Border;
        for (int i = 0; i < _DataHeight.Count; i++)
        {
            ItemData itemData = new ItemData();
            itemData.m_Height   = _DataHeight[i];
            itemData.m_limitTop = this.m_TotalHeight;
            this.m_DataList.Add(itemData);
            this.m_TotalHeight += _DataHeight[i] + this.m_Range;
        }
        this.ContentRect.sizeDelta = new Vector2(0f, this.m_TotalHeight);
        if (IsSetBeginPos)
        {
            this.ContentRect.anchoredPosition = new Vector2(0f, 0f);
            this.beginIndex = 0;
            this.m_FirstIdx = 0;
            this.m_LastIdx  = 0;
        }
        int num = this.m_FirstIdx;

        for (int j = 0; j < this.m_MaxItemOfPage; j++)
        {
            if (this.m_handler != null)
            {
                if (this.beginIndex + j < _DataHeight.Count)
                {
                    Vector2 a = new Vector2(0f, this.m_DataList[this.beginIndex + j].m_limitTop);
                    this.m_PanelObjects[num].rectTransform.anchoredPosition = -a;
                    this.m_PanelObjects[num].rectTransform.sizeDelta        = new Vector2(this.m_PanelObjects[num].rectTransform.sizeDelta.x, _DataHeight[this.beginIndex + j]);
                    this.m_PanelObjects[num].gameObject.GetComponent <ScrollPanelItem>().m_BtnID1 = this.beginIndex + j;
                    this.m_handler.UpDateRowItem(this.m_PanelObjects[num].gameObject, this.beginIndex + j, num, this.m_ScrollPanelID);
                }
                else
                {
                    Vector2 anchoredPosition = new Vector2(0f, this.ContentRect.anchoredPosition.y + this.m_PanelObjects[num].rectTransform.sizeDelta.y + this.m_Range);
                    this.m_PanelObjects[num].rectTransform.anchoredPosition = anchoredPosition;
                    this.m_PanelObjects[num].gameObject.GetComponent <ScrollPanelItem>().m_BtnID1 = -1;
                }
                num++;
                if (num >= this.m_MaxItemOfPage)
                {
                    num = 0;
                }
            }
        }
        this.MyUpdate();
        CScrollRect component = base.gameObject.GetComponent <CScrollRect>();

        if (component != null)
        {
            component.StopMovement();
        }
    }
Exemplo n.º 4
0
    // Token: 0x060029FD RID: 10749 RVA: 0x004666E0 File Offset: 0x004648E0
    public void GoTo(int itemidx, float height)
    {
        if (itemidx < 0 || itemidx >= this.m_DataList.Count || this.ContentRect.sizeDelta.y <= this.m_PanelHeight)
        {
            return;
        }
        CScrollRect component = base.gameObject.GetComponent <CScrollRect>();

        if (component != null)
        {
            component.StopMovement();
        }
        this.beginIndex = itemidx;
        float num = 0f;

        if (itemidx > 0)
        {
            num = this.m_Border;
        }
        for (int i = 0; i < itemidx; i++)
        {
            num += this.m_DataList[i].m_Height + this.m_Range;
            if (num > this.m_TotalHeight - this.m_PanelHeight)
            {
                this.beginIndex = i;
                num             = this.m_TotalHeight - this.m_PanelSize.y;
                break;
            }
        }
        int num2 = 0;

        this.m_FirstIdx = 0;
        this.m_LastIdx  = this.m_MaxItemOfPage - 1;
        int num3 = 0;

        while (num3 < this.m_MaxItemOfPage && num3 < this.m_DataList.Count)
        {
            if (this.m_handler != null && this.beginIndex + num3 < this.m_DataList.Count)
            {
                this.m_PanelObjects[num2].rectTransform.sizeDelta = new Vector2(this.m_PanelObjects[num2].rectTransform.sizeDelta.x, this.m_DataList[this.beginIndex + num3].m_Height);
                Vector2 a = new Vector2(0f, this.m_DataList[this.beginIndex + num3].m_limitTop);
                this.m_PanelObjects[num2].rectTransform.anchoredPosition = -a;
                this.m_PanelObjects[num2].gameObject.GetComponent <ScrollPanelItem>().m_BtnID1 = this.beginIndex + num3;
                this.m_handler.UpDateRowItem(this.m_PanelObjects[num2].gameObject, this.beginIndex + num3, num2, this.m_ScrollPanelID);
            }
            else
            {
                Vector2 anchoredPosition = new Vector2(0f, this.ContentRect.anchoredPosition.y + this.m_PanelObjects[num2].rectTransform.sizeDelta.y + this.m_Range);
                this.m_PanelObjects[num2].rectTransform.anchoredPosition = anchoredPosition;
                this.m_PanelObjects[num2].gameObject.GetComponent <ScrollPanelItem>().m_BtnID1 = -1;
            }
            num2++;
            if (num2 >= this.m_MaxItemOfPage)
            {
                num2 = 0;
            }
            num3++;
        }
        this.ContentRect.anchoredPosition = new Vector2(0f, height);
        this.MyUpdate();
    }