Exemple #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);
     });
 }
Exemple #2
0
 public virtual void Select(int realindex)
 {
     _selectedIndex = realindex;
     if (list != null && mode.gameObject.activeSelf)
     {
         list.Select(realindex);
     }
 }