private void ShowOrHideElements()
        {
            if (scrUIController.instance == null)
            {
                return;
            }
            scrUIController uiController = scrUIController.instance;

            bool hideEverything = Settings.HideEverything;
            bool hideOtto       = hideEverything || Settings.HideOtto;
            bool hideBeta       = hideEverything || Settings.HideBeta;
            bool hideTitle      = hideEverything || Settings.HideTitle;

            hideEverything &= AdofaiTweaks.IsEnabled && Settings.IsEnabled;
            hideOtto       &= AdofaiTweaks.IsEnabled && Settings.IsEnabled;
            hideBeta       &= AdofaiTweaks.IsEnabled && Settings.IsEnabled;
            hideTitle      &= AdofaiTweaks.IsEnabled && Settings.IsEnabled;

            RDC.noHud = hideEverything;

            scnEditor editor = Object.FindObjectOfType <scnEditor>();

            if (scrController.instance.isEditingLevel)
            {
                if (editor?.ottoCanvas.gameObject.activeSelf == hideOtto)
                {
                    editor.ottoCanvas.gameObject.SetActive(!hideOtto);
                }
            }
            else
            {
                uiController.difficultyImage.enabled = !hideOtto;
                if (uiController.difficultyContainer.gameObject.activeSelf == hideOtto)
                {
                    uiController.difficultyContainer.gameObject.SetActive(!hideOtto);
                }
                if (uiController.difficultyFadeContainer.gameObject.activeSelf == hideOtto)
                {
                    uiController.difficultyFadeContainer.gameObject.SetActive(!hideOtto);
                }
            }

            if (SteamAPI.Init())
            {
                bool            isBeta       = SteamApps.GetCurrentBetaName(out _, 20);
                scrEnableIfBeta enableIfBeta =
                    Resources.FindObjectsOfTypeAll <scrEnableIfBeta>().FirstOrDefault();
                if (isBeta && enableIfBeta && enableIfBeta.gameObject.activeSelf == hideBeta)
                {
                    enableIfBeta.gameObject.SetActive(!hideBeta);
                }
            }

            if (uiController.txtLevelName.gameObject.activeSelf == hideTitle)
            {
                uiController.txtLevelName.gameObject.SetActive(!hideTitle);
            }
        }
Exemple #2
0
    // Token: 0x06000C52 RID: 3154 RVA: 0x0004D472 File Offset: 0x0004B672
    private IEnumerator Start()
    {
        yield return(new WaitForEndOfFrame());

        if (this.storeSDKType == StoreSDKManager.StoreSDKType.steam)
        {
            if (SteamApps.BIsCybercafe())
            {
                this.storeBranchType = StoreSDKManager.StoreBranchType.youtube;
            }
            string a = "public";
            if (SteamApps.GetCurrentBetaName(out a, 20))
            {
                if (a == "beta")
                {
                    this.storeBranchType = StoreSDKManager.StoreBranchType.beta;
                }
                else if (a == "youtube")
                {
                    this.storeBranchType = StoreSDKManager.StoreBranchType.youtube;
                }
                else if (a == "developer")
                {
                    this.storeBranchType = StoreSDKManager.StoreBranchType.developer;
                }
                else
                {
                    this.storeBranchType = StoreSDKManager.StoreBranchType.normal;
                }
            }
            if (Application.isEditor)
            {
                this.storeBranchType = this.storeBranchEditorOverride;
            }
            if (SteamUser.GetSteamID().m_SteamID.ToString() == "76561198366613395")
            {
                PlayerPrefs.SetInt("isCrackedVersion", 1);
                PhotonNetwork.offlineMode = true;
                PlayerPrefs.SetString("ErrorMessage", "Please consider purchasing the game to help with server costs.");
                this.errorScreen.SetActive(true);
                this.mainManager.gameObject.SetActive(false);
            }
            else if (PlayerPrefs.HasKey("isCrackedVersion"))
            {
                PlayerPrefs.SetInt("isCrackedVersion", 0);
            }
        }
        PlayerPrefs.SetInt("isYoutuberVersion", (this.storeBranchType == StoreSDKManager.StoreBranchType.youtube || this.storeBranchType == StoreSDKManager.StoreBranchType.developer) ? 1 : 0);
        PlayerPrefs.SetInt("isDeveloperVersion", (this.storeBranchType == StoreSDKManager.StoreBranchType.developer) ? 1 : 0);
        this.storeManager.StartStore();
        this.mainManager.SetPlayerName();
        Debug.Log("Connecting to server version: " + this.serverVersion + this.storeBranchType.ToString());
        yield break;
    }
