Esempio n. 1
0
        private void UpdateList()
        {
            mNodeFoldout      = new FoldoutFolder("所有节点", SelectNodeFolderCallback);
            mNodeFoldout.Fold = true;

            BTNodeInfoComponent btNodeInfoComponent = BTEditor.Instance.GetComponent <BTNodeInfoComponent>();

            foreach (string classify in btNodeInfoComponent.GetAllClassify())
            {
                List <NodeMeta> nodeTypeList = btNodeInfoComponent.GetNodeMetas(classify);
                FoldoutFolder   folder       = mNodeFoldout.AddFolder(classify, SelectNodeFolderCallback);
                folder.Fold = true;

                mNodeCount++;
                foreach (NodeMeta nodeType in nodeTypeList)
                {
                    folder.AddNode(classify, nodeType.name + " (" + nodeType.describe + ")", SelectNodeCallback);
                    mNodeCount++;
                }
            }
        }
Esempio n. 2
0
        public List <string> GetCanRepalceList()
        {
            List <string> result = new List <string>();

            if (mSelectedNode != null)
            {
                BTNodeInfoComponent btNodeInfoComponent = BTEditor.Instance.GetComponent <BTNodeInfoComponent>();
                if (mSelectedNode.NodeData.Proto.classify == NodeClassifyType.Root.ToString() ||
                    BTEditor.Instance.CurTree.Root.Id == mSelectedNode.NodeData.Id)
                {
                    List <NodeMeta> list = btNodeInfoComponent.GetNodeMetas(NodeClassifyType.Root.ToString());
                    foreach (NodeMeta nodeType in list)
                    {
                        result.Add(nodeType.name);
                        // menu.AddItem(new GUIContent(string.Format("{0}/{1}", "替换为", nodeType.name)), false, new GenericMenu.MenuFunction2(this.ChangeNodeType), nodeType.name);
                    }
                }
                else
                {
                    // NodeChildLimitType nodeChildLimitType = mSelectedNode.NodeData.IsLeaf() ? NodeChildLimitType.All : NodeChildLimitType.WithChild;
                    List <NodeMeta> canSubtituteList = btNodeInfoComponent.AllNodeMeta;
                    canSubtituteList.Sort(CompareShowName);
                    foreach (NodeMeta nodeType in canSubtituteList)
                    {
                        if (nodeType.classify == NodeClassifyType.Root.ToString())
                        {
                            continue;
                        }
                        // menu.AddItem(new GUIContent(string.Format("{0}/{1}", "替换为", nodeType.name)), false, new GenericMenu.MenuFunction2(this.ChangeNodeType), nodeType.name);
                        if (mSelectedNode.NodeData.Proto.child_limit <= nodeType.child_limit)
                        {
                            result.Add(nodeType.name);
                        }
                    }
                }
            }
            return(result);
        }
Esempio n. 3
0
        public List <string> GetCanCreateList()
        {
            List <string> result = new List <string>();

            BTNodeInfoComponent btNodeInfoComponent = BTEditor.Instance.GetComponent <BTNodeInfoComponent>();

            foreach (string classify in btNodeInfoComponent.GetAllClassify())
            {
                List <NodeMeta> nodeProtoList = btNodeInfoComponent.GetNodeMetas(classify);
                nodeProtoList.Sort(CompareShowName);
                if (classify == NodeClassifyType.Root.ToString())
                {
                    continue;
                }
                foreach (NodeMeta node in nodeProtoList)
                {
                    if (mSelectedNode != null && mSelectedNode.NodeData.Children.Count < mSelectedNode.NodeData.Proto.child_limit)
                    {
                        result.Add(node.name);
                    }
                }
            }
            return(result);
        }