示例#1
0
    public void RenderOnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height));
        GUILayout.Label("Variables:");
        GUILayout.Label("m_Image:");
        GUILayout.Label(m_Image);
        GUILayout.EndArea();

        GUILayout.Label("SteamUtils.GetSecondsSinceAppActive() : " + SteamUtils.GetSecondsSinceAppActive());
        GUILayout.Label("SteamUtils.GetSecondsSinceComputerActive() : " + SteamUtils.GetSecondsSinceComputerActive());
        GUILayout.Label("SteamUtils.GetConnectedUniverse() : " + SteamUtils.GetConnectedUniverse());
        GUILayout.Label("SteamUtils.GetServerRealTime() : " + SteamUtils.GetServerRealTime());
        GUILayout.Label("SteamUtils.GetIPCountry() : " + SteamUtils.GetIPCountry());

        {
            uint ImageWidth  = 0;
            uint ImageHeight = 0;
            bool ret         = SteamUtils.GetImageSize(1, out ImageWidth, out ImageHeight);
            GUILayout.Label("SteamUtils.GetImageSize(1, out ImageWidth, out ImageHeight) : " + ret + " -- " + ImageWidth + " -- " + ImageHeight);

            if (GUILayout.Button("SteamUtils.GetImageRGBA(1, Image, (int)(ImageWidth * ImageHeight * 4)"))
            {
                if (ImageWidth > 0 && ImageHeight > 0)
                {
                    byte[] Image = new byte[ImageWidth * ImageHeight * 4];
                    ret = SteamUtils.GetImageRGBA(1, Image, (int)(ImageWidth * ImageHeight * 4));
                    print("SteamUtils.GetImageRGBA(1, " + Image + ", " + (int)(ImageWidth * ImageHeight * 4) + ") - " + ret + " -- " + ImageWidth + " -- " + ImageHeight);
                    if (ret)
                    {
                        m_Image = new Texture2D((int)ImageWidth, (int)ImageHeight, TextureFormat.RGBA32, false, true);
                        m_Image.LoadRawTextureData(Image);
                        m_Image.Apply();
                    }
                }
            }
        }

        {
            uint   IP;
            ushort Port;
            bool   ret = SteamUtils.GetCSERIPPort(out IP, out Port);
            GUILayout.Label("SteamUtils.GetCSERIPPort(out IP, out Port) : " + ret + " -- " + IP + " -- " + Port);
        }

        GUILayout.Label("SteamUtils.GetCurrentBatteryPower() : " + SteamUtils.GetCurrentBatteryPower());
        GUILayout.Label("SteamUtils.GetAppID() : " + SteamUtils.GetAppID());

        if (GUILayout.Button("SteamUtils.SetOverlayNotificationPosition(k_EPositionTopRight)"))
        {
            SteamUtils.SetOverlayNotificationPosition(ENotificationPosition.k_EPositionTopRight);
            print("SteamUtils.SetOverlayNotificationPosition(k_EPositionTopRight)");
        }

        //GUILayout.Label("SteamUtils.IsAPICallCompleted() : " + SteamUtils.IsAPICallCompleted()); // N/A - These 3 functions are used to dispatch CallResults.
        //GUILayout.Label("SteamUtils.GetAPICallFailureReason() : " + SteamUtils.GetAPICallFailureReason()); // N/A
        //GUILayout.Label("SteamUtils.GetAPICallResult() : " + SteamUtils.GetAPICallResult()); // N/A

        if (GUILayout.Button("SteamUtils.RunFrame()"))
        {
            SteamUtils.RunFrame();
            print("SteamUtils.RunFrame()");
        }

        GUILayout.Label("SteamUtils.GetIPCCallCount() : " + SteamUtils.GetIPCCallCount());

        //GUILayout.Label("SteamUtils.SetWarningMessageHook() : " + SteamUtils.SetWarningMessageHook()); // N/A - Check out SteamTest.cs for example usage.

        GUILayout.Label("SteamUtils.IsOverlayEnabled() : " + SteamUtils.IsOverlayEnabled());
        GUILayout.Label("SteamUtils.BOverlayNeedsPresent() : " + SteamUtils.BOverlayNeedsPresent());

        if (GUILayout.Button("SteamUtils.CheckFileSignature(\"FileNotFound.txt\")"))
        {
            SteamAPICall_t handle = SteamUtils.CheckFileSignature("FileNotFound.txt");
            OnCheckFileSignatureCallResult.Set(handle);
            print("SteamUtils.CheckFileSignature(\"FileNotFound.txt\") - " + handle);
        }

        if (GUILayout.Button("SteamUtils.ShowGamepadTextInput(k_EGamepadTextInputModeNormal, k_EGamepadTextInputLineModeSingleLine, \"Description Test!\", 32)"))
        {
            bool ret = SteamUtils.ShowGamepadTextInput(EGamepadTextInputMode.k_EGamepadTextInputModeNormal, EGamepadTextInputLineMode.k_EGamepadTextInputLineModeSingleLine, "Description Test!", 32, "test");
            print("SteamUtils.ShowGamepadTextInput(k_EGamepadTextInputModeNormal, k_EGamepadTextInputLineModeSingleLine, \"Description Test!\", 32) - " + ret);
        }

        // Only called from within GamepadTextInputDismissed_t Callback!

        /*GUILayout.Label("SteamUtils.GetEnteredGamepadTextLength() : " + SteamUtils.GetEnteredGamepadTextLength());
         *
         * {
         *      string Text;
         *      bool ret = SteamUtils.GetEnteredGamepadTextInput(out Text, 32);
         *      GUILayout.Label("SteamUtils.GetEnteredGamepadTextInput(out Text, 32) - " + ret + " -- " + Text);
         * }*/

        GUILayout.Label("SteamUtils.GetSteamUILanguage() : " + SteamUtils.GetSteamUILanguage());

        GUILayout.Label("SteamUtils.IsSteamRunningInVR() : " + SteamUtils.IsSteamRunningInVR());

        if (GUILayout.Button("SteamUtils.SetOverlayNotificationInset(400, 400)"))
        {
            SteamUtils.SetOverlayNotificationInset(400, 400);
            print("SteamUtils.SetOverlayNotificationInset(400, 400)");
        }
    }
示例#2
0
 /// <summary>
 /// <para>Checks if the Overlay needs a present. Only required if using event driven render updates.</para>
 /// <para>Typically this call is unneeded if your game has a constantly running frame loop that calls the D3D Present API, or OGL SwapBuffers API every frame as is the case in most games. However, if you have a game that only refreshes the screen on an event driven basis then that can break the overlay, as it uses your Present/SwapBuffers calls to drive it's internal frame loop and it may also need to Present() to the screen any time a notification happens or when the overlay is brought up over the game by a user. You can use this API to ask the overlay if it currently need a present in that case, and then you can check for this periodically (roughly 33hz is desirable) and make sure you refresh the screen with Present or SwapBuffers to allow the overlay to do it's work.</para>
 /// <a href="https://partner.steamgames.com/doc/api/ISteamUtils#BOverlayNeedsPresent">https://partner.steamgames.com/doc/api</a>
 /// </summary>
 /// <returns></returns>
 public static bool OverlayNeedsPresent()
 {
     return(SteamUtils.BOverlayNeedsPresent());
 }
示例#3
0
    public void RenderOnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height));
        GUILayout.Label("Variables:");
        GUILayout.Label("m_Image:");
        GUILayout.Label(m_Image);
        GUILayout.Label("m_FilterTextInputMessage:");
        m_FilterTextInputMessage = GUILayout.TextField(m_FilterTextInputMessage, 40);
        GUILayout.EndArea();

        GUILayout.BeginVertical("box");
        m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(Screen.width - 215), GUILayout.Height(Screen.height - 33));

        GUILayout.Label("GetSecondsSinceAppActive() : " + SteamUtils.GetSecondsSinceAppActive());

        GUILayout.Label("GetSecondsSinceComputerActive() : " + SteamUtils.GetSecondsSinceComputerActive());

        GUILayout.Label("GetConnectedUniverse() : " + SteamUtils.GetConnectedUniverse());

        GUILayout.Label("GetServerRealTime() : " + SteamUtils.GetServerRealTime());

        GUILayout.Label("GetIPCountry() : " + SteamUtils.GetIPCountry());

        {
            uint ImageWidth  = 0;
            uint ImageHeight = 0;
            bool ret         = SteamUtils.GetImageSize(1, out ImageWidth, out ImageHeight);
            GUILayout.Label("SteamUtils.GetImageSize(1, out ImageWidth, out ImageHeight) : " + ret + " -- " + ImageWidth + " -- " + ImageHeight);

            if (GUILayout.Button("SteamUtils.GetImageRGBA(1, Image, (int)(ImageWidth * ImageHeight * 4)"))
            {
                if (ImageWidth > 0 && ImageHeight > 0)
                {
                    byte[] Image = new byte[ImageWidth * ImageHeight * 4];
                    ret = SteamUtils.GetImageRGBA(1, Image, (int)(ImageWidth * ImageHeight * 4));
                    print("SteamUtils.GetImageRGBA(1, " + Image + ", " + (int)(ImageWidth * ImageHeight * 4) + ") - " + ret + " -- " + ImageWidth + " -- " + ImageHeight);
                    if (ret)
                    {
                        m_Image = new Texture2D((int)ImageWidth, (int)ImageHeight, TextureFormat.RGBA32, false, true);
                        m_Image.LoadRawTextureData(Image);
                        m_Image.Apply();
                    }
                }
            }
        }

        {
            uint   IP;
            ushort Port;
            bool   ret = SteamUtils.GetCSERIPPort(out IP, out Port);
            GUILayout.Label("GetCSERIPPort(out IP, out Port) : " + ret + " -- " + IP + " -- " + Port);
        }

        GUILayout.Label("GetCurrentBatteryPower() : " + SteamUtils.GetCurrentBatteryPower());

        GUILayout.Label("GetAppID() : " + SteamUtils.GetAppID());

        if (GUILayout.Button("SetOverlayNotificationPosition(ENotificationPosition.k_EPositionTopRight)"))
        {
            SteamUtils.SetOverlayNotificationPosition(ENotificationPosition.k_EPositionTopRight);
            print("SteamUtils.SetOverlayNotificationPosition(" + ENotificationPosition.k_EPositionTopRight + ")");
        }

        //GUILayout.Label("SteamUtils.IsAPICallCompleted() : " + SteamUtils.IsAPICallCompleted()); // N/A - These 3 functions are used to dispatch CallResults.

        //GUILayout.Label("SteamUtils.GetAPICallFailureReason() : " + SteamUtils.GetAPICallFailureReason()); // N/A

        //GUILayout.Label("SteamUtils.GetAPICallResult() : " + SteamUtils.GetAPICallResult()); // N/A

        GUILayout.Label("GetIPCCallCount() : " + SteamUtils.GetIPCCallCount());

        //GUILayout.Label("SteamUtils.SetWarningMessageHook() : " + SteamUtils.SetWarningMessageHook()); // N/A - Check out SteamTest.cs for example usage.

        GUILayout.Label("IsOverlayEnabled() : " + SteamUtils.IsOverlayEnabled());

        GUILayout.Label("BOverlayNeedsPresent() : " + SteamUtils.BOverlayNeedsPresent());

        if (GUILayout.Button("CheckFileSignature(\"FileNotFound.txt\")"))
        {
            SteamAPICall_t handle = SteamUtils.CheckFileSignature("FileNotFound.txt");
            OnCheckFileSignatureCallResult.Set(handle);
            print("SteamUtils.CheckFileSignature(" + "\"FileNotFound.txt\"" + ") : " + handle);
        }

        if (GUILayout.Button("ShowGamepadTextInput(EGamepadTextInputMode.k_EGamepadTextInputModeNormal, EGamepadTextInputLineMode.k_EGamepadTextInputLineModeSingleLine, \"Description Test!\", 32, \"test\")"))
        {
            bool ret = SteamUtils.ShowGamepadTextInput(EGamepadTextInputMode.k_EGamepadTextInputModeNormal, EGamepadTextInputLineMode.k_EGamepadTextInputLineModeSingleLine, "Description Test!", 32, "test");
            print("SteamUtils.ShowGamepadTextInput(" + EGamepadTextInputMode.k_EGamepadTextInputModeNormal + ", " + EGamepadTextInputLineMode.k_EGamepadTextInputLineModeSingleLine + ", " + "\"Description Test!\"" + ", " + 32 + ", " + "\"test\"" + ") : " + ret);
        }

        // Only called from within GamepadTextInputDismissed_t Callback!

        /*GUILayout.Label("SteamUtils.GetEnteredGamepadTextLength() : " + SteamUtils.GetEnteredGamepadTextLength());
         *
         * {
         *      string Text;
         *      bool ret = SteamUtils.GetEnteredGamepadTextInput(out Text, 32);
         *      GUILayout.Label("SteamUtils.GetEnteredGamepadTextInput(out Text, 32) - " + ret + " -- " + Text);
         * }*/

        GUILayout.Label("GetSteamUILanguage() : " + SteamUtils.GetSteamUILanguage());

        GUILayout.Label("IsSteamRunningInVR() : " + SteamUtils.IsSteamRunningInVR());

        if (GUILayout.Button("SetOverlayNotificationInset(400, 400)"))
        {
            SteamUtils.SetOverlayNotificationInset(400, 400);
            print("SteamUtils.SetOverlayNotificationInset(" + 400 + ", " + 400 + ")");
        }

        GUILayout.Label("IsSteamInBigPictureMode() : " + SteamUtils.IsSteamInBigPictureMode());

        if (GUILayout.Button("StartVRDashboard()"))
        {
            SteamUtils.StartVRDashboard();
            print("SteamUtils.StartVRDashboard()");
        }

        GUILayout.Label("IsVRHeadsetStreamingEnabled() : " + SteamUtils.IsVRHeadsetStreamingEnabled());

        if (GUILayout.Button("SetVRHeadsetStreamingEnabled(!SteamUtils.IsVRHeadsetStreamingEnabled())"))
        {
            SteamUtils.SetVRHeadsetStreamingEnabled(!SteamUtils.IsVRHeadsetStreamingEnabled());
            print("SteamUtils.SetVRHeadsetStreamingEnabled(" + !SteamUtils.IsVRHeadsetStreamingEnabled() + ")");
        }

        GUILayout.Label("IsSteamChinaLauncher() : " + SteamUtils.IsSteamChinaLauncher());

        if (GUILayout.Button("InitFilterText()"))
        {
            bool ret = SteamUtils.InitFilterText();
            print("SteamUtils.InitFilterText() : " + ret);
        }

        if (GUILayout.Button("FilterText(out OutFilteredText, (uint)m_FilterTextInputMessage.Length, m_FilterTextInputMessage, false)"))
        {
            string OutFilteredText;
            int    ret = SteamUtils.FilterText(out OutFilteredText, (uint)m_FilterTextInputMessage.Length, m_FilterTextInputMessage, false);
            print("SteamUtils.FilterText(" + "out OutFilteredText" + ", " + (uint)m_FilterTextInputMessage.Length + ", " + m_FilterTextInputMessage + ", " + false + ") : " + ret + " -- " + OutFilteredText);
        }

        if (GUILayout.Button("GetIPv6ConnectivityState(ESteamIPv6ConnectivityProtocol.k_ESteamIPv6ConnectivityProtocol_HTTP)"))
        {
            ESteamIPv6ConnectivityState ret = SteamUtils.GetIPv6ConnectivityState(ESteamIPv6ConnectivityProtocol.k_ESteamIPv6ConnectivityProtocol_HTTP);
            print("SteamUtils.GetIPv6ConnectivityState(" + ESteamIPv6ConnectivityProtocol.k_ESteamIPv6ConnectivityProtocol_HTTP + ") : " + ret);
        }

        GUILayout.EndScrollView();
        GUILayout.EndVertical();
    }