Exemple #3
0
        public override void OnEnter()
        {
            userOnBeta.Value = (SteamApps.GetCurrentBetaName(out betaN, (int)MaxNameLenght.Value));
            if (userOnBeta.Value)
            {
                betaName.Value = betaN;
                Fsm.Event(isOnBeta);
            }
            else
            {
                Fsm.Event(isNotOnBeta);
            }

            Finish();
        }
Exemple #4
0
    private void Awake()
    {
        if (SteamManager.s_instance != null)
        {
            UnityEngine.Object.Destroy(base.gameObject);
            return;
        }
        SteamManager.s_instance = this;
        UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
        if (!Packsize.Test())
        {
            Debug.LogError("[Steamworks.NET] Packsize Test returned false, the wrong version of Steamworks.NET is being run in this platform.", this);
        }
        if (!DllCheck.Test())
        {
            Debug.LogError("[Steamworks.NET] DllCheck Test returned false, One or more of the Steamworks binaries seems to be the wrong version.", this);
        }
        try
        {
            if (SteamAPI.RestartAppIfNecessary(SteamManager.AppId))
            {
                Application.Quit();
                return;
            }
        }
        catch (DllNotFoundException arg)
        {
            Debug.LogError("[Steamworks.NET] Could not load [lib]steam_api.dll/so/dylib. It's likely not in the correct location. Refer to the README for more details.\n" + arg, this);
            Application.Quit();
            return;
        }
        this.m_bInitialized = SteamAPI.Init();
        if (!this.m_bInitialized)
        {
            Debug.LogError("[Steamworks.NET] SteamAPI_Init() failed. Refer to Valve's documentation or the comment above this line for more information.", this);
            return;
        }
        SteamManager.BuildId = SteamApps.GetAppBuildId();
        string betaName;

        if (SteamApps.GetCurrentBetaName(out betaName, 50))
        {
            SteamManager.BetaName = betaName;
        }
        Debug.Log("Steam Started");
        CoopSteamManager.Initialize();
    }
Exemple #5
0
        public new void Init(MySteamService.Parameters configuration)
