示例#1
0
/*
 #if !UNITY_WEBPLAYER
 *  void OnGUI()
 *  {
 *      //Nav Buttons
 *      GUI.enabled = webViewObject.CanGoBack();
 *      if (GUI.Button(new Rect(10, 10, 80, 80), "BACK")) {
 *          webViewObject.GoBack();
 *      }
 *      GUI.enabled = true;
 *
 *      GUI.enabled = webViewObject.CanGoForward();
 *      if (GUI.Button(new Rect(100, 10, 80, 80), ">")) {
 *          webViewObject.GoForward();
 *      }
 *      GUI.enabled = true;
 *
 *      GUI.TextField(new Rect(200, 10, 300, 80), "" + webViewObject.Progress());
 *
 *      if (GUI.Button(new Rect(600, 10, 80, 80), "*")) {
 *          var g = GameObject.Find("WebViewObject");
 *          if (g != null) {
 *              Destroy(g);
 *          } else {
 *              StartCoroutine(Start());
 *          }
 *      }
 *      GUI.enabled = true;
 *
 *      if (GUI.Button(new Rect(700, 10, 80, 80), "c")) {
 *          Debug.Log(webViewObject.GetCookies(Url));
 *      }
 *      GUI.enabled = true;
 *  }
 #endif
 */



    // Update is called once per frame
    void Update()
    {
        if ((swipeUpPanel.GetComponent <PageSwiper>().currentPage == 2))
        {
            if ((webViewObject.GetVisibility() == false))
            {
                if (GameObject.FindGameObjectWithTag("Barcode").GetComponent <TextMeshProUGUI>().text.Equals(""))
                {
                    webViewObject.LoadURL("https://world-de.openfoodfacts.org/");
                    webViewObject.SetVisibility(true);
                }
                else
                {
                    webViewObject.LoadURL("https://world-de.openfoodfacts.org/produkt/" + GameObject.FindGameObjectWithTag("Barcode").GetComponent <TextMeshProUGUI>().text);
                    webViewObject.SetVisibility(true);
                }
            }
        }
        else if ((swipeUpPanel.GetComponent <PageSwiper>().currentPage == 1))
        {
            if ((webViewObject.GetVisibility() == true))
            {
                webViewObject.SetVisibility(false);
            }
        }
    }
    public void OnClick()
    {
        // すでに開かれている場合は閉じる
        if (_view != null && _view.GetVisibility())
        {
            _view.SetVisibility(false);
        }

        // URL取得
        string url = GetURL();

        // Webページに飛ぶ
        if (_isJumpPage)
        {
            Application.OpenURL(url);
            return;
        }

        // WebViewで表示
        if (_webViewObj == null)
        {
            Debug.LogError("WebViewObjectがアタッチされていません。");
            return;
        }
        _view = Instantiate(_webViewObj);
        _view.Init(null);
        _view.LoadURL(url);
        _view.SetMargins(Screen.width / WEB_PAGE_MARGIN, Screen.height / WEB_PAGE_MARGIN, Screen.width / WEB_PAGE_MARGIN, Screen.height / WEB_PAGE_MARGIN);
        _view.SetVisibility(true);
    }
 static int QPYX_GetVisibility_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 1);
         WebViewObject QPYX_obj_YXQP = (WebViewObject)ToLua.CheckObject <WebViewObject>(L_YXQP, 1);
         bool          QPYX_o_YXQP   = QPYX_obj_YXQP.GetVisibility();
         LuaDLL.lua_pushboolean(L_YXQP, QPYX_o_YXQP);
         return(1);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }