Exemple #1
0
        public DropDownMenuItem AddSingleItem(string itemDesc)
        {
            DropDownMenuItem newItem = AddItemObj(itemDesc);

            ResizeMenu();
            return(newItem);
        }
Exemple #2
0
        private DropDownMenuItem AddItemObj(string itemDesc)
        {
            DropDownMenuItem newItem = m_compItemTemplate.Copy();

            newItem.text = itemDesc;
            newItem.AddOnItemSelectedCallback(OnItemSelected);
            return(newItem);
        }
Exemple #3
0
 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);
 }
Exemple #6
0
        public override void OnInspectorGUI()
        {
            DropDownMenuItem item = (DropDownMenuItem)target;

            item.ItemText = EditorGUILayout.ObjectField("Item Desc", item.ItemText, typeof(Text), true) as Text;
        }