示例#1
0
    private void OnApplicationQuit()
    {
        var obj = GameObject.Find("WebView");

        if (obj != null)
        {
            webView.CleanCache();
            webView.CleanCookie();
            Destroy(obj);
        }
    }
示例#2
0
        public void Show(string url)
        {
            /*if(WebView == null) {
             *  if(complete != null)complete();
             *  return;
             * }*/
            UniWebView.CleanCache();
            UniWebView.AddUrlScheme("lufy");
            UniWebView.OnLoadComplete += OnLoadCompleteEvent; // 読み込み完了後のイベント登録

            /*
             * UniWebView.OnReceivedMessage += OnReceivedMessage; // URLスキーマー取得のイベント登録
             * UniWebView.OnEvalJavaScriptFinished += OnEvalJavaScriptFinished; // JavaScript実行完了時のイベント登録
             */
            UniWebView.SetBackgroundColor(Color.clear);  // 透過処理を有効化
            UniWebView.backButtonEnable = false;         // Androidの戻るボタン(ソフトウェア)を無効化
            UniWebView.SetShowSpinnerWhenLoading(false); // iOSの読み込み中スピナーを無効化
            UniWebView.toolBarShow = false;              // iOSのツールブラウザーを無効化
            UniWebView.HideToolBar(false);               // iOSのツールブラウザーを無効化
            UniWebView.zoomEnable = false;               // iOSの ズームを無効化
            string userAgent = "Mozilla /5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B5110e Safari/601.1 ";

            UniWebView.SetUserAgent(userAgent);

            /*UniWebView.insets.left   = 0;
            *  UniWebView.insets.top    = 10;
            *  UniWebView.insets.right  = 0;*/
            UniWebView.insets.bottom = 106;

            RequestLoad(url);
            //if(complete != null)complete();
        }
示例#3
0
        public IEnumerator waitThenStartAdVideoWithJavascriptCall()
        {
            //if (AdGem.verboseLogging) { Debug.Log("Adgem - waitThenStartAdVideoWithJavascriptCall()"); }

            yield return(new WaitForSeconds(0.05f));

            waitingForPlaySuccessConfirmation = true;

            if (AdGem.verboseLogging)
            {
                Debug.Log("Adgem - JAVASCRIPT CALL: " + "init(" + initParams + "," + AdGemPlugin.appSessionId + ");");
            }

            //webView.EvaluateJavaScript("init_debug();", (payload) =>
            webView.EvaluateJavaScript("init(" + initParams + ",'" + AdGemPlugin.appSessionId + "');", (payload) =>
            {
                if (payload.resultCode.Equals("0"))
                {
                    if (AdGem.verboseLogging)
                    {
                        Debug.Log("Starting webview ad video!");
                    }
                }
                else
                {
                    Debug.Log("Something went wrong starting the ad video: " + payload.data);
                }
            });

            //Make sure the play success message is received
            float waitTime = 0f;

            while (waitingForPlaySuccessConfirmation && waitTime < 5.5f)
            {
                Debug.Log("Adgem - waiting for confirmation...");

                if (waitTime > 5f)
                {
                    waitingForPlaySuccessConfirmation = false;
                    if (webView != null)
                    {
                        Debug.Log("Adgem - closing webview because did not get confirmation **********------------*********");
                        webView.Stop();
                        webView.CleanCache();
                        webView.Hide(false);
                        AdGem.videoIsPlaying = false;
                        if (AdGem.videoFailedToLoad != null)
                        {
                            AdGem.videoFailedToLoad();
                        }
                    }
                }

                yield return(new WaitForSeconds(0.1f));

                waitTime += 0.1f;
            }
        }
示例#4
0
 /// <summary>
 /// 清除地图
 /// </summary>
 public void ClearWebView()
 {
     if (webView != null)
     {
         webView.CleanCache();
         Destroy(webView.gameObject);
         webView = null;
     }
 }
