SetCurrentSize() 공개 메소드

Sets the current width and height of the UWKWebView
public SetCurrentSize ( int width, int height ) : void
width int
height int
리턴 void
예제 #1
0
    void OnGUI()
    {
        time += Time.deltaTime;

        if (time > .25)
        {
            time = 0;

            if (direction)
            {
                width  += 16;
                height += 16;

                zoom += 0.05f;

                if (zoom > 3.0f)
                {
                    zoom = 3.0f;
                }

                if (width > MaxWidth || height > MaxHeight)
                {
                    direction = !direction;
                    width     = MaxWidth;
                    height    = MaxHeight;
                }
            }
            else
            {
                width  -= 16;
                height -= 16;

                zoom -= 0.05f;

                if (zoom < 0.25f)
                {
                    zoom = 0.25f;
                }

                if (width < 32 || height < 32)
                {
                    width     = 32;
                    height    = 32;
                    direction = !direction;
                }
            }

            //Debug.Log("" + width + " x " + height + " at zoom " + zoom);

            view.SetCurrentSize(width, height);
            if (TestZoom)
            {
                view.SetZoomFactor(zoom);
            }
        }

        if (view != null && view.Visible() && HasFocus)
        {
            if (Event.current.type == EventType.Layout)
            {
                Vector3 mousePos = Input.mousePosition;
                mousePos.y = Screen.height - mousePos.y;
                view.ProcessMouse(mousePos);
            }

            if (Event.current.isKey)
            {
                view.ProcessKeyboard(Event.current);
            }
        }

        if (view != null && view.Visible())
        {
            if (Event.current.type == EventType.Repaint)
            {
                Rect r = new Rect(Positon.x, Positon.y, view.CurrentWidth, view.CurrentHeight);
                GUI.DrawTexture(r, view.WebTexture);
            }
        }
    }