예제 #1
0
    void RecursionNodeToReplaceInterfaceStepOne(Transform l_parent)
    {
        foreach (Transform node in l_parent)
        {
            if (node.name.Contains(c_InterfaceName))
            {
                if (!m_interfaceTmp.ContainsKey(node.name))
                {
                    InterfaceReplaceStruct tmp = new InterfaceReplaceStruct();
                    tmp.go    = node.gameObject;
                    tmp.index = node.transform.GetSiblingIndex();

                    m_interfaceTmp.Add(node.name, tmp);
                }
                else
                {
                    Debug.LogError(node.root.name + " : " + node.name + " 接口有重名!", node.gameObject);
                }
                node.SetParent(null);
            }
            else
            {
                RecursionNodeToReplaceInterfaceStepOne(node);
            }
        }
    }
예제 #2
0
    void RecursionNodeToReplaceInterfaceStepTwo(Transform l_parent)
    {
        foreach (Transform node in l_parent)
        {
            if (m_interfaceTmp.ContainsKey(node.name))
            {
                InterfaceReplaceStruct tmp = m_interfaceTmp[node.name];

                m_interfaceTmp.Remove(node.name);
                GameObject.DestroyImmediate(node.gameObject);

                tmp.go.transform.SetParent(l_parent);
                tmp.go.transform.SetSiblingIndex(tmp.index);
            }
            else
            {
                RecursionNodeToReplaceInterfaceStepTwo(node);
            }
        }
    }