FairyGUI.GRoot.AdjustModalLayer C# (CSharp) Method

AdjustModalLayer() private method

private AdjustModalLayer ( ) : void
return void
        private void AdjustModalLayer()
        {
            if (_modalLayer == null)
            {
                _modalLayer = new GGraph();
                _modalLayer.DrawRect(this.width, this.height, 0, Color.white, UIConfig.modalLayerColor);
                _modalLayer.AddRelation(this, RelationType.Size);
                _modalLayer.gameObjectName = "ModalLayer";
                _modalLayer.SetHome(this);
            }

            int cnt = this.numChildren;

            if (_modalWaitPane != null && _modalWaitPane.parent != null)
                SetChildIndex(_modalWaitPane, cnt - 1);

            for (int i = cnt - 1; i >= 0; i--)
            {
                GObject g = this.GetChildAt(i);
                if ((g is Window) && (g as Window).modal)
                {
                    if (_modalLayer.parent == null)
                        AddChildAt(_modalLayer, i);
                    else
                        SetChildIndexBefore(_modalLayer, i);
                    return;
                }
            }

            if (_modalLayer.parent != null)
                RemoveChild(_modalLayer);
        }