private void Awake() { GetWorldControllers(); BindButtons(); steamUserAvatar.sprite = Sprite.Create(GetSteamAvatar(), new Rect(new Vector2(0, 0), new Vector2(64, 64)), new Vector2(64, 64)); hudCanvasTopPanelSteamUserAvatar.sprite = Sprite.Create(GetSteamAvatar(), new Rect(new Vector2(0, 0), new Vector2(64, 64)), new Vector2(64, 64)); helperTipContainer = GetComponent <HelperTipContainer>(); RefreshHelperTips(); AudioListener.volume = userVolume; if (SteamManager.Initialized) { string name = SteamFriends.GetPersonaName(); intro_playerName.text = name; hudCanvasTopPanelUsernameText.text = name; steamBuildVersionTextNumber.text = SteamApps.GetAppBuildId().ToString(); } steamLeaderBoardTop100EntriesUIPrefabsList = new List <LeaderboardEntry>(); for (int i = 0; i < 100; i++) // prepare the leaderboard top 10 entry display prefab objects { GameObject leaderBoardEntry = Instantiate(Resources.Load("Leaderboard Entry"), LeaderboardEntriesContent.transform, false) as GameObject; int rank = 1 + i; leaderBoardEntry.GetComponent <LeaderboardEntry>().rank = rank; leaderBoardEntry.GetComponent <LeaderboardEntry>().rankText.text = rank + ")"; steamLeaderBoardTop100EntriesUIPrefabsList.Add(leaderBoardEntry.GetComponent <LeaderboardEntry>()); } EmptyItem = new Item(ItemName.NO_ITEM); tooltipOffsetVector = new Vector3(xOffsetTooltip, yOffsetTooltip, 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(); }
/// <summary> /// <para>Gets the buildid of this app, may change at any time based on backend updates to the game.</para> /// <a href="https://partner.steamgames.com/doc/api/ISteamApps#GetAppBuildId">https://partner.steamgames.com/doc/api</a> /// </summary> /// <returns></returns> public static int GetAppBuildId() { return(SteamApps.GetAppBuildId()); }
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 }
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(); }