public DropDownMenuItem AddSingleItem(string itemDesc) { DropDownMenuItem newItem = AddItemObj(itemDesc); ResizeMenu(); return(newItem); }
private DropDownMenuItem AddItemObj(string itemDesc) { DropDownMenuItem newItem = m_compItemTemplate.Copy(); newItem.text = itemDesc; newItem.AddOnItemSelectedCallback(OnItemSelected); return(newItem); }
private void OnItemSelected(DropDownMenuItem item) { if (m_txtSelectedItem != null) { m_txtSelectedItem.text = item.text; } OnHideMenu(null); if (onItemSelected != null) { onItemSelected.Invoke(item.gameObject); } }
public DropDownMenuItem Copy(ScrollRect scrollRect = null) { GameObject newItemObj = GameObject.Instantiate(gameObject) as GameObject; newItemObj.transform.SetParent(gameObject.transform.parent, false); newItemObj.SetActive(true); DropDownMenuItem newItemComp = newItemObj.GetComponent <DropDownMenuItem>(); UGUIEventHandler.AddListener(newItemComp.ItemText.gameObject, UGUIEventType.POINTER_CLICK, newItemComp.OnItemSelected); if (scrollRect != null) { } return(newItemComp); }
private void OnItemSelected(DropDownMenuItem item) { if (m_txtSelectedItem != null) m_txtSelectedItem.text = item.text; OnHideMenu(null); if (onItemSelected != null) onItemSelected.Invoke(item.gameObject); }
public override void OnInspectorGUI() { DropDownMenuItem item = (DropDownMenuItem)target; item.ItemText = EditorGUILayout.ObjectField("Item Desc", item.ItemText, typeof(Text), true) as Text; }