Esempio n. 1
0
 public void SetCellScrollStyle(ListView.ListViewScrollStyle scrollStyle)
 {
     if (scrollStyle == ListView.ListViewScrollStyle.Up)
     {
         RectTransform component = this.m_content.GetComponent <RectTransform>();
         component.set_anchorMin(new Vector2(0.5f, 1f));
         component.set_anchorMax(new Vector2(0.5f, 1f));
         component.set_pivot(new Vector2(0.5f, 1f));
     }
     else if (scrollStyle == ListView.ListViewScrollStyle.Down)
     {
         RectTransform component2 = this.m_content.GetComponent <RectTransform>();
         component2.set_anchorMin(new Vector2(0.5f, 0f));
         component2.set_anchorMax(new Vector2(0.5f, 0f));
         component2.set_pivot(new Vector2(0.5f, 0f));
     }
     else if (scrollStyle == ListView.ListViewScrollStyle.Left)
     {
         RectTransform component3 = this.m_content.GetComponent <RectTransform>();
         component3.set_anchorMin(new Vector2(0f, 0.5f));
         component3.set_anchorMax(new Vector2(0f, 0.5f));
         component3.set_pivot(new Vector2(0f, 0.5f));
     }
     else if (scrollStyle == ListView.ListViewScrollStyle.Right)
     {
         RectTransform component4 = this.m_content.GetComponent <RectTransform>();
         component4.set_anchorMin(new Vector2(1f, 0.5f));
         component4.set_anchorMax(new Vector2(1f, 0.5f));
         component4.set_pivot(new Vector2(1f, 0.5f));
     }
 }
Esempio n. 2
0
    private void SetScrollStyle(ListView.ListViewScrollStyle scrollStyle)
    {
        this.m_listViewScrollStyle = scrollStyle;
        if (this.m_listViewScrollStyle == ListView.ListViewScrollStyle.Up || this.m_listViewScrollStyle == ListView.ListViewScrollStyle.Down)
        {
            base.set_horizontal(false);
            base.set_vertical(true);
        }
        else
        {
            base.set_horizontal(true);
            base.set_vertical(false);
        }
        switch (this.m_listViewScrollStyle)
        {
        case ListView.ListViewScrollStyle.Up:
            this.m_contentView.GetComponent <RectTransform>().set_pivot(new Vector2(0.5f, 1f));
            break;

        case ListView.ListViewScrollStyle.Down:
            this.m_contentView.GetComponent <RectTransform>().set_pivot(new Vector2(0.5f, 0f));
            break;

        case ListView.ListViewScrollStyle.Left:
            this.m_contentView.GetComponent <RectTransform>().set_pivot(new Vector2(0f, 0.5f));
            break;

        case ListView.ListViewScrollStyle.Right:
            this.m_contentView.GetComponent <RectTransform>().set_pivot(new Vector2(1f, 0.5f));
            break;
        }
    }
Esempio n. 3
0
    public void Init(ListView.ListViewScrollStyle scrollStyle)
    {
        if (this.m_isInited)
        {
            return;
        }
        this.m_isInited = true;
        if (this.manager == null)
        {
            Debuger.Error("Init()  err : manager == null  && return", new object[0]);
            return;
        }
        this.m_contentView = new GameObject();
        this.m_contentView.set_name("ContentView");
        this.m_contentView.AddComponent <RectTransform>();
        base.set_content(this.m_contentView.GetComponent <RectTransform>());
        this.m_contentView.get_transform().SetParent(base.get_transform());
        this.m_contentView.GetComponent <RectTransform>().set_localScale(Vector3.get_one());
        this.SetScrollStyle(scrollStyle);
        Vector3 zero = Vector3.get_zero();

        if (scrollStyle == ListView.ListViewScrollStyle.Up)
        {
            zero.y = base.GetComponent <RectTransform>().get_sizeDelta().y / 2f;
        }
        else if (scrollStyle == ListView.ListViewScrollStyle.Down)
        {
            zero.y = 0f - base.GetComponent <RectTransform>().get_sizeDelta().y / 2f;
        }
        else if (scrollStyle == ListView.ListViewScrollStyle.Left)
        {
            zero.x = 0f - base.GetComponent <RectTransform>().get_sizeDelta().x / 2f;
        }
        else if (scrollStyle == ListView.ListViewScrollStyle.Right)
        {
            zero.x = base.GetComponent <RectTransform>().get_sizeDelta().x / 2f;
        }
        this.m_contentView.GetComponent <RectTransform>().set_localPosition(zero);
        Image image = this.m_contentView.AddComponent <Image>();

        image.set_enabled(false);
        base.get_gameObject().AddMissingComponent <Image>();
        Mask mask = base.get_gameObject().AddMissingComponent <Mask>();

        mask.set_showMaskGraphic(false);
    }