示例#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();
    }
示例#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();
        }
    }
示例#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();
        }
    }
示例#4
0
    // Token: 0x06002A26 RID: 10790 RVA: 0x004681AC File Offset: 0x004663AC
    private GameObject CreateContent(CScrollRect rect, out RectTransform _ContentRect, float _TotalWidth)
    {
        GameObject gameObject = new GameObject();

        gameObject.name        = "Content";
        _ContentRect           = gameObject.AddComponent <RectTransform>();
        _ContentRect.anchorMax = new Vector2(0f, 1f);
        _ContentRect.anchorMin = new Vector2(0f, 1f);
        _ContentRect.pivot     = new Vector2(0f, 1f);
        _ContentRect.sizeDelta = new Vector2(_TotalWidth, 0f);
        rect.content           = _ContentRect;
        _ContentRect.transform.SetParent(base.gameObject.transform, false);
        return(gameObject);
    }
示例#5
0
    // Token: 0x06002A25 RID: 10789 RVA: 0x00468140 File Offset: 0x00466340
    private CScrollRect CreateCScrollRect()
    {
        CScrollRect cscrollRect = base.gameObject.AddComponent <CScrollRect>();

        cscrollRect.m_Handler         = this;
        cscrollRect.horizontal        = true;
        cscrollRect.vertical          = false;
        cscrollRect.inertia           = true;
        cscrollRect.decelerationRate  = 0.35f;
        cscrollRect.scrollSensitivity = 1f;
        Mask mask = base.gameObject.AddComponent <Mask>();

        mask.enabled         = true;
        mask.showMaskGraphic = false;
        return(cscrollRect);
    }
示例#6
0
    // Token: 0x06002A14 RID: 10772 RVA: 0x00467254 File Offset: 0x00465454
    public void IntiScrollPanel(float _PanelWidth, float _Border, float _Range, List <float> _DataHeight, int _PanelObjectsCount, IUpDateScrollPanel _handler)
    {
        this.m_PanelWidth    = _PanelWidth;
        this.m_Border        = _Border;
        this.m_Range         = _Range;
        this.m_MaxItemOfPage = _PanelObjectsCount;
        this.m_handler       = _handler;
        this.m_TotalWidth    = this.GetTotalWidth(_DataHeight, _Border, _Range);
        CScrollRect rect = this.CreateCScrollRect();

        this.m_Content = this.CreateContent(rect, out this.ContentRect, this.m_TotalWidth);
        RectTransform component = base.gameObject.GetComponent <RectTransform>();

        this.m_PanelSize = component.rect.size;
        this.CreatePanelObjects(out this.m_PanelObjects, this.m_MaxItemOfPage);
        this.UpdatePanelPostion(this.m_FirstIdx);
        if (this.m_customItem)
        {
            this.m_customItem.SetActive(false);
        }
        this.MyUpdate();
    }
