protected override void OnMessageReceive(object data)
 {
     selector = data as SelectorData;
     if (selector == null)
     {
         selector = new SelectorDataRoot();
     }
     InitGraph();
 }
 protected override void HandleData(object data)
 {
     base.HandleData(data);
     selector = data as SelectorData;
     if (selector == null)
     {
         selector = new SelectorDataRoot();
     }
     InitGraph();
 }
        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);
                }
            }
        }
Пример #4
0
 /// <summary>
 /// 创建根节点并传入子树数据源
 /// </summary>
 /// <param name="moduleName"></param>
 /// <param name="getInstenceItem"></param>
 /// <param name="selectorDatas"></param>
 public void SetAsRoot(SelectorData data, Func <int, Transform, GraphNodeBehaiver> getInstenceItem)
 {
     this.GetInstence = getInstenceItem;
     m_auto.gameObject.SetActive(false);
     InstanceChildItems(data.SelectorDatas);
 }