// Main Window function of browser, used to draw GUI void windowFunction(int windowID) { GUI.skin = Skin; UWKWebView view = null; if (numTabs != 0) { view = tabs[activeTab].View; } GUIStyle buttonStyle = new GUIStyle(GUI.skin.button); buttonStyle.padding = new RectOffset(2, 2, 2, 2); GUI.color = new Color(1.0f, 1.0f, 1.0f, transparency); browserRect = new Rect(4, 118 + 8, Width, Height); Rect headerRect = new Rect(4, 4, Width, 118 + 4); GUI.DrawTexture(headerRect, texHeader); int titleHeight = 24; Rect titleRect = new Rect(0, 0, Width, titleHeight); GUI.DragWindow(titleRect); GUILayout.BeginVertical(); // Main Vertical GUILayout.BeginArea(new Rect(8, 4, Width, 118)); GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); // title Texture2D bxTex = GUI.skin.box.normal.background; GUI.skin.box.normal.background = null; GUI.skin.box.normal.textColor = new Color(.25f, .25f, .25f, 1.0f); GUILayout.Box(view == null ? "" : view.Title); GUI.skin.box.normal.background = bxTex; GUILayout.BeginHorizontal(); if (GUILayout.Button(texBack, buttonStyle, GUILayout.Width(texBack.width), GUILayout.Height(texBack.height))) { if (view != null) { view.Back(); } } if (GUILayout.Button(texForward, buttonStyle, GUILayout.Width(texForward.width), GUILayout.Height(texForward.height))) { if (view != null) { view.Forward(); } } if (GUILayout.Button(texReload, buttonStyle, GUILayout.Width(texReload.width), GUILayout.Height(texReload.height))) { if (view != null) { view.LoadURL(currentURL); } } bool nav = false; if (Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.KeypadEnter)) { nav = true; } GUI.SetNextControlName("BrowserURL"); currentURL = GUILayout.TextField(currentURL, GUILayout.MaxWidth(Width - 196)); // this is grey for some reason if (pageLoadProgress != 100) { Rect urlRect = GUILayoutUtility.GetLastRect(); urlRect.width *= (float)pageLoadProgress / 100.0f; GUI.DrawTexture(urlRect, texProgress); } if (nav && GUI.GetNameOfFocusedControl() == "BrowserURL") { GUIUtility.keyboardControl = 0; if (view != null) { string URL = currentURL.Replace(" ", "%20"); if (!URL.Contains(".")) { URL = "http://www.google.com/search?q=" + URL; } if (!URL.Contains("://")) { URL = "http://" + URL; } currentURL = URL; view.LoadURL(URL); } } GUILayout.EndHorizontal(); guiTabs(ref buttonStyle); GUILayout.EndVertical(); buttonStyle.normal.background = null; buttonStyle.normal.background = null; buttonStyle.hover.background = null; buttonStyle.active.background = null; buttonStyle.padding = new RectOffset(0, 0, 0, 0); if (GUILayout.Button(texLogo, buttonStyle, GUILayout.Width(84), GUILayout.Height(100))) { } GUILayout.EndHorizontal(); GUILayout.EndArea(); GUILayout.EndVertical(); // End Main Vertical if (view != null) { GUI.DrawTexture(browserRect, view.WebTexture); view.DrawTextIME((int)browserRect.x, (int)browserRect.y); } Rect footerRect = new Rect(4, browserRect.yMax, Width, 8); GUI.DrawTexture(footerRect, texFooter); }