Beispiel #1
0
    private void Refresh()
    {
        if (_rt == null)
        {
            return;
        }

        if (!IsResizeSourceChanged() && !_rrChanged)
        {
            return;
        }

        _lastRS = _rs;

        if (_rs == ResizeSource.ScreenSize)
        {
            _rt.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, Screen.safeArea.x, Screen.safeArea.width);
            _rt.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Bottom, Screen.safeArea.y, Screen.safeArea.height);
        }
        else if (_rs == ResizeSource.Customize)
        {
            Rect scaledSafeArea = ResolutionUtility.GetScaledSafeArea();
            _rt.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, scaledSafeArea.x, scaledSafeArea.width);
            _rt.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Bottom, scaledSafeArea.y, scaledSafeArea.height);
        }
    }