Пример #1
0
 void OnListItemUnselected(ComboBox.ComboItem unselectedItem)
 {
     if (selectedHost == (HostData)unselectedItem.value)
     {
         selectedHost = null;
     }
 }
Пример #2
0
 // Use this for initialization
 void Start()
 {
     cb = new ComboBox();
     style = new GUIStyle();
     foreach(Transform child in this.transform) {
         ComboBox.ComboItem childItem = new ComboBox.ComboItem(child.name, child);
         childItem.OnMarkedAction += SelectItem;
         childItem.OnUnMarkedAction += DeselectItem;
         cb.AddItem(childItem);
     }
 }
Пример #3
0
 // Use this for initialization
 void Start()
 {
     cb    = new ComboBox();
     style = new GUIStyle();
     foreach (Transform child in this.transform)
     {
         ComboBox.ComboItem childItem = new ComboBox.ComboItem(child.name, child);
         childItem.OnMarkedAction   += SelectItem;
         childItem.OnUnMarkedAction += DeselectItem;
         cb.AddItem(childItem);
     }
 }
Пример #4
0
 // Update is called once per frame
 void Update()
 {
     //Check for an updated list, and refresh the items in the list when we have one.
     if (hostsUpdated)
     {
         hostsUpdated = false;
         hostList.Clear();
         foreach (HostData hostdata in hosts)
         {
             ComboBox.ComboItem item = hostList.AddItem(hostdata.gameName, hostdata, OnListItemSelected, OnListItemUnselected);
             //Maintain our selected host, even through a wipe and refresh
             //Would want to implement a more robust comparison between selectedHost and hostdata
             if (selectedHost != null && hostdata.gameName == selectedHost.gameName && hostdata.ip[0].Equals(selectedHost.ip[0]))
             {
                 item.Mark();
                 selectedHost = hostdata;
             }
         }
     }
 }
Пример #5
0
 void OnLayerUnselected(ComboBox.ComboItem item)
 {
     layerMask = layerMask & ~(1 << (int)item.value);
 }
Пример #6
0
 void OnListItemSelected(ComboBox.ComboItem selectedItem)
 {
     selectedHost = (HostData)selectedItem.value;
 }
Пример #7
0
 void DeselectItem(ComboBox.ComboItem item)
 {
     //Move the item down so we can see it's not selected
     ((Transform)item.value).Translate(0, -1, 0);
 }
Пример #8
0
 void SelectItem(ComboBox.ComboItem item)
 {
     //Move the item up so we can see it's selected
     ((Transform)item.value).Translate(0, 1, 0);
 }