Пример #1
0
    void Start()
    {
        m_listLayoutGroup = GetComponent <ListLayoutGroup> ();
        List <Color> list = new List <Color> ();

        for (int i = 0; i < dataLength; ++i)
        {
            list.Add(new Color((float)i / dataLength, (float)((i * 2) % dataLength) / dataLength, (float)((i * i) % dataLength) / dataLength));
        }
        m_listLayoutGroup.SetData(template, list, (i, p, d) => p.color = d);
    }
Пример #2
0
 // Use this for initialization
 void OnEnable()
 {
     scrollRect = GetComponent <ScrollRect> ();
     if (listLayoutGroup == null && gridLayoutGroup == null)
     {
         listLayoutGroup = GetComponentInChildren <ListLayoutGroup> ();
     }
     if (listLayoutGroup != null)
     {
         listLayoutGroup.onDragHandler = OnDrag;
     }
     else if (gridLayoutGroup == null)
     {
         gridLayoutGroup = GetComponentInChildren <GridLayoutGroup> ();
     }
     if (listLayoutGroup == null && gridLayoutGroup != null)
     {
         scrollRect.onValueChanged.RemoveListener(OnDrag);
         scrollRect.onValueChanged.AddListener(OnDrag);
     }
     UpdatePageIcon();
 }