示例#5
0
 private void Finish()
 {
     mpMainUI.url = "about:blank";
     mpMainUI.Load();
     mpMainUI.Hide();
     mpMainUI.CleanCache();
     mpMainUI.CleanCookie();
     mpMainUI = null;
     callback(transactionResult);
 }
示例#6
0
        private void Close()
        {
            if (webView.IsInvoking(nameof(DisableDoubleClick)))
            {
                webView.CancelInvoke(nameof(DisableDoubleClick));
            }

            webView.CleanCache();
            webView = null;
        }
示例#7
0
 public void DestroyDicObj(string url)
 {
     if (dic.ContainsKey(url))
     {
         WebPage    webPage = SingleWeb.Instance.GetDicObj(url);
         UniWebView webView = webPage.webView;
         dic.Remove(url);
         webView.CleanCache();
         Destroy(webView);
     }
 }
示例#8
0
    public void LoadUrl()
    {
        if (m_UniWebView != null)
        {
            m_UniWebView.CleanCache();
        }
        if (m_InputField.text == null)
        {
            return;
        }

        m_UniWebView = UniWebViewHelper.CreateUniWebView(gameObject, url, 200, 0, 0, 0);
        m_UniWebView.OnLoadComplete    += OnLoadComplete;
        m_UniWebView.OnReceivedMessage += OnReceivedMessage;
        m_UniWebView.Load();
    }
示例#9
0
    public void LoadUrl()
    {
        if (m_UniWebView != null)
        {
            m_UniWebView.CleanCache();
        }

        Canvas parentCanvasOver   = overPanel.GetComponentInParent <Canvas>();
        Canvas parentCanvasBottom = bottomPanel.GetComponentInParent <Canvas>();

        int overPixel   = (int)(overPanel.rect.height * parentCanvasOver.scaleFactor + 0.5f);
        int bottomPixel = (int)(bottomPanel.rect.height * parentCanvasBottom.scaleFactor + 0.5f);

        m_UniWebView = UniWebViewHelper.CreateUniWebView(gameObject, url, overPixel, 0, bottomPixel, 0);
        m_UniWebView.OnLoadComplete += OnLoadComplete;
        m_UniWebView.Load();
    }
示例#10
0
    /// <summary>
    /// Awake this instance.
    /// </summary>
    void Awake()
    {
        _webView = gameObject.AddComponent <UniWebView> ();

        //TODO: 予めロードしているデータのデータが存在しない場合は通信してサーバーから再取得する必要がある
        //UserDeviceEntity.UserDevice uDevice = Extention.CommonPlayerPrefs.CommonLoad<UserDeviceEntity.UserDevice> (ApiConstants.API_USER_DEVICE);

        _webView.CleanCache();
        _webView.SetShowSpinnerWhenLoading(true);
        _webView.backButtonEnable         = true;
        _webView.autoShowWhenLoadComplete = true;

        // 設定サイズを取得
        //WebviewLayout.InsetsParameter wInsets = WebviewLayout.GetInsetsWebview (0.1785f, 0.0f, 0.097f);
        WebviewLayout.InsetsParameter wInsets = WebviewLayout.GetInsetsWebview(0.13f, 0.0f, 0.2f);
        _webView.insets = new UniWebViewEdgeInsets(wInsets.top, wInsets.side, wInsets.bottom, wInsets.side);

        _webView.SetShowSpinnerWhenLoading(true);
        _webView.SetTransparentBackground(true);
    }
        static void OpenWebview(string domain)
        {
            if (_webView != null)
            {
                return;
            }
            _webView = CreateWebView();
            string t = string.Format("\"{0}\"", JsonMapper.ToJson(data));

            _webView.url = domain + "/?data=" + JsonMapper.ToJson(data);
            _webView.CleanCache();
            _webView.backButtonEnable = true;
            int bottomInset = UniWebViewHelper.screenHeight;

            _webView.insets             = new UniWebViewEdgeInsets(0, 0, 0, 0);
            _webView.OnReceivedMessage += OnReceivedMessage;

            _webView.Load();
            _webView.Show();
            onOpen.Invoke();
        }
