WebView component used to render and interact with web content
Inheritance: MonoBehaviour
Exemple #1
0
 public virtual void Start()
 {
 	view = gameObject.AddComponent<UWKWebView>();
     view.URL = URL;
     view.MaxWidth = MaxWidth;
     view.MaxHeight = MaxHeight;
 }
Exemple #2
0
 public FBRequest(UWKWebView view, string path, string method, string parameters)
 {
     this.view = view;
     request =  string.Format(
     @"FB.api('{0}', {1}, {2}, function(response) {
         UWK.sendMessage('{3}', response);
     });", path, method, parameters, message);
 }
    void onJSMessage(UWKWebView view, string message, string json, Dictionary<string, object> values)
    {
        if (message == "UnityMessage")
        {
            messageReceived  = "Message Received:\n" + json;
        }

    }
Exemple #4
0
    int findTab(UWKWebView view)
    {
        for (int i = 0; i < maxTabs; i++)
            if (tabs[i].View == view)
                return i;

        return -1;
    }
Exemple #5
0
	// Use this for initialization
	void Start ()
	{		
		windowRect = new Rect (X, Y, Width + 8, Height + 8 + toolbarHeight);

		view = UWKWebView.AddToGameObject(gameObject, URL, Width, Height);

		Center ();		
	}
Exemple #6
0
 public FBRequest(UWKWebView view, string path)
 {
     this.view = view;
     request =  string.Format(
     @"FB.api('{0}', function(response) {{
         UWK.sendMessage('{1}', response);
     }});", path, message);      
 }
Exemple #7
0
	// Use this for initialization
	void Start ()
	{		
		webGUI = gameObject.GetComponent<WebGUI>();
		UWKWebView = gameObject.GetComponent<UWKWebView>();
		
		webGUI.Position.x = Screen.width / 2 - UWKWebView.MaxWidth / 2;
		webGUI.Position.y = 0;

	}
Exemple #8
0
    void Start()
    {
        windowRect = new Rect (X, Y, Width + 16, Height + 16);        

        view = UWKWebView.AddToGameObject(gameObject, FacebookLoginSite, Width, Height);
        view.JSMessageReceived += onJSMessage;
        view.Hide();

        Center();
    }
Exemple #9
0
	private static void onJSMessage(UWKWebView view, string message, string json, Dictionary<string, object> values)
	{
		if (message == "buttonClicked")
		{

		#if UNITY_EDITOR
			EditorUtility.DisplayDialog ("Hello!", "Button clicked, value passed:\n"+ values, "OK!" );
		#endif

		}
	}
Exemple #10
0
 // Delegate called when a tab's URL has changed (redirects, etc)
 void urlChanged (UWKWebView view, string url)
 {
     int i = findTab (view);
     
     if (i >= 0)
         tabs[i].URL = url;
     
     if (i == activeTab)
         currentURL = url;
     
 }
Exemple #11
0
    // Use this for initialization
    void Start ()
    {       

        JSObject.SetProperty ("MyJSObject", "unityVersion", Application.unityVersion);

        webGUI = gameObject.GetComponent<WebGUI>();
        view = gameObject.GetComponent<UWKWebView>();
        view.JSMessageReceived += onJSMessage;
       
        view.LoadURL(UWKWebView.GetApplicationDataURL() + "/StreamingAssets/uWebKit/Examples/JavascriptExample.html");
        
        webGUI.Position.x = Screen.width / 2 - view.MaxWidth / 2;
        webGUI.Position.y = 0;

    }
    public static void setWeb(GameObject temp, string url, int x, int y, int width, int height)
    {
        webGUI = temp.AddComponent<Web_GUI> ();
        setting = temp.AddComponent<UWKWebView> ();
        temp.AddComponent<WebData>();
        temp.AddComponent<CC_Selectable>();

        setting.MaxWidth = 1920;
        setting.URL = url;
        setting.CurrentWidth = width;
        setting.CurrentHeight = height;

        webGUI.X = x;
        webGUI.Y = y;
    }
Exemple #13
0
    private void onJSMessage(UWKWebView view, string message, string json, Dictionary<string, object> values)
    {
        if (message != this.message)
            return;

        object errorObject;
        if (values.TryGetValue("error", out errorObject))
        {
            if (OnError != null)
                OnError(view, json, values);
        }
        else
        {
            if (OnSuccess != null)
                OnSuccess(view, json, values);
        }

    }