#endif
        {
            var steam = typeof(MySteamServiceBase);

#if !SE
            // Do MyGameService.Init()
            typeof(MyGameService).GetField("m_serviceStaticRef", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static).SetValue(this, this);
            var isDedicated = configuration.Server;
            var appId       = configuration.AppId;
            steam.GetProperty("Static").GetSetMethod(true).Invoke(this, new object[] { this });
            steam.GetField("SteamAppId", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).SetValue(this, (Steamworks.AppId_t)appId);
#endif
            // TODO: Add protection for this mess... somewhere
            GameServer?.Shutdown();
            steam.GetField("m_gameServer", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).SetValue(this, null);
            steam.GetProperty("AppId").GetSetMethod(true).Invoke(this, new object[] { appId });

            if (isDedicated)
            {
                steam.GetProperty("SteamServerAPI").GetSetMethod(true).Invoke(this, new object[] { null });
                steam.GetField("m_gameServer").SetValue(this, new VRage.Steam.MySteamGameServer());

                var method = typeof(MySteamServiceBase).GetMethod("OnModServerDownloaded", System.Reflection.BindingFlags.NonPublic);
                var del    = method.CreateDelegate <Callback <DownloadItemResult_t> .DispatchDelegate>(this);
                steam.GetField("m_modServerDownload").SetValue(this, Callback <DownloadItemResult_t> .CreateGameServer(new Callback <DownloadItemResult_t> .DispatchDelegate(del)));
            }
            else
            {
#if !SE
                var cur = System.IO.Directory.GetCurrentDirectory();
#endif
                // Steam API doesn't initialize correctly if it can't find steam_appid.txt
                // Why is ME different now?
                if (!System.IO.File.Exists("steam_appid.txt"))
                {
                    System.IO.Directory.SetCurrentDirectory("..");
                }

                steam.GetProperty("IsActive").GetSetMethod(true).Invoke(this, new object[] { SteamAPI.Init() });
#if !SE
                System.IO.Directory.SetCurrentDirectory(cur);
#endif

                if (IsActive)
                {
                    steam.GetField("SteamUserId", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).SetValue(this, SteamUser.GetSteamID());
                    steam.GetProperty("UserId").GetSetMethod(true).Invoke(this, new object[] { (ulong)SteamUser.GetSteamID() });
                    steam.GetProperty("UserName").GetSetMethod(true).Invoke(this, new object[] { SteamFriends.GetPersonaName() });
                    steam.GetProperty("OwnsGame").GetSetMethod(true).Invoke(this, new object[] {
                        SteamUser.UserHasLicenseForApp(SteamUser.GetSteamID(), (AppId_t)appId) == EUserHasLicenseForAppResult.k_EUserHasLicenseResultHasLicense
                    });
                    steam.GetProperty("UserUniverse").GetSetMethod(true).Invoke(this, new object[] { (MyGameServiceUniverse)SteamUtils.GetConnectedUniverse() });

                    string pchName;
                    steam.GetProperty("BranchName").GetSetMethod(true).Invoke(this, new object[] { SteamApps.GetCurrentBetaName(out pchName, 512) ? pchName : "default" });

                    SteamUserStats.RequestCurrentStats();

                    steam.GetProperty("InventoryAPI").GetSetMethod(true).Invoke(this, new object[] { new VRage.Steam.MySteamInventory() });

                    steam.GetMethod("RegisterCallbacks",
                                    System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)
                    .Invoke(this, null);

#if SE
                    steam.GetField("m_remoteStorage", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).SetValue(this, new VRage.Steam.MySteamRemoteStorage());
#endif
                }
            }

            steam.GetProperty("Peer2Peer").GetSetMethod(true).Invoke(this, new object[] { new VRage.Steam.MySteamPeer2Peer() });
        }
    private void Start()
    {
        if (!Packsize.Test())
        {
            Debug.LogError("[Steamworks.NET] Packsize Test returned false, the wrong version of Steamworks.NET is being run in this platform.", this);
        }
        if (!DllCheck.Test())
        {
            Debug.LogError("[Steamworks.NET] DllCheck Test returned false, One or more of the Steamworks binaries seems to be the wrong version.", this);
        }
        try
        {
            if (SteamAPI.RestartAppIfNecessary(SteamDSConfig.AppIdDS))
            {
                Application.Quit();
                return;
            }
        }
        catch (DllNotFoundException arg)
        {
            Debug.LogError("[Steamworks.NET] Could not load [lib]steam_api.dll/so/dylib. It's likely not in the correct location. Refer to the README for more details.\n" + arg, this);
            Application.Quit();
            return;
        }
        this.m_bInitialized = SteamAPI.Init();
        if (!this.m_bInitialized)
        {
            Debug.LogError("[Steamworks.NET] SteamAPI_Init() failed. Refer to Valve's documentation or the comment above this line for more information.", this);
            return;
        }
        SteamConfig.BuildId = SteamApps.GetAppBuildId();
        string betaName;

        if (SteamApps.GetCurrentBetaName(out betaName, 50))
        {
            SteamConfig.BetaName = betaName;
        }
        Debug.Log("Steam Started");
        this.m_CallbackSteamServersConnected = Callback <SteamServersConnected_t> .CreateGameServer(new Callback <SteamServersConnected_t> .DispatchDelegate(this.OnSteamServersConnected));

        this.m_CallbackSteamServersConnectFailure = Callback <SteamServerConnectFailure_t> .CreateGameServer(new Callback <SteamServerConnectFailure_t> .DispatchDelegate(this.OnSteamServersConnectFailure));

        this.m_CallbackSteamServersDisconnected = Callback <SteamServersDisconnected_t> .CreateGameServer(new Callback <SteamServersDisconnected_t> .DispatchDelegate(this.OnSteamServersDisconnected));

        this.m_CallbackPolicyResponse = Callback <GSPolicyResponse_t> .CreateGameServer(new Callback <GSPolicyResponse_t> .DispatchDelegate(this.OnPolicyResponse));

        this.m_CallbackGSAuthTicketResponse = Callback <ValidateAuthTicketResponse_t> .CreateGameServer(new Callback <ValidateAuthTicketResponse_t> .DispatchDelegate(this.OnValidateAuthTicketResponse));

        this.m_CallbackP2PSessionRequest = Callback <P2PSessionRequest_t> .CreateGameServer(new Callback <P2PSessionRequest_t> .DispatchDelegate(this.OnP2PSessionRequest));

        this.m_CallbackP2PSessionConnectFail = Callback <P2PSessionConnectFail_t> .CreateGameServer(new Callback <P2PSessionConnectFail_t> .DispatchDelegate(this.OnP2PSessionConnectFail));

        this.m_bInitialized      = false;
        this.m_bConnectedToSteam = false;
        EServerMode eServerMode = EServerMode.eServerModeAuthenticationAndSecure;

        this.m_bInitialized = GameServer.Init(0u, SteamDSConfig.ServerSteamPort, SteamDSConfig.ServerGamePort, SteamDSConfig.ServerQueryPort, eServerMode, SteamDSConfig.ServerVersion);
        if (!this.m_bInitialized)
        {
            Debug.Log("SteamGameServer_Init call failed");
            return;
        }
        SteamGameServer.SetModDir("theforestDS");
        SteamGameServer.SetProduct("The Forest");
        SteamGameServer.SetGameDescription("The Forest Game Description");
        SteamGameServer.LogOnAnonymous();
        SteamGameServer.EnableHeartbeats(true);
        Debug.Log("Started.");
    }
    public void RenderOnGUI()
    {
        GUILayout.Label("SteamApps.BIsSubscribed() : " + SteamApps.BIsSubscribed());
        GUILayout.Label("SteamApps.BIsLowViolence() : " + SteamApps.BIsLowViolence());
        GUILayout.Label("SteamApps.BIsCybercafe() : " + SteamApps.BIsCybercafe());
        GUILayout.Label("SteamApps.BIsVACBanned() : " + SteamApps.BIsVACBanned());
        GUILayout.Label("SteamApps.GetCurrentGameLanguage() : " + SteamApps.GetCurrentGameLanguage());
        GUILayout.Label("SteamApps.GetAvailableGameLanguages() : " + SteamApps.GetAvailableGameLanguages());
        GUILayout.Label("SteamApps.BIsSubscribedApp(SteamUtils.GetAppID()) : " + SteamApps.BIsSubscribedApp(SteamUtils.GetAppID()));
        GUILayout.Label("SteamApps.BIsDlcInstalled(110902) : " + SteamApps.BIsDlcInstalled((AppId_t)110902));         // pieterw test DLC
        GUILayout.Label("SteamApps.GetEarliestPurchaseUnixTime(SteamUtils.GetAppID()) : " + SteamApps.GetEarliestPurchaseUnixTime(SteamUtils.GetAppID()));
        GUILayout.Label("SteamApps.BIsSubscribedFromFreeWeekend() : " + SteamApps.BIsSubscribedFromFreeWeekend());
        GUILayout.Label("SteamApps.GetDLCCount() : " + SteamApps.GetDLCCount());

        for (int iDLC = 0; iDLC < SteamApps.GetDLCCount(); ++iDLC)
        {
            AppId_t AppID;
            bool    Available;
            string  Name;
            bool    ret = SteamApps.BGetDLCDataByIndex(iDLC, out AppID, out Available, out Name, 128);
            GUILayout.Label("SteamApps.BGetDLCDataByIndex(" + iDLC + ", out AppID, out Available, out Name, 128) : " + ret + " -- " + AppID + " -- " + Available + " -- " + Name);
        }

        if (GUILayout.Button("SteamApps.InstallDLC(110902)"))
        {
            SteamApps.InstallDLC((AppId_t)110902);             // pieterw test DLC
        }

        if (GUILayout.Button("SteamApps.UninstallDLC(110902)"))
        {
            SteamApps.UninstallDLC((AppId_t)110902);             // pieterw test DLC
        }

        if (GUILayout.Button("SteamApps.RequestAppProofOfPurchaseKey(SteamUtils.GetAppID())"))
        {
            SteamApps.RequestAppProofOfPurchaseKey(SteamUtils.GetAppID());
        }

        {
            string Name;
            bool   ret = SteamApps.GetCurrentBetaName(out Name, 128);
            if (Name == null)
            {
                Name = "";
            }
            GUILayout.Label("SteamApps.GetCurrentBetaName(out Name, 128) : " + ret + " -- " + Name);
        }

        if (GUILayout.Button("SteamApps.MarkContentCorrupt(true)"))
        {
            print("SteamApps.MarkContentCorrupt(true) : " + SteamApps.MarkContentCorrupt(true));
        }

        if (GUILayout.Button("SteamApps.GetInstalledDepots(SteamUtils.GetAppID(), Depots, 32)"))
        {
            DepotId_t[] Depots = new DepotId_t[32];
            uint        ret    = SteamApps.GetInstalledDepots(SteamUtils.GetAppID(), Depots, 32);
            for (int i = 0; i < ret; ++i)
            {
                print("SteamApps.GetInstalledDepots(SteamUtils.GetAppID(), Depots, 32) : " + ret + " -- #" + i + " -- " + Depots[i]);
            }
        }

        {
            string Folder;
            uint   ret = SteamApps.GetAppInstallDir(SteamUtils.GetAppID(), out Folder, 260);
            if (Folder == null)
            {
                Folder = "";
            }

            GUILayout.Label("SteamApps.GetAppInstallDir(480, out Folder, 260) : " + ret + " -- " + Folder);
        }

        GUILayout.Label("SteamApps.BIsAppInstalled(480) : " + SteamApps.BIsAppInstalled(SteamUtils.GetAppID()));
        GUILayout.Label("SteamApps.GetAppOwner() : " + SteamApps.GetAppOwner());

        // Run the test and then use steam://run/480//?test=testing;param2=value2; in your browser to try this out
        GUILayout.Label("SteamApps.GetLaunchQueryParam(\"test\") : " + SteamApps.GetLaunchQueryParam("test"));

        {
            ulong BytesDownloaded;
            ulong BytesTotal;
            bool  ret = SteamApps.GetDlcDownloadProgress((AppId_t)110902, out BytesDownloaded, out BytesTotal);
            GUILayout.Label("SteamApps.GetDlcDownloadProgress((AppId_t)110902, out BytesDownloaded, out BytesTotal): " + ret + " -- " + BytesDownloaded + " -- " + BytesTotal);
        }

        GUILayout.Label("SteamApps.GetAppBuildId(): " + SteamApps.GetAppBuildId());
#if _PS3
        if (GUILayout.Button("SteamApps.RegisterActivationCode(\"???\")"))
        {
            SteamAPICall_t handle = SteamApps.RegisterActivationCode("???");
            new CallResult <RegisterActivationCodeResponse_t>(OnRegisterActivationCodeResponse, handle);
            new CallResult <AppProofOfPurchaseKeyResponse_t>(OnAppProofOfPurchaseKeyResponse, handle);
        }
#endif
    }
