コード例 #1
0
 public void selected(Transform tran)
 {
     //触发unselected其他
     //并且设置curr
     for (int i = 0; i < gameObject.transform.childCount; i++)
     {
         Transform child = gameObject.transform.GetChild(i);
         if (child.name == tran.name)
         {
             JoystickButton btn = child.GetComponent <JoystickButton> ();
             if (btn != null)
             {
                 curr = btn.keySrc;
                 btn.selected();
             }
             JoystickRadio radio = child.GetComponent <JoystickRadio> ();
             if (radio != null)
             {
                 curr = tran.name;
                 radio.selected();
             }
         }
         else
         {
             JoystickButton btn = child.GetComponent <JoystickButton> ();
             if (btn != null)
             {
                 btn.unSelected();
             }
             JoystickRadio radio = child.GetComponent <JoystickRadio> ();
             if (radio != null)
             {
                 radio.unSelected();
             }
         }
     }
 }