Exemple #14
0
    // Use this for initialization
    void Start()
    {
        view = gameObject.GetComponent<UWKWebView>();

        view.SetAlphaMask(AlphaMask);

        #if UNITY_5_0
        if (GetComponent<Renderer>() != null)
            GetComponent<Renderer>().material.mainTexture = view.WebTexture;

        if (GetComponent<GUITexture>() != null)
            GetComponent<GUITexture>().texture = view.WebTexture;
        #else
        if (renderer != null)
            renderer.material.mainTexture = view.WebTexture;

        if (guiTexture != null)
            guiTexture.texture = view.WebTexture;
        #endif
    }
Exemple #15
0
    // Use this for initialization
    void Start()
    {
        center = GameObject.Find("CenterEyeAnchor");
        mouseCursor = GameObject.Find("MouseCursor");

        view = gameObject.GetComponent<UWKWebView>();

        view.SetAlphaMask(AlphaMask);

        #if !UNITY_4_6
        if (GetComponent<Renderer>() != null)
            GetComponent<Renderer>().material.mainTexture = view.WebTexture;

        if (GetComponent<GUITexture>() != null)
            GetComponent<GUITexture>().texture = view.WebTexture;
        #else
        if (renderer != null)
            renderer.material.mainTexture = view.WebTexture;

        if (guiTexture != null)
            guiTexture.texture = view.WebTexture;
        #endif
    }
 void loadFinished(UWKWebView view)
 {
     // Dictionary<string, object> values = new Dictionary<string, object>();
     // values["Whee"] = 42;
     // SendJSMessage("testMessage", values);
 }
 void jsMessageReceived(UWKWebView view, string message, string json, Dictionary<string, object> values)
 {
     // Debug.Log("Javascript Message: " + message + " " + value);
 }
 void jsConsole(UWKWebView view, string message, int line, string source)
 {
     Debug.Log("Javascript: " + message + " " + line + " " + source);
 }
 void contentSizeChanged(UWKWebView view, int width, int height)
 {
     contentWidth = width;
     contentHeight = height;
 }
Exemple #20
0
 // Delegate called when a tab's page is loaded
 void loadFinished (UWKWebView view)
 {
     // ensure 100%
     pageLoadProgress = 100;
     
 }
 void titleChanged(UWKWebView view, string title)
 {
     Title = title;
 }
Exemple #22
0
    void newViewRequested(UWKWebView view, string url)
    {
        int i = findTab (view);
        
        if (i >= 0)
        {       
            if (numTabs >= maxTabs)
            {
                // load into current view
                view.LoadURL(url);
            }
            else
            {
                createTab(url);
                setActiveTab(numTabs - 1);
            }
        }

    }
Exemple #23
0
	public static string GetHTML(UWKWebView view)
	{
		view.JSMessageReceived += onJSMessage;
		return HTML;
	}
Exemple #24
0
    void onJSMessage(UWKWebView view, string message, string json, Dictionary<string, object> values)
    {
        if (message == "fbAuthResponse")
        {                       
            accessToken = (string) values["accessToken"];   

            if (state != State.Start)
            {
                handleLoggedIn();
            }           
            
        }       
        else if (message == "fbNotLoggedIn")
        {
            accessToken = "";
            Debug.Log("fbNotLoggedIn");
        }
    }
    public void set_In_Current_Page()
    {
        if(get_url != "" && get_url != "http://www.youtube.com/embed/"){
            isclicked = true;

                allUIElements = CC_Manager.allUIElements;
                GameObject web = Instantiate(webPrefab) as GameObject;
                web.transform.SetParent(UIManager._instance.GetMyCanvas(0), false);
                webGUI = web.AddComponent<Web_GUI> ();
                setting = web.AddComponent<UWKWebView> ();
                webData = web.AddComponent<WebData>();
                setting.URL = get_url;
                setting.MaxWidth = 1920;
                allUIElements.Add(web);

                x_slider.value = webGUI.X;
                y_slider.value = webGUI.Y;
                width_slider.value = setting.CurrentWidth;
                height_slider.value = setting.CurrentHeight;
                webData.url = get_url;
        }
    }
 void loadProgress(UWKWebView view, int progress)
 {
 }
    void newViewRequested(UWKWebView view, string url)
    {
        // Default handler loads in this view

        LoadURL(url);
    }
Exemple #28
0
 void loadProgress (UWKWebView view, int progress)
 {
     pageLoadProgress = progress;
 }
 void urlChanged(UWKWebView view, string url)
 {
 }
 void OpenURL(string url)
 {
     temp = new GameObject ();
     temp.AddComponent<Web_GUI> ();
     temp.AddComponent<UWKWebView> ();
     setting = temp.GetComponent<UWKWebView> ();
     setting.MaxWidth = 1920;
     setting.MaxHeight = 1920;
     setting.URL = url;
 }