public void RecursiveExecute(PanelTreeInterface node, UIFadeIteratorFunc nodeFunc, UIFadeIteratorFunc finishFunc)
 {
     nodeFunc(node);
     if (node.IsLeaf())
     {
         finishFunc(node);
     }
     else
     {
         foreach (PanelTreeInterface child in node.childrenDictionary.Values)
         {
             RecursiveExecute(child, nodeFunc, finishFunc);
         }
     }
 }
        /// <summary>
        /// 递归初始化
        /// </summary>
        /// <param name="node">当前节点</param>
        public void RecursiveInit(PanelTreeInterface node)
        {
            node.Init();

            if (node.IsLeaf())
            {
                return;
            }
            else
            {
                foreach (PanelTreeInterface child in node.childrenDictionary.Values)
                {
                    RecursiveInit(child);
                }
            }
        }
        private void BuildTreeTable(PanelTreeInterface node, List <string> pathArr)
        {
            pathArr.Add(node.name);

            pathTable.Add(node.name, pathArr);

            satellightTable.Add(node.name, node);

            if (node.IsLeaf())
            {
                return;
            }
            else
            {
                foreach (PanelTreeInterface child in node.childrenDictionary.Values)
                {
                    BuildTreeTable(child, new List <string>(pathArr));
                }
            }
        }
Пример #4
0
 // Use this for initialization
 public void Init()
 {
     root = GameObject.Find("UI Root");
     //搜索到所有的Panel原件
     panels = new Dictionary <string, GameObject>();
     for (int i = 0; i < PANEL_NAMES.Count; i++)
     {
         GameObject panelObj = root.transform.Find(PANEL_NAMES[i] + "_Panel").gameObject;
         panels.Add(PANEL_NAMES[i], panelObj);
     }
     //游戏初始界面打开情况
     //current = "Logo";
     currentPanelPath = new List <string>()
     {
         "UI Root", "Logo_Panel"
     };
     try
     {
         PanelTreeInterface rt = root.GetComponent <PanelTreeInterface>();
         iterator = new FadeTreeIterator(rt);
         iterator.Init();
         //Debug.Log("打印Panel树");
         //iterator.PrintTree();
     }
     catch (Exception e)
     {
         if (e.GetType() == typeof(NullReferenceException))
         {
             string emsg = string.Format("未找到TreeInterface组件!请检查 {0}!", name);
             Debug.LogError(emsg);
         }
         else
         {
             Debug.LogError(e);
         }
     }
 }
 public void RecursiveExecute(PanelTreeInterface node, UIFadeIteratorFunc func)
 {
     RecursiveExecute(node, func, func);
 }
 public FadeTreeIterator(PanelTreeInterface root)
 {
     this.root = root;
 }