示例#1
0
文件: Tools.cs 项目: baozidai/KSP_zh
        public Node(GameObject go, Transform[] mbs)
        {
            visable = true;
            Ext = false;

            gameObject = go;
            name = go.name;
            tag = go.tag;

            /************/
            var scripts = go.GetComponents<MonoBehaviour>();
            if (scripts.Length > 0)
            {
                HasScript = true;

                foreach (var item in scripts)
                {
                    Script += item.GetType().Name + ",";
                }
                Script.TrimEnd(',');
            }
            oneTitle = string.Format("{2}{1}-{0}({3})", go.name, go.active == true ? "O" : "X", HasScript == true ? ">" : "", Script);
            /*-----------*/

            sort = nodeSort;
            nodeSort += 1;

            Nodes = new List<Node>();

            foreach (var mb in mbs)
            {
                if (mb.parent != go.transform) continue;
                var node = new Node(mb.gameObject, mbs);
                node.Parent = this;
                Nodes.Add(node);
            }
        }
示例#2
0
文件: Tools.cs 项目: baozidai/KSP_zh
 public void SetP(Node node)
 {
     //设置当前标签和母标签
     node.IsFind = true;
     var p = node.Parent;
     while (p != null)
     {
         p.Ext = true;
         p.visable = true;
         p.IsFind = false;
         p = p.Parent;
     }
 }
示例#3
0
文件: Tools.cs 项目: baozidai/KSP_zh
        public void GUINode(Node node, int level)
        {
            if (node.visable == true)/************/
            {
                var ext = node.GetExt();
                if (ext != "")
                {
                    if (GUI.Button(new Rect(level * 20, nSort * 20, 20, 20), ext))
                    {
                        node.Ext = !node.Ext;
                    }
                }

                GUI.TextField(new Rect(20 + level * 20, nSort * 20, 380 - level * 20, 20), node.GetTitle());
                if (node.gameObject != null)
                {
                    if (GUI.Button(new Rect(400, nSort * 20, 40, 20), "显/藏"))
                    {
                        node.gameObject.SetActive(!node.gameObject.active);
                    }
                    else if (GUI.Button(new Rect(440, nSort * 20, 30, 20), "详"))
                    {
                        SObject = node.gameObject;
                        Components = node.gameObject.GetComponents<Component>().ToList();
                    }
                }
                nSort += 1;//增加一位
            }

            if (node.Ext == true)
            {
                foreach (var item in node.Nodes)
                {
                    GUINode(item, level + 1);
                }
            }
        }
示例#4
0
文件: Tools.cs 项目: baozidai/KSP_zh
        public void fTextMeshNode(Node node)
        {
            if (node.gameObject != null)
            {
                var textMesh = node.gameObject.GetComponent<TextMesh>();
                if (textMesh != null)
                {
                    node.visable = textMesh.text.ToLower().Contains(findText.ToLower());
                    if (node.visable == true) SetP(node);
                }
                else
                {
                    node.visable = false;
                }
            }
            else
            {
                node.visable = false;
            }

            foreach (var item in node.Nodes)
            {
                fTextMeshNode(item);
            }
        }
示例#5
0
文件: Tools.cs 项目: baozidai/KSP_zh
        /**********/
        public void fNameNode(Node node)
        {
            if (node.gameObject != null)
            {
                node.visable = node.gameObject.name.ToLower().Contains(findText.ToLower());
                if (node.visable == true) SetP(node);
            }
            else
            {
                node.visable = false;
            }

            foreach (var item in node.Nodes)
            {
                fNameNode(item);
            }
        }
示例#6
0
文件: Tools.cs 项目: baozidai/KSP_zh
 public void fAllNode(Node node)
 {
     //显示全部
     node.visable = true;
     foreach (var item in node.Nodes)
     {
         fAllNode(item);
     }
 }