FairyGUI.UIPanel.HandleScreenSizeChanged C# (CSharp) Method

HandleScreenSizeChanged() public method

public HandleScreenSizeChanged ( ) : void
return void
        void HandleScreenSizeChanged()
        {
            if (!Application.isPlaying)
                DisplayOptions.SetEditModeHideFlags();

            screenSizeVer = StageCamera.screenSizeVer;

            if (this.container != null)
            {
                if (this.container.renderMode != RenderMode.WorldSpace)
                    this.container.scale = new Vector2(StageCamera.UnitsPerPixel * UIContentScaler.scaleFactor, StageCamera.UnitsPerPixel * UIContentScaler.scaleFactor);
            }

            int width = Mathf.CeilToInt(Screen.width / UIContentScaler.scaleFactor);
            int height = Mathf.CeilToInt(Screen.height / UIContentScaler.scaleFactor);
            if (this._ui != null)
            {
                switch (fitScreen)
                {
                    case FitScreen.FitSize:
                        this._ui.SetXY(0, 0);
                        this._ui.SetSize(width, height);
                        break;

                    case FitScreen.FitWidthAndSetMiddle:
                        this._ui.SetXY(0, (int)((height - this._ui.sourceHeight) / 2));
                        this._ui.SetSize(width, this._ui.sourceHeight);
                        break;

                    case FitScreen.FitHeightAndSetCenter:
                        this._ui.SetXY((int)((width - this._ui.sourceWidth) / 2), 0);
                        this._ui.SetSize(this._ui.sourceWidth, height);
                        break;
                }
            }
            else
            {
                switch (fitScreen)
                {
                    case FitScreen.FitSize:
                        uiBounds.position = new Vector2(0, 0);
                        uiBounds.size = new Vector2(width, height);
                        break;

                    case FitScreen.FitWidthAndSetMiddle:
                        uiBounds.position = new Vector2(0, (int)((height - cachedUISize.y) / 2));
                        uiBounds.size = new Vector2(width, cachedUISize.y);
                        break;

                    case FitScreen.FitHeightAndSetCenter:
                        uiBounds.position = new Vector2((int)((width - cachedUISize.x) / 2), 0);
                        uiBounds.size = new Vector2(cachedUISize.x, height);
                        break;
                }
            }
        }