Example #1
0
 // Use this for initialization
 void Start()
 {
     list = gameObject.GetComponent <UIList>();
     left.onClick.AddListener(() => {
         int step = -1;
         if (list != null)
         {
             int selectedIndex = list.selectedIndex;
             if (selectedIndex + step >= 0)
             {
                 list.Select(selectedIndex + step);
                 step = list.selectedIndex - selectedIndex;
             }
         }
         Step(step);
     });
     right.onClick.AddListener(() => {
         int step = 1;
         if (list != null)
         {
             int selectedIndex = list.selectedIndex;
             list.Select(selectedIndex + step);
             step = list.selectedIndex - selectedIndex;
         }
         Step(step);
     });
 }