// Main Window function of browser, used to draw GUI void windowFunction(int windowID) { if (GUI.Button(new Rect(windowRect.width - 28, 4, 24, 24), "X")) { Close(); return; } GUI.DragWindow(new Rect(0, 0, Width, toolbarHeight)); View.DrawGUI(4, 4 + toolbarHeight, windowRect); }
// Update is called once per frame void Update() { // We'll be valid one the view is created if (!Valid) { return; } // can happen on a texture resize if (renderer != null) { if (renderer.material.mainTexture == null) { renderer.material.mainTexture = View.MainTexture; } } if (WebMaterial != null) { WebMaterial.mainTexture = View.MainTexture; } if (guiTexture != null) { if (guiTexture.texture == null) { guiTexture.texture = View.MainTexture; } } if (!MouseEnabled) { return; } #if UNITY_IPHONE && !UNITY_EDITOR if (guiTexture == null && Rotate) { gameObject.transform.Rotate(0, Time.deltaTime * 2.0f, 0); } else if (guiTexture != null) { View.DrawGUI(0, (int)(Screen.height - guiTexture.pixelInset.height), (int)guiTexture.pixelInset.width, (int)guiTexture.pixelInset.height); } return; #endif if (Rotate) { gameObject.transform.Rotate(0, Time.deltaTime * 2.0f, 0); } /* * RaycastHit rcast; * * if (Physics.Raycast (Camera.main.ScreenPointToRay (Input.mousePosition), out rcast)) { * * if (rcast.collider != GetComponent<MeshCollider> ()) * return; * * int x = (int)(rcast.textureCoord.x * (float)Width); * int y = Height - (int)(rcast.textureCoord.y * (float)Height); * * View.SetMousePos (x, y); * * for (int i = 0; i < 3; i++) { * if (Input.GetMouseButtonDown (i)) { * View.OnMouseButtonDown (x, y, i); * } * * if (Input.GetMouseButtonUp (i)) { * * View.OnMouseButtonUp (x, y, i); * * } * * } * * } */ }