FindParent() публичный Метод

public FindParent ( ) : exUIElement,
Результат exUIElement,
Пример #1
0
    ///////////////////////////////////////////////////////////////////////////////
    // functions
    ///////////////////////////////////////////////////////////////////////////////

    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public void Init()
    {
        if (initialized)
        {
            return;
        }

        //
        if (GetComponent <Camera>() == null)
        {
            Debug.LogError("The exUIMng should attach to a camera");
            return;
        }

        //
        for (int i = 0; i < 10; ++i)
        {
            touchStateList[i] = new TouchState();
        }

        // recursively add ui-tree
        exUIElement[] elements = FindObjectsOfType(typeof(exUIElement)) as exUIElement[];
        for (int i = 0; i < elements.Length; ++i)
        {
            exUIElement el        = elements[i];
            exUIElement parent_el = el.FindParent();
            if (parent_el == null)
            {
                exUIElement.FindAndAddChild(el);

                //
                if (rootElements.IndexOf(el) == -1)
                {
                    rootElements.Add(el);
                }
            }
        }

        //
        mouseState.currentPos     = Vector2.zero;
        mouseState.currentButtons = exUIEvent.MouseButtonFlags.None;
        mouseState.hotElement     = null;
        mouseState.focusElement   = null;

        initialized = true;
    }