コード例 #1
0
        private void AddNode(string nodeText, string lasttext, int priority, MethodInfo method, System.Object target,
                             ConditionDelegate condition, System.Object argobj, bool hasChild)
        {
            ToolBarTreeNode node = this.m_NodeList.Find(n => n.m_Text == nodeText);

            if (hasChild)
            {
                if (node == null)
                {
                    node = new ToolBarTreeNode(nodeText, priority);
                    node.InsertNode(lasttext, method, target, condition, argobj, priority);
                    this.m_NodeList.Add(node);
                }
                else
                {
                    node.InsertNode(lasttext, method, target, condition, argobj, priority);
                }
            }
            else
            {
                if (node == null)
                {
                    node = new ToolBarTreeNode(nodeText, priority);
                    node.CombineMethod(method, target, condition, argobj);
                    this.m_NodeList.Add(node);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 点击工具栏
        /// </summary>
        /// <param name="rect"></param>
        /// <param name="node"></param>
        private void ClickDropDown(Rect rect, ToolBarTreeNode node)
        {
            if (node.m_NodeList == null || node.m_NodeList.Count == 0)
            {
                node.Invoke();
                return;
            }
            GenericMenu menu = new GenericMenu();

            for (int i = 0; i < node.m_NodeList.Count; i++)
            {
                node.m_NodeList[i].ShowDropDownMenu(menu, "", false);
            }
            menu.DropDown(rect);
        }