Exemplo n.º 1
0
 public static void KeyUp(HHTMLBrowser unBrowserHandle, uint nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers)
 {
     InteropHelp.TestIfAvailableClient();
     NativeMethods.ISteamHTMLSurface_KeyUp(unBrowserHandle, nNativeKeyCode, eHTMLKeyModifiers);
 }
Exemplo n.º 2
0
 /// <summary>
 /// <para> keyboard interactions, native keycode is the virtual key code value from your OS</para>
 /// </summary>
 public static void KeyDown(HHTMLBrowser unBrowserHandle, uint nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers)
 {
     InteropHelp.TestIfAvailableClient();
     NativeMethods.ISteamHTMLSurface_KeyDown(CSteamAPIContext.GetSteamHTMLSurface(), unBrowserHandle, nNativeKeyCode, eHTMLKeyModifiers);
 }
Exemplo n.º 3
0
 public static void KeyChar(HHTMLBrowser unBrowserHandle, uint cUnicodeChar, EHTMLKeyModifiers eHTMLKeyModifiers)
 {
     InteropHelp.TestIfAvailableClient();
     NativeMethods.ISteamHTMLSurface_KeyChar(unBrowserHandle, cUnicodeChar, eHTMLKeyModifiers);
 }
Exemplo n.º 4
0
 public static void KeyChar(HHTMLBrowser unBrowserHandle, uint cUnicodeChar, EHTMLKeyModifiers eHTMLKeyModifiers)
 {
     InteropHelp.TestIfAvailableClient();
     NativeMethods.ISteamHTMLSurface_KeyChar(unBrowserHandle, cUnicodeChar, eHTMLKeyModifiers);
 }
Exemplo n.º 5
0
		public static extern void ISteamHTMLSurface_KeyUp(HHTMLBrowser unBrowserHandle, uint nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers);
Exemplo n.º 6
0
		public static extern void ISteamHTMLSurface_KeyChar(HHTMLBrowser unBrowserHandle, uint cUnicodeChar, EHTMLKeyModifiers eHTMLKeyModifiers);
        }                                                                                                                           // 0x000000018079EBD0-0x000000018079EC50

        public static void KeyChar(HHTMLBrowser unBrowserHandle, uint cUnicodeChar, EHTMLKeyModifiers eHTMLKeyModifiers)
        {
        }                                                                                                                           // 0x000000018079EAC0-0x000000018079EB40
    public void RenderOnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height));
        GUILayout.Label("Variables:");
        GUILayout.Label("m_Init: " + m_Init);
        GUILayout.Label("m_HHTMLBrowser: " + m_HHTMLBrowser);
        GUILayout.EndArea();

        if (m_Texture)
        {
            GUI.DrawTexture(m_Rect, m_Texture);
        }

        if (!m_Init)
        {
            GUILayout.Label("SteamHTMLSurface.Init() returned false");
            return;
        }

        if (GUILayout.Button("CreateBrowser(\"SpaceWars Test\", null)"))
        {
            RemoveBrowser();             // Remove an old browser if it exists.
            SteamAPICall_t handle = SteamHTMLSurface.CreateBrowser("SpaceWars Test", null);
            m_HTML_BrowserReadyResult.Set(handle);
            print("SteamHTMLSurface.CreateBrowser(\"SpaceWars Test\", null) - " + handle);
        }

        if (GUILayout.Button("RemoveBrowser(m_HHTMLBrowser)"))
        {
            RemoveBrowser();
        }

        m_URL = GUILayout.TextField(m_URL);
        if (GUILayout.Button("LoadURL(m_HHTMLBrowser, m_URL, null)"))
        {
            SteamHTMLSurface.LoadURL(m_HHTMLBrowser, m_URL, null);
            print("SteamHTMLSurface.LoadURL(m_HHTMLBrowser," + m_URL + ", null)");
        }

        if (GUILayout.Button("SetSize(m_HHTMLBrowser, m_Width, m_Height)"))
        {
            m_Width   = (uint)Screen.width - WidthOffset;
            m_Height  = (uint)Screen.height - HeightOffset;
            m_Rect    = new Rect(WidthOffset, m_Height + HeightOffset, m_Width, -m_Height);          // This flips the viewport since Unity renders textures upside down.
            m_Texture = null;
            SteamHTMLSurface.SetSize(m_HHTMLBrowser, m_Width, m_Height);
            print("SteamHTMLSurface.SetSize(m_HHTMLBrowser, " + m_Width + ", " + m_Height + ")");
        }

        if (GUILayout.Button("StopLoad(m_HHTMLBrowser)"))
        {
            SteamHTMLSurface.StopLoad(m_HHTMLBrowser);
            print("SteamHTMLSurface.StopLoad(m_HHTMLBrowser)");
        }

        if (GUILayout.Button("Reload(m_HHTMLBrowser)"))
        {
            SteamHTMLSurface.Reload(m_HHTMLBrowser);
            print("SteamHTMLSurface.Reload(m_HHTMLBrowser)");
        }

        GUI.enabled = m_CanGoBack;
        if (GUILayout.Button("GoBack(m_HHTMLBrowser)"))
        {
            SteamHTMLSurface.GoBack(m_HHTMLBrowser);
            print("SteamHTMLSurface.GoBack(m_HHTMLBrowser)");
        }
        GUI.enabled = m_CanGoForward;
        if (GUILayout.Button("GoForward(m_HHTMLBrowser)"))
        {
            SteamHTMLSurface.GoForward(m_HHTMLBrowser);
            print("SteamHTMLSurface.GoForward(m_HHTMLBrowser)");
        }
        GUI.enabled = true;

        if (GUILayout.Button("AddHeader(m_HHTMLBrowser, \"From\", \"[email protected]\")"))
        {
            SteamHTMLSurface.AddHeader(m_HHTMLBrowser, "From", "*****@*****.**");
            print("SteamHTMLSurface.AddHeader(m_HHTMLBrowser, \"From\", \"[email protected]\")");
        }

        if (GUILayout.Button("ExecuteJavascript(m_HHTMLBrowser, \"window.alert('Test');\")"))
        {
            SteamHTMLSurface.ExecuteJavascript(m_HHTMLBrowser, "window.alert('Test');");
            print("SteamHTMLSurface.ExecuteJavascript(m_HHTMLBrowser, \"window.alert('Test');\")");
        }

        if (GUILayout.Button("SetKeyFocus(m_HHTMLBrowser, " + !m_SetKeyFocus + ")"))
        {
            SteamHTMLSurface.SetKeyFocus(m_HHTMLBrowser, !m_SetKeyFocus);
            m_SetKeyFocus = !m_SetKeyFocus;
            print("SteamHTMLSurface.SetKeyFocus(m_HHTMLBrowser, " + !m_SetKeyFocus + ")");
        }

        if (GUILayout.Button("ViewSource(m_HHTMLBrowser)"))
        {
            SteamHTMLSurface.ViewSource(m_HHTMLBrowser);
            print("SteamHTMLSurface.ViewSource(m_HHTMLBrowser)");
        }

        if (GUILayout.Button("CopyToClipboard(m_HHTMLBrowser)"))
        {
            SteamHTMLSurface.CopyToClipboard(m_HHTMLBrowser);
            print("SteamHTMLSurface.CopyToClipboard(m_HHTMLBrowser)");
        }

        if (GUILayout.Button("PasteFromClipboard(m_HHTMLBrowser)"))
        {
            SteamHTMLSurface.PasteFromClipboard(m_HHTMLBrowser);
            print("SteamHTMLSurface.PasteFromClipboard(m_HHTMLBrowser)");
        }

        m_Find = GUILayout.TextField(m_Find);
        if (GUILayout.Button("Find(m_HHTMLBrowser, m_Find, m_CurrentlyInFind, false)"))
        {
            SteamHTMLSurface.Find(m_HHTMLBrowser, m_Find, m_CurrentlyInFind, bReverse: false);
            print("SteamHTMLSurface.Find(m_HHTMLBrowser," + m_Find + ", " + m_CurrentlyInFind + ", false)");
            m_CurrentlyInFind = true;
        }

        if (GUILayout.Button("StopFind(m_HHTMLBrowser)"))
        {
            SteamHTMLSurface.StopFind(m_HHTMLBrowser);
            print("SteamHTMLSurface.StopFind(m_HHTMLBrowser)");
            m_CurrentlyInFind = false;
        }

        if (GUILayout.Button("GetLinkAtPosition(m_HHTMLBrowser, 500, 120)"))
        {
            SteamHTMLSurface.GetLinkAtPosition(m_HHTMLBrowser, 500 - WidthOffset, 120 - HeightOffset);
            print("SteamHTMLSurface.GetLinkAtPosition(m_HHTMLBrowser, 500, 120)");
        }

        // Use with http://html-kit.com/tools/cookietester/
        if (GUILayout.Button("SetCookie(\"html-kit.com\", \"testcookiekey\", \"testcookievalue\")"))
        {
            SteamHTMLSurface.SetCookie("html-kit.com", "testcookiekey", "testcookievalue");
            print("SteamHTMLSurface.SetCookie(\"html-kit.com\", \"testcookiekey\", \"testcookievalue\")");
        }

        m_ScaleFactor = GUILayout.HorizontalScrollbar(m_ScaleFactor, 0.25f, 0f, 2f);
        if (GUILayout.Button("SetPageScaleFactor(m_HHTMLBrowser, " + m_ScaleFactor + ", 0, 0)"))
        {
            SteamHTMLSurface.SetPageScaleFactor(m_HHTMLBrowser, m_ScaleFactor, 0, 0);
            print("SteamHTMLSurface.SetPageScaleFactor(m_HHTMLBrowser, " + m_ScaleFactor + ", 0, 0)");
        }

        if (m_HHTMLBrowser == HHTMLBrowser.Invalid)
        {
            return;
        }

        // We set the moust position before checking for mouse presses just incase the mouse moved in the same OnGUI frame as a mouse press.
        Event e = Event.current;

        if (e.mousePosition != m_LastMousePos)
        {
            if ((e.mousePosition.x >= WidthOffset && e.mousePosition.x <= m_Width + WidthOffset) && (e.mousePosition.y >= HeightOffset && e.mousePosition.y <= m_Height + HeightOffset))
            {
                m_LastMousePos = e.mousePosition;
                SteamHTMLSurface.MouseMove(m_HHTMLBrowser, (int)(e.mousePosition.x - WidthOffset), (int)(e.mousePosition.y - HeightOffset));
            }
        }

        //virtual void MouseDoubleClick( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) = 0; //TODO
        switch (e.type)
        {
        case EventType.MouseDown:
            SteamHTMLSurface.MouseDown(m_HHTMLBrowser, (EHTMLMouseButton)e.button);
            break;

        case EventType.MouseUp:
            SteamHTMLSurface.MouseUp(m_HHTMLBrowser, (EHTMLMouseButton)e.button);
            break;

        case EventType.ScrollWheel:
            SteamHTMLSurface.MouseWheel(m_HHTMLBrowser, (int)(-e.delta.y * 100));
            break;

        case EventType.KeyDown:
            //print("KeyDown: " + e.keyCode + " - " + (int)e.character + " - " + e.character);
            EHTMLKeyModifiers modifiers = EHTMLKeyModifiers.k_eHTMLKeyModifier_None;
            if (e.alt)
            {
                modifiers = modifiers | EHTMLKeyModifiers.k_eHTMLKeyModifier_AltDown;
            }
            if (e.shift)
            {
                modifiers = modifiers | EHTMLKeyModifiers.k_eHTMLKeyModifier_ShiftDown;
            }
            if (e.control)
            {
                modifiers = modifiers | EHTMLKeyModifiers.k_eHTMLKeyModifier_CtrlDown;
            }

            if (e.keyCode != KeyCode.None)
            {
                SteamHTMLSurface.KeyDown(m_HHTMLBrowser, (uint)e.keyCode, modifiers);
            }
            if (e.character != 0)
            {
                SteamHTMLSurface.KeyChar(m_HHTMLBrowser, (uint)e.character, modifiers);
            }

            if (e.keyCode == KeyCode.DownArrow)
            {
                m_VeritcalScrollCurrent = System.Math.Min(m_VeritcalScrollCurrent + 100, m_VerticalScrollMax);
                SteamHTMLSurface.SetVerticalScroll(m_HHTMLBrowser, m_VeritcalScrollCurrent);
            }
            else if (e.keyCode == KeyCode.UpArrow)
            {
                if (m_VeritcalScrollCurrent - 100 > m_VeritcalScrollCurrent)                         // Underflow
                {
                    m_VeritcalScrollCurrent = 0;
                }
                else
                {
                    m_VeritcalScrollCurrent -= 100;
                }
                SteamHTMLSurface.SetVerticalScroll(m_HHTMLBrowser, m_VeritcalScrollCurrent);
            }
            else if (e.keyCode == KeyCode.RightArrow)
            {
                m_HorizontalScrollCurrent = System.Math.Min(m_HorizontalScrollCurrent + 100, m_HorizontalScrollMax);
                SteamHTMLSurface.SetHorizontalScroll(m_HHTMLBrowser, m_HorizontalScrollCurrent);
            }
            else if (e.keyCode == KeyCode.LeftArrow)
            {
                if (m_HorizontalScrollCurrent - 100 > m_HorizontalScrollCurrent)                         // Underflow
                {
                    m_HorizontalScrollCurrent = 0;
                }
                else
                {
                    m_HorizontalScrollCurrent -= 100;
                }
                SteamHTMLSurface.SetHorizontalScroll(m_HHTMLBrowser, m_HorizontalScrollCurrent);
            }
            break;

        case EventType.KeyUp:
            //print("KeyUp: " + e.keyCode + " - " + (int)e.character + " - " + e.character);
            modifiers = EHTMLKeyModifiers.k_eHTMLKeyModifier_None;
            if (e.alt)
            {
                modifiers = modifiers | EHTMLKeyModifiers.k_eHTMLKeyModifier_AltDown;
            }
            if (e.shift)
            {
                modifiers = modifiers | EHTMLKeyModifiers.k_eHTMLKeyModifier_ShiftDown;
            }
            if (e.control)
            {
                modifiers = modifiers | EHTMLKeyModifiers.k_eHTMLKeyModifier_CtrlDown;
            }

            if (e.keyCode != KeyCode.None)
            {
                SteamHTMLSurface.KeyUp(m_HHTMLBrowser, (uint)e.keyCode, modifiers);
            }
            break;
        }
    }
        }                                                                                                                                                                                   // 0x000000018079EB40-0x000000018079EBD0

        public static void KeyUp(HHTMLBrowser unBrowserHandle, uint nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers)
        {
        }                                                                                                                           // 0x000000018079EBD0-0x000000018079EC50
Exemplo n.º 10
0
        }                                                                                  // 0x000000018079EFA0-0x000000018079F000

        public static void KeyDown(HHTMLBrowser unBrowserHandle, uint nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers, bool bIsSystemKey = false /* Metadata: 0x00652CB3 */)
        {
        }                                                                                                                                                                                   // 0x000000018079EB40-0x000000018079EBD0
Exemplo n.º 11
0
 ///  cUnicodeChar is the unicode character point for this keypress (and potentially multiple chars per press)
 public static void KeyChar(HHTMLBrowser unBrowserHandle, uint cUnicodeChar, EHTMLKeyModifiers eHTMLKeyModifiers)
 {
 }
Exemplo n.º 12
0
 public static void KeyUp(HHTMLBrowser unBrowserHandle, uint nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers)
 {
 }
Exemplo n.º 13
0
 ///  keyboard interactions, native keycode is the virtual key code value from your OS, system key flags the key to not
 ///  be sent as a typed character as well as a key down
 public static void KeyDown(HHTMLBrowser unBrowserHandle, uint nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers, bool bIsSystemKey = false)
 {
 }