示例#1
0
    void OnGUI()
    {
        Rect brect = new Rect(0, 0, 120, 40);

        if (UWKCore.BetaVersion)
        {
            GUI.Label(new Rect(0, 0, 200, 60), "UWEBKIT BETA VERSION\nCheck http://www.uwebkit.com\nfor updates");
            brect.y += 50;
        }

        if (GUI.Button(brect, "Zoom In"))
        {
            zoomLevel += .1f;
            UWKWebView.SetZoomLevel(zoomLevel);
        }

        brect.y += 50;

        if (GUI.Button(brect, "Zoom Out"))
        {
            zoomLevel -= .1f;
            UWKWebView.SetZoomLevel(zoomLevel);
        }

        brect.y += 50;

        if (GUI.Button(brect, "Back"))
        {
            SceneManager.LoadScene("ExampleLoader");
        }

        brect.y += 50;

        if (SourceCodePopup.usePopup)
        {
            if (GUI.Button(brect, "View Source"))
            {
                if (gameObject.GetComponent <SourceCodePopup>() == null)
                {
                    sourcePopup     = gameObject.AddComponent <SourceCodePopup>();
                    sourcePopup.URL = "https://github.com/uWebKit/uWebKit/blob/uWebKit2-Beta/uWebKit/Assets/uWebKitExamples/Scripts/WebGUI.cs";
                    webGUI.HasFocus = false;
                }
                else
                {
                    gameObject.SendMessage("SourcePopupClosed");
                }
            }
        }
    }