private void DragLogic()
    {
        if (this.m_configNodeData != null && this.m_configNodeData.IsDrag)
        {
            this.m_configNodeData.IsDrag = false;

            if (this.m_configNodeData.IsPreview)
            {
                this.m_configNodeData.Pos = this.mPos;
            }
            else
            {
                ConfigNodeData data = new ConfigNodeData(this.m_configNodeData.configData, this.m_configNodeData.Pos);
                this.m_nodeList.Add(data);
                this.m_idx            = -1;
                this.m_configNodeData = null;
            }
        }
        else
        {
            for (int i = 0; i < this.m_nodeList.Count; ++i)
            {
                if (this.m_nodeList[i].IsDrag)
                {
                    this.m_nodeList[i].IsDrag = false;
                    break;
                }
            }
        }
    }
    private void ClearEditTreeData()
    {
        this.m_idx            = -1;
        this.m_configNodeData = null;

        for (int i = this.m_nodeList.Count - 1; i >= 0; --i)
        {
            DataTreeEditCtr.RemoveLineByNode(this.m_nodeList[i].Idx);
            this.m_nodeList.Remove(this.m_nodeList[i]);
        }
        DataTreeEditCtr.ClearAllData();
    }
 internal ConfigNode(ISharedCore core, ConfigNodeData data)
 {
     this.core = core;
     this.data = data;
 }
Esempio n. 4
0
 internal ConfigNode(ConfigNodeData data)
 {
     this.data = data;
 }
    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;
            }
        }
    }
    private void Draw()
    {
        GUILayout.BeginHorizontal();

        GUILayout.BeginVertical(GUILayout.Height(1000), GUILayout.Width(300));

        if (GUILayout.Button("清空编辑树数据"))
        {
            this.ClearEditTreeData();
        }

        if (GUILayout.Button("导出编辑树数据"))
        {
            this.ExportToFile();
        }

        GUILayout.Label("条件筛选:");
        for (int i = 0; i < this.m_conList.Count; ++i)
        {
            if (this.m_selectKey == this.m_conList[i])
            {
                this.m_conDic[m_conList[i]] = true;
            }
            else
            {
                this.m_conDic[m_conList[i]] = false;
            }
            this.m_conDic[this.m_conList[i]] = GUILayout.Toggle(this.m_conDic[this.m_conList[i]], this.m_conList[i].ToString());
            if (this.m_conDic[m_conList[i]])
            {
                this.m_selectKey = this.m_conList[i];
            }
        }

        GUILayout.Label("可选择节点数据:");
        this.m_dataScrollPosition = GUILayout.BeginScrollView(this.m_dataScrollPosition, GUILayout.Height(720), GUILayout.Width(300));
        for (int i = 0; i < this.m_configDataList.Count; ++i)
        {
            if (!this.CheckNodeUsed(this.m_configDataList[i].GetconfigDataID()) && (this.m_selectKey == -1 || this.m_configDataList[i].GetconfigDataCondition() == this.m_selectKey))
            {
                if (GUILayout.Button(this.m_configDataList[i].GetconfigDataName()))
                {
                    this.m_idx = i;
                }
            }
        }
        GUILayout.EndScrollView();

        GUI.DrawTexture(new Rect(0, 850, 290, 150), Resources.Load("EditorRes/backgroud") as Texture);

        GUILayout.EndVertical();

        this.DrawGraphArea();

        GUILayout.EndHorizontal();

        if (this.m_idx != -1)
        {
            if (this.m_configNodeData == null)
            {
                this.m_configNodeData = new ConfigNodeData(this.m_configDataList[m_idx], this.mPos, true);
            }
            else
            {
                this.m_configNodeData.configData = this.m_configDataList[m_idx];
            }
            this.m_configNodeData.Show(this.m_configNodeData.Pos);
        }
    }