Exemplo n.º 1
0
        private void ResizeInternal()
        {
            int newHeight = UniWebViewHelper.screenHeight;
            int newWidth  = UniWebViewHelper.screenWidth;

            UniWebViewEdgeInsets newInset = Insets;

            if (InsetsForScreenOreitation != null)
            {
                UniWebViewOrientation orientation =
                    newHeight >= newWidth ? UniWebViewOrientation.Portrait : UniWebViewOrientation.LandScape;
                newInset = InsetsForScreenOreitation(this, orientation);
            }
            ForceUpdateInsetsInternal(newInset);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 同步显示范围
        /// </summary>
        /// <param name="insets"></param>
        private void ForceUpdateInsetsInternal(UniWebViewEdgeInsets insets)
        {
            _insets = insets;
            UniWebViewPlugin.ChangeInsets(gameObject.name,
                                          Insets.top,
                                          Insets.left,
                                          Insets.bottom,
                                          Insets.right);
#if UNITY_EDITOR
            CreateTexture(Insets.left,
                          Insets.bottom,
                          Screen.width - Insets.left - Insets.right,
                          Screen.height - Insets.top - Insets.bottom
                          );
#endif
        }
Exemplo n.º 3
0
        public UniWebViewEdgeInsets GetShowParam()
        {
            _screenWidth = UniWebViewHelper.screenWidth;
            int _screenHeight = UniWebViewHelper.screenHeight;
            int _webViewScale = UniWebViewHelper.screenScale;
            var vec           = UICamera.mainCamera.WorldToScreenPoint(transform.position);

            vec = new Vector2(vec.x / _webViewScale, vec.y / _webViewScale);
            var size     = ShowView.localSize;
            var dealSize = new Vector2(size.x * Scale, size.y * Scale);
            var top      = (int)(_screenHeight - (vec.y + dealSize.y));
            int left     = (int)vec.x;
            int bottom   = (int)vec.y;
            int right    = (int)(_screenWidth - (vec.x + dealSize.x));
            UniWebViewEdgeInsets showParame = new UniWebViewEdgeInsets(top + Border, left + Border, bottom + Border, right + Border);

            return(showParame);
        }
Exemplo n.º 4
0
        public UniWebViewEdgeInsets GetShowParam()
        {
            if (BottomLeft == null || TopRight == null)
            {
                return(UniWebViewEdgeInsets.Zero);
            }
            _screenWidth = UniWebViewHelper.screenWidth;
            int _webViewScale = UniWebViewHelper.screenScale;
            var bottomLeft    = UICamera.mainCamera.WorldToScreenPoint(BottomLeft.position);

            bottomLeft = new Vector2(bottomLeft.x / _webViewScale, bottomLeft.y / _webViewScale);
            int left     = (int)bottomLeft.x;
            int bottom   = (int)bottomLeft.y;
            var topRight = UICamera.mainCamera.WorldToScreenPoint(TopRight.position);

            topRight = new Vector2(topRight.x / _webViewScale, topRight.y / _webViewScale);
            var top   = (int)(UniWebViewHelper.screenHeight - topRight.y);
            int right = (int)(_screenWidth - topRight.x);
            UniWebViewEdgeInsets showParame = new UniWebViewEdgeInsets(top + Border, left + Border, bottom + Border, right + Border);

            YxDebug.LogError(string.Format("Top:{0},Left:{1} ,Bottom:{2},Right:{3}", showParame.top, showParame.left, showParame.bottom, showParame.right));
            return(showParame);
        }