예제 #1
0
    private void InitWeb()
    {
        isInit   = true;
        _webView = transform.gameObject.AddComponent <UniWebView>();
        _webView.SetShowSpinnerWhileLoading(true);
        _webView.SetUseWideViewPort(true);
        _webView.SetWindowUserResizeEnabled(true);
        _webView.SetZoomEnabled(true);
        _webView.OnMessageReceived    += OnReceivedMessage;
        _webView.OnPageStarted        += _webView_OnPageStarted;
        _webView.OnPageFinished       += _webView_OnPageFinished;
        _webView.OnOreintationChanged += _webView_OnOreintationChanged;
        _webView.Load(url);

        string agent = _webView.GetUserAgent();

        agent += ";browser_type/android_app";
        _webView.SetUserAgent(agent);
        heiht  = Screen.height;
        heiht -= 100;
        if (Screen.height == 2436)
        {
            heiht         -= 65;
            _webView.Frame = new Rect(0, 0, Screen.width, heiht);
            GameObject.Find("Canvas/webview/bottomBar").transform.localPosition += new Vector3(0, 20, 0);
        }
        else
        {
            _webView.Frame = new Rect(0, 0, Screen.width, heiht);
        }
    }