Exemple #8
0
    public void RenderOnGUI()
    {
        GUILayout.BeginVertical("box");
        m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(Screen.width - 215), GUILayout.Height(Screen.height - 33));

        GUILayout.Label("BIsSubscribed() : " + SteamApps.BIsSubscribed());

        GUILayout.Label("BIsLowViolence() : " + SteamApps.BIsLowViolence());

        GUILayout.Label("BIsCybercafe() : " + SteamApps.BIsCybercafe());

        GUILayout.Label("BIsVACBanned() : " + SteamApps.BIsVACBanned());

        GUILayout.Label("GetCurrentGameLanguage() : " + SteamApps.GetCurrentGameLanguage());

        GUILayout.Label("GetAvailableGameLanguages() : " + SteamApps.GetAvailableGameLanguages());

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

        GUILayout.Label("BIsDlcInstalled(TestConstants.Instance.k_AppId_PieterwTestDLC) : " + SteamApps.BIsDlcInstalled(TestConstants.Instance.k_AppId_PieterwTestDLC));

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

        GUILayout.Label("BIsSubscribedFromFreeWeekend() : " + SteamApps.BIsSubscribedFromFreeWeekend());

        GUILayout.Label("GetDLCCount() : " + SteamApps.GetDLCCount());

        for (int iDLC = 0; iDLC < SteamApps.GetDLCCount(); ++iDLC)
        {
            AppId_t AppID;
            bool    Available;
            string  Name;
            bool    ret = SteamApps.BGetDLCDataByIndex(iDLC, out AppID, out Available, out Name, 128);
            GUILayout.Label("BGetDLCDataByIndex(" + iDLC + ", out AppID, out Available, out Name, 128) : " + ret + " -- " + AppID + " -- " + Available + " -- " + Name);
        }

        if (GUILayout.Button("InstallDLC(TestConstants.Instance.k_AppId_PieterwTestDLC)"))
        {
            SteamApps.InstallDLC(TestConstants.Instance.k_AppId_PieterwTestDLC);
            print("SteamApps.InstallDLC(" + TestConstants.Instance.k_AppId_PieterwTestDLC + ")");
        }

        if (GUILayout.Button("UninstallDLC(TestConstants.Instance.k_AppId_PieterwTestDLC)"))
        {
            SteamApps.UninstallDLC(TestConstants.Instance.k_AppId_PieterwTestDLC);
            print("SteamApps.UninstallDLC(" + TestConstants.Instance.k_AppId_PieterwTestDLC + ")");
        }

        if (GUILayout.Button("RequestAppProofOfPurchaseKey(SteamUtils.GetAppID())"))
        {
            SteamApps.RequestAppProofOfPurchaseKey(SteamUtils.GetAppID());
            print("SteamApps.RequestAppProofOfPurchaseKey(" + SteamUtils.GetAppID() + ")");
        }

        {
            string Name;
            bool   ret = SteamApps.GetCurrentBetaName(out Name, 128);
            if (Name == null)
            {
                Name = "";
            }
            GUILayout.Label("GetCurrentBetaName(out Name, 128) : " + ret + " -- " + Name);
        }

        if (GUILayout.Button("MarkContentCorrupt(true)"))
        {
            bool ret = SteamApps.MarkContentCorrupt(true);
            print("SteamApps.MarkContentCorrupt(" + true + ") : " + ret);
        }

        if (GUILayout.Button("SteamApps.GetInstalledDepots(SteamUtils.GetAppID(), Depots, 32)"))
        {
            DepotId_t[] Depots = new DepotId_t[32];
            uint        ret    = SteamApps.GetInstalledDepots(SteamUtils.GetAppID(), Depots, 32);
            for (int i = 0; i < ret; ++i)
            {
                print("SteamApps.GetInstalledDepots(SteamUtils.GetAppID(), Depots, 32) : " + ret + " -- #" + i + " -- " + Depots[i]);
            }
        }

        {
            string Folder;
            uint   ret = SteamApps.GetAppInstallDir(SteamUtils.GetAppID(), out Folder, 260);
            if (Folder == null)
            {
                Folder = "";
            }
            GUILayout.Label("GetAppInstallDir(SteamUtils.GetAppID(), out Folder, 260) : " + ret + " -- " + Folder);
        }

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

        GUILayout.Label("GetAppOwner() : " + SteamApps.GetAppOwner());

        {
            // Run the test and then use steam://run/480//?test=testing;param2=value2; in your browser to try this out
            string ret = SteamApps.GetLaunchQueryParam("test");
            GUILayout.Label("GetLaunchQueryParam(\"test\") : " + ret);
        }

        {
            ulong BytesDownloaded;
            ulong BytesTotal;
            bool  ret = SteamApps.GetDlcDownloadProgress(TestConstants.Instance.k_AppId_PieterwTestDLC, out BytesDownloaded, out BytesTotal);
            GUILayout.Label("GetDlcDownloadProgress(TestConstants.Instance.k_AppId_PieterwTestDLC, out BytesDownloaded, out BytesTotal) : " + ret + " -- " + BytesDownloaded + " -- " + BytesTotal);
        }

        GUILayout.Label("GetAppBuildId() : " + SteamApps.GetAppBuildId());

        if (GUILayout.Button("RequestAllProofOfPurchaseKeys()"))
        {
            SteamApps.RequestAllProofOfPurchaseKeys();
            print("SteamApps.RequestAllProofOfPurchaseKeys()");
        }

        if (GUILayout.Button("GetFileDetails(\"steam_api.dll\")"))
        {
            SteamAPICall_t handle = SteamApps.GetFileDetails("steam_api.dll");
            OnFileDetailsResultCallResult.Set(handle);
            print("SteamApps.GetFileDetails(" + "\"steam_api.dll\"" + ") : " + handle);
        }

        {
            string CommandLine;
            int    ret = SteamApps.GetLaunchCommandLine(out CommandLine, 260);
            if (CommandLine == null)
            {
                CommandLine = "";
            }
            GUILayout.Label("GetLaunchCommandLine(out CommandLine, 260) : " + ret + " -- " + CommandLine);
        }

        GUILayout.Label("BIsSubscribedFromFamilySharing() : " + SteamApps.BIsSubscribedFromFamilySharing());

        GUILayout.EndScrollView();
        GUILayout.EndVertical();
    }
