Example #1
0
    /// <summary>
    /// 递归初始化UI
    /// </summary>
    /// <param name="uiBase"></param>
    public void RecursionInitUI(UIBase parentUI, UIBase uiBase, int id, List <UILifeCycleInterface> UIList)
    {
        int childIndex = 0;

        for (int i = 0; i < uiBase.m_objectList.Count; i++)
        {
            GameObject go = uiBase.m_objectList[i];

            if (go != null)
            {
                UILifeCycleInterface tmp = go.GetComponent <UILifeCycleInterface>();

                if (tmp != null)
                {
                    if (!UIList.Contains(tmp))
                    {
                        uiBase.AddLifeCycleComponent(tmp);

                        UIList.Add(tmp);

                        UIBase subUI = uiBase.m_objectList[i].GetComponent <UIBase>();
                        if (subUI != null)
                        {
                            RecursionInitUI(uiBase, subUI, childIndex++, UIList);
                        }
                    }
                    else
                    {
                        Debug.LogError("InitWindow 重复的引用 " + uiBase.UIEventKey + " " + uiBase.m_objectList[i].name);
                    }
                }
            }
            else
            {
                Debug.LogWarning("InitWindow objectList[" + i + "] is null !: " + uiBase.UIEventKey);
            }
        }
    }