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

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

            newItem.text = itemDesc;
            newItem.AddOnItemSelectedCallback(OnItemSelected);
            return(newItem);
        }
예제 #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);
        }
예제 #5
0
 private void OnItemSelected(DropDownMenuItem item)
 {
     if (m_txtSelectedItem != null)
         m_txtSelectedItem.text = item.text;
     OnHideMenu(null);
     if (onItemSelected != null)
         onItemSelected.Invoke(item.gameObject);
 }
예제 #6
0
        public override void OnInspectorGUI()
        {
            DropDownMenuItem item = (DropDownMenuItem)target;

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