示例#12
0
        //----- property -----

        //----- method -----

        public IObservable <Unit> Initialize()
        {
            if (initialized)
            {
                return(Observable.ReturnUnit());
            }

            #if UNITY_IOS || UNITY_ANDROID || UNITY_WP8
            uniWebView = UnityUtility.GetOrAddComponent <UniWebView>(gameObject);

            // .
            uniWebView.HideToolBar(false);

            // URLリンクをデバイスのデフォルトブラウザで開くかどうかの設定.
            uniWebView.openLinksInExternalBrowser = false;

            // 横スクロールバー.
            uniWebView.SetHorizontalScrollBarShow(false);

            // 縦スクロールバー.
            uniWebView.SetVerticalScrollBarShow(false);
            uniWebView.CleanCache();
            #endif

            #if UNITY_ANDROID
            uniWebView.SetUseWideViewPort(false);
            uniWebView.backButtonEnable = true;
            #endif

            #if UNITY_IOS || UNITY_ANDROID || UNITY_WP8
            uniWebView.OnLoadComplete       += OnLoadComplete;
            uniWebView.OnReceivedMessage    += OnReceivedMessage;
            uniWebView.OnWebViewShouldClose += OnWebViewShouldClose;
            #endif

            initialized = true;

            return(Observable.ReturnUnit());
        }
示例#13
0
    public void Logout()
    {
        Debug.Log("Logout - Start");
        //TODO: Delete all playerprefs???
        PlayerPrefs.DeleteKey(AppDB.Instance.nameKey);
        PlayerPrefs.DeleteKey(AppDB.Instance.surnameKey);
        PlayerPrefs.DeleteKey(AppDB.Instance.emailKey);
        PlayerPrefs.DeleteKey(AppDB.Instance.qualificaKey);
        PlayerPrefs.DeleteKey(AppDB.Instance.authenticationTokenKey);
        PlayerPrefs.DeleteKey(AppDB.Instance.user_idKey);
        PlayerPrefs.Save();
        // File.Delete(AppDB.Instance.GetUser_QrCodePath());

        // profile_UniWebView.Hide();
        //profileTabGO?.SetActive(false);
        UniWebView.ClearCookies();              //TODO: change to SetCookies()
        login_UniWebView.CleanCache();          //TODO: unsure we need it, but just in case

        Debug.Log("Logout - End");

        Application.Quit();
        // Login_AppManager.Instance.ChangeStateToLogin();
    }
示例#14
0
    /// <summary>
    /// WebView終了処理
    /// </summary>
    void WebViewEnd()
    {
        // 止めていたBGMの再生
        if (m_TmpPrevPlayDatas != null && m_ReturnableBGM)
        {
            foreach (BGMPlayData playData in m_TmpPrevPlayDatas)
            {
                SoundUtil.PlayBGM(playData);
            }
        }

        if (lastDialog != null)
        {
            lastDialog.SetActive(true);
            lastDialog = null;
        }

#if UNITY_EDITOR_OSX
        //MacでWebを表示すると固まるのでスキップ
#elif UNITY_IOS || UNITY_ANDROID || UNITY_WP8
        m_WebView.Hide();
        m_WebView.CleanCache();
#endif

        if (m_CloseAction != null)
        {
            m_CloseAction();
        }

        DestroyObject(gameObject);

        if (m_WebViewFixID != 0)
        {
            MainMenuWebViewShowChk.SetViewCheck(m_WebViewFixID, true);
        }
        m_WebViewOpen = false;
    }
示例#15
0
    public void CleanCache()
    {
#if UNITY_IOS || UNITY_ANDROID || UNITY_EDITOR
        uniWebView.CleanCache();
#endif
    }