protected void InitGraph()
 {
     if (rootItem != null)
     {
         GameObject.Destroy(rootItem.gameObject);
     }
     rootItem = GetInstenceItem(0, content);
     rootItem.SetAsRoot(selector, GetInstenceItem);
 }
Esempio n. 2
0
 private void SetAsChildItem(GraphNodeBehaiver instence)
 {
     if (instence != null)
     {
         instence.deepth      = deepth + 1;
         instence.GetInstence = GetInstence;
         Content.gameObject.SetActive(true);
     }
 }
 protected GraphNodeBehaiver GetInstenceItem(int deepth, Transform parent)
 {
     if (deepth < 7)
     {
         GraphNodeBehaiver horizontal = Object.Instantiate(m_nodePrefab, parent, false);
         horizontal.gameObject.SetActive(true);
         return(horizontal);
     }
     else
     {
         return(null);
     }
 }
        protected void SaveComplic(GraphNodeBehaiver nodeBehaiver, SelectorData parent)
        {
            //保存信息
            parent.info        = nodeBehaiver.Info;
            parent.description = nodeBehaiver.Description;

            for (int i = 0; i < nodeBehaiver.Content.childCount; i++)
            {
                var item = nodeBehaiver.Content.GetChild(i).GetComponent <GraphNodeBehaiver>();

                if (item == null)
                {
                    continue;
                }

                SelectorData data = parent.InsetChild();

                if (item.Content.childCount != 0 && data != null)
                {
                    SaveComplic(item, data);
                }
            }
        }