コード例 #1
0
    public virtual void Show(Vector2 vector, bool flag = false)
    {
        if (flag)
        {
            AdjustNode(vector, 1);

            if (GUI.Button(new Rect(this.m_posUp, this.m_btnSize), "", m_buttonDownStyle))
            {
                Node node = new Node();
                node.state = NodeState.In;
                node.idx   = this.m_idx;
                DataTreeEditCtr.AddNode(node);
            }
            if (GUI.Button(new Rect(this.m_posDown, this.m_btnSize), "", m_buttonDownStyle))
            {
                Node node = new Node();
                node.state = NodeState.Out;
                node.idx   = this.m_idx;
                DataTreeEditCtr.AddNode(node);
            }
        }
        this.HandleEvents();
    }
コード例 #2
0
    private void GenTankTree()
    {
        for (int i = 0; i < this.m_treeList.Count; ++i)
        {
            Queue <TreeNode> queue = this.m_treeList[i];
            int level = 0;
            while (queue.Count > 0)
            {
                List <TreeNode> nodeList = new List <TreeNode>();
                while (queue.Count > 0)
                {
                    TreeNode node = queue.Dequeue();
                    bool     flag = true;
                    for (int j = 0; j < nodeList.Count; ++j)
                    {
                        if (nodeList[j].idx == node.idx)
                        {
                            flag = false;
                            break;
                        }
                    }
                    if (flag)
                    {
                        nodeList.Add(node);
                    }
                }
                for (int j = 0; j < nodeList.Count; ++j)
                {
                    TreeNode treeNode = nodeList[j];

                    if (!this.CheckNodeUsed(treeNode.idx))
                    {
                        ConfigNodeData dataNode = new ConfigNodeData(this.GetConfigDataByIdx(treeNode.idx), new Vector2(500 + (j - (nodeList.Count - 1) / 2.0f) * 200, 300 + level * 200));
                        this.m_nodeList.Add(dataNode);
                    }

                    for (int k = 0; k < treeNode.childList.Count; ++k)
                    {
                        TreeNode tNode = new TreeNode();
                        tNode.idx = treeNode.childList[k];

                        if (this.m_nodeDic.ContainsKey(treeNode.childList[k]))
                        {
                            tNode.childList = this.m_nodeDic[treeNode.childList[k]];
                        }
                        else
                        {
                            tNode.childList = new List <int>();
                        }

                        queue.Enqueue(tNode);

                        Node inNode = new Node();
                        inNode.state = NodeState.In;
                        inNode.idx   = treeNode.childList[k];

                        Node outNode = new Node();
                        outNode.state = NodeState.Out;
                        outNode.idx   = treeNode.idx;

                        DataTreeEditCtr.AddNode(inNode);
                        DataTreeEditCtr.AddNode(outNode);
                    }
                }

                ++level;
            }
        }
    }