示例#7
0
    // Token: 0x060029F5 RID: 10741 RVA: 0x00465730 File Offset: 0x00463930
    public void IntiScrollPanel(float _PanelHeight, float _Border, float _Range, List <float> _DataHeight, int _PanelObjectsCount, IUpDateScrollPanel _handler)
    {
        this.m_PanelHeight   = _PanelHeight;
        this.m_Border        = _Border;
        this.m_Range         = _Range;
        this.m_MaxItemOfPage = _PanelObjectsCount;
        this.m_handler       = _handler;
        this.m_TotalHeight   = this.m_Border;
        this.m_DataList      = new List <ItemData>(_DataHeight.Count);
        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;
        }
        if (this.m_DataList.Count > this.beginIndex)
        {
            this.viewheight += this.m_DataList[this.beginIndex].m_Height + this.m_Range;
        }
        CScrollRect cscrollRect = base.gameObject.AddComponent <CScrollRect>();

        cscrollRect.m_Handler         = this;
        cscrollRect.horizontal        = false;
        cscrollRect.vertical          = true;
        cscrollRect.inertia           = true;
        cscrollRect.decelerationRate  = 0.35f;
        cscrollRect.scrollSensitivity = 1f;
        Mask mask = base.gameObject.AddComponent <Mask>();

        mask.enabled         = true;
        mask.showMaskGraphic = false;
        RectTransform component = base.gameObject.GetComponent <RectTransform>();

        this.m_PanelSize           = component.rect.size;
        this.m_Content             = new GameObject();
        this.m_Content.name        = "Content";
        this.ContentRect           = this.m_Content.AddComponent <RectTransform>();
        this.ContentRect.anchorMax = new Vector2(0f, 1f);
        this.ContentRect.anchorMin = new Vector2(0f, 1f);
        this.ContentRect.pivot     = new Vector2(0f, 1f);
        this.ContentRect.sizeDelta = new Vector2(0f, this.m_TotalHeight);
        cscrollRect.content        = this.ContentRect;
        this.m_Content.transform.SetParent(base.gameObject.transform, false);
        this.m_PanelObjects = new PanelObject[this.m_MaxItemOfPage];
        for (int j = 0; j < this.m_MaxItemOfPage; j++)
        {
            Vector2 pos = new Vector2(0f, -this.m_Border);
            this.m_PanelObjects[j] = this.AddContentObj(-1, this.m_customItem, pos, 0f, this.m_Content);
            this.m_LastIdx         = j;
        }
        int num  = this.m_FirstIdx;
        int num2 = 0;

        while (num2 < this.m_MaxItemOfPage && num2 < this.m_DataList.Count)
        {
            if (this.m_handler != null && this.beginIndex + num2 < this.m_DataList.Count)
            {
                this.m_PanelObjects[num].rectTransform.sizeDelta = new Vector2(this.m_PanelObjects[num].rectTransform.sizeDelta.x, this.m_DataList[this.beginIndex + num2].m_Height);
                Vector2 a = new Vector2(0f, this.m_DataList[this.beginIndex + num2].m_limitTop);
                this.m_PanelObjects[num].rectTransform.anchoredPosition = -a;
                this.m_PanelObjects[num].gameObject.GetComponent <ScrollPanelItem>().m_BtnID1 = this.beginIndex + num2;
                this.m_handler.UpDateRowItem(this.m_PanelObjects[num].gameObject, this.beginIndex + num2, num, this.m_ScrollPanelID);
                num++;
                if (num >= this.m_MaxItemOfPage)
                {
                    num = 0;
                }
            }
            num2++;
        }
        if (this.m_customItem)
        {
            this.m_customItem.SetActive(false);
        }
        this.MyUpdate();
    }
示例#8
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();
    }
示例#9
0
 // Token: 0x060029E8 RID: 10728 RVA: 0x00465554 File Offset: 0x00463754
 public CSCrollReserve(CScrollRect scrollRect)
 {
     this.cscrollRect = scrollRect;
 }
示例#10
0
    // Token: 0x06002A2D RID: 10797 RVA: 0x00468AA0 File Offset: 0x00466CA0
    public void InitScrollView(ScrollViewIndexValue _value, bool _bIsBatch, float posY = 0f, float[] _itemPosArray = null, float _contentHeight = 0f, int[] _idArray = null)
    {
        this.preContentPosY = posY;
        this.bIsBatch       = _bIsBatch;
        CScrollRect cscrollRect = base.gameObject.AddComponent <CScrollRect>();

        cscrollRect.m_Handler         = this;
        cscrollRect.horizontal        = !this.bVertical;
        cscrollRect.vertical          = this.bVertical;
        cscrollRect.inertia           = true;
        cscrollRect.decelerationRate  = 0.35f;
        cscrollRect.scrollSensitivity = 1f;
        this.mask                 = base.gameObject.AddComponent <Mask>();
        this.mask.enabled         = true;
        this.mask.showMaskGraphic = false;
        this.rt             = base.gameObject.GetComponent <RectTransform>();
        this.Content        = new GameObject();
        this.Content.name   = "Content";
        this.rt             = this.Content.AddComponent <RectTransform>();
        cscrollRect.content = this.rt;
        this.Content.transform.SetParent(base.gameObject.transform, false);
        this.posV2.x = 0f;
        this.posV2.y = this.preContentPosY;
        if (this.bVertical)
        {
            this.tempV2.y = (float)(this.countY + 2) * (this.btnSzieY + this.rangeSzieY) + this.rangeSzieY;
        }
        else
        {
            this.tempV2.x = (float)(this.countX + 1) * (this.btnSzieX + this.rangeSzieX) + this.rangeSzieX;
        }
        if (this.preContentPosY > 0f)
        {
            this.tempV2.y = _contentHeight;
        }
        this.SetPos(this.rt, this.tempV2, this.posV2);
        this.itemPosArray = _itemPosArray;
        this.idArray      = _idArray;
        this.scrollValue  = _value;
        if (this.bIsBatch)
        {
            if (this.bVertical)
            {
                this.gameObjectLink = new ItemObject[this.countX * (this.countY + 2)];
                this.resGameObjs    = new GameObject[this.countX];
                this.btnIndexs      = new int[this.countX];
                for (int i = 0; i < this.countY + 2; i++)
                {
                    this.posV2.x = this.borderX;
                    this.posV2.y = -this.borderY - (float)i * (this.btnSzieY + this.rangeSzieY);
                    for (int j = 0; j < this.countX; j++)
                    {
                        this.posV2.x = this.borderX + (float)j * (this.btnSzieX + this.rangeSzieX);
                        int        num        = j + this.countX * i;
                        ItemObject itemObject = this.AddContentObj(this.posV2, num, this.customItem);
                        this.gameObjectLink[this.tempGameObjectLinkIndex] = itemObject;
                        this.resGameObjs[j] = itemObject.gameObject;
                        this.btnIndexs[j]   = num;
                        this.tempGameObjectLinkIndex++;
                    }
                    if (this.handler != null)
                    {
                        this.handler.UpDateRowItem(this.resGameObjs, this.btnIndexs);
                    }
                }
                this.endIndex = this.tempGameObjectLinkIndex - 1;
                this.showSize = base.gameObject.GetComponent <RectTransform>().sizeDelta.y;
            }
            else
            {
                this.gameObjectLink = new ItemObject[(this.countX + 2) * this.countY];
                this.resGameObjs    = new GameObject[this.countY];
                this.btnIndexs      = new int[this.countY];
                if (this.Arrangement == ScrollView.e_Arrangement.LeftToRight)
                {
                    for (int k = 0; k < this.countX + 2; k++)
                    {
                        this.posV2.x = this.borderX + (float)k * (this.btnSzieX + this.rangeSzieX);
                        this.posV2.y = -this.borderY;
                        for (int l = 0; l < this.countY; l++)
                        {
                            this.posV2.y = -this.borderY - (float)l * (this.btnSzieY + this.rangeSzieY);
                            int        num         = l + this.countY * k;
                            ItemObject itemObject2 = this.AddContentObj(this.posV2, num, this.customItem);
                            this.gameObjectLink[this.tempGameObjectLinkIndex] = itemObject2;
                            this.resGameObjs[l] = itemObject2.gameObject;
                            this.btnIndexs[l]   = num;
                            this.tempGameObjectLinkIndex++;
                        }
                        if (this.handler != null)
                        {
                            this.handler.UpDateRowItem(this.resGameObjs, this.btnIndexs);
                        }
                    }
                    this.endIndex = this.tempGameObjectLinkIndex - 1;
                    this.showSize = base.gameObject.GetComponent <RectTransform>().sizeDelta.x;
                }
            }
            this.initState = ScrollView.e_InitState.e_end;
            this.customItem.SetActive(false);
            this.SetContentSize(1);
            this.UpdateScrollRect();
        }
    }
示例#11
0
 // Token: 0x060029E2 RID: 10722 RVA: 0x0046552C File Offset: 0x0046372C
 public void SetEvnetObj(CScrollRect Obj)
 {
     this.ReceiveObj = new CSCrollReserve(Obj);
 }