Exemple #9
0
        public MySteamService(bool isDedicated, uint appId)
            : base(true, appId)
        {
            // TODO: Add protection for this mess... somewhere
            GameServer.Shutdown();
            var steam = typeof(MySteamServiceBase);

            steam.GetField("m_gameServer", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).SetValue(this, null);

            steam.GetProperty("AppId").GetSetMethod(true).Invoke(this, new object[] { appId });
            if (isDedicated)
            {
                steam.GetProperty("SteamServerAPI").GetSetMethod(true).Invoke(this, new object[] { null });
                steam.GetField("m_gameServer").SetValue(this, new VRage.Steam.MySteamGameServer());

                var method = typeof(MySteamServiceBase).GetMethod("OnModServerDownloaded", System.Reflection.BindingFlags.NonPublic);
                var del    = method.CreateDelegate <Callback <DownloadItemResult_t> .DispatchDelegate>(this);
                steam.GetField("m_modServerDownload").SetValue(this, Callback <DownloadItemResult_t> .CreateGameServer(new Callback <DownloadItemResult_t> .DispatchDelegate(del)));
            }
            else
            {
                steam.GetProperty("IsActive").GetSetMethod(true).Invoke(this, new object[] { SteamAPI.Init() });

                if (IsActive)
                {
                    steam.GetField("SteamUserId", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).SetValue(this, SteamUser.GetSteamID());
                    steam.GetProperty("UserId").GetSetMethod(true).Invoke(this, new object[] { (ulong)SteamUser.GetSteamID() });
                    steam.GetProperty("UserName").GetSetMethod(true).Invoke(this, new object[] { SteamFriends.GetPersonaName() });
                    steam.GetProperty("OwnsGame").GetSetMethod(true).Invoke(this, new object[] {
                        SteamUser.UserHasLicenseForApp(SteamUser.GetSteamID(), (AppId_t)appId) == EUserHasLicenseForAppResult.k_EUserHasLicenseResultHasLicense
                    });
                    steam.GetProperty("UserUniverse").GetSetMethod(true).Invoke(this, new object[] { (MyGameServiceUniverse)SteamUtils.GetConnectedUniverse() });

                    string pchName;
                    steam.GetProperty("BranchName").GetSetMethod(true).Invoke(this, new object[] { SteamApps.GetCurrentBetaName(out pchName, 512) ? pchName : "default" });

                    SteamUserStats.RequestCurrentStats();

                    steam.GetProperty("InventoryAPI").GetSetMethod(true).Invoke(this, new object[] { new VRage.Steam.MySteamInventory() });

                    steam.GetMethod("RegisterCallbacks",
                                    System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)
                    .Invoke(this, null);

#if SE
                    steam.GetField("m_remoteStorage", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).SetValue(this, new VRage.Steam.MySteamRemoteStorage());
#endif
                }
            }

            steam.GetProperty("Peer2Peer").GetSetMethod(true).Invoke(this, new object[] { new VRage.Steam.MySteamPeer2Peer() });
        }