public void Initialize() { try { active = SteamAPI.Init(); Console.WriteLine("Steam logged on: " + SteamUser.BLoggedOn().ToString()); if (active) { Console.WriteLine("Initializing GalaxySDK"); GalaxyInstance.Init(new InitParams("48767653913349277", "58be5c2e55d7f535cf8c4b6bbc09d185de90b152c8c42703cc13502465f0d04a", ".")); encryptedAppTicketResponse = CallResult <EncryptedAppTicketResponse_t> .Create(onEncryptedAppTicketResponse); galaxyAuthListener = new GalaxyHelper.AuthListener(onGalaxyAuthSuccess, onGalaxyAuthFailure, onGalaxyAuthLost); galaxyStateChangeListener = new GalaxyHelper.OperationalStateChangeListener(onGalaxyStateChange); Console.WriteLine("Requesting Steam app ticket"); SteamAPICall_t handle = SteamUser.RequestEncryptedAppTicket(new byte[0], 0); encryptedAppTicketResponse.Set(handle); ConnectionProgress++; } } catch (Exception value) { Console.WriteLine(value); active = false; ConnectionFinished = true; } if (active) { gameOverlayActivated = Callback <GameOverlayActivated_t> .Create(onGameOverlayActivated); gamepadTextInputDismissed = Callback <GamepadTextInputDismissed_t> .Create(OnKeyboardDismissed); } }
public void Search(string [] tags, string searchText) { try { if (!SteamUser.BLoggedOn()) { return; } _UGCQueryHandle = SteamUGC.CreateQueryAllUGCRequest(EUGCQuery.k_EUGCQuery_RankedByVote, EUGCMatchingUGCType.k_EUGCMatchingUGCType_Items, SteamUtils.GetAppID(), SteamUtils.GetAppID(), _Page); SteamUGC.SetSearchText(_UGCQueryHandle, searchText); if (tags != null && tags.Length > 0) { for (int i = 0; i < tags.Length; i++) { SteamUGC.AddRequiredTag(_UGCQueryHandle, tags[i]); } } _callbackHandle = SteamUGC.SendQueryUGCRequest(_UGCQueryHandle); OnSteamUGCQueryCompletedCallResult.Set(_callbackHandle); ProcessList.Remove(this); } catch (Exception) { Finish(null, 0, _StartIndex, false); } }
public override void Initialize() { //#if UNITY_EDITOR mInitialized = true; return; //#endif try { // If Steam is not running or the game wasn't started through Steam, SteamAPI_RestartAppIfNecessary starts the // Steam client and also launches this game again if the User owns it. This can act as a rudimentary form of DRM. // Once you get a Steam AppID assigned by Valve, you need to replace AppId_t.Invalid with it and // remove steam_appid.txt from the game depot. eg: "(AppId_t)480" or "new AppId_t(480)". // See the Valve documentation for more information: https://partner.steamgames.com/documentation/drm#FAQ if (SteamAPI.RestartAppIfNecessary((AppId_t)GameManager.SteamAppID)) { Debug.Log("APPLICATION NOT RUNNNING WITHIN STEAM - QUITTING"); Application.Quit(); return; } } catch (System.DllNotFoundException e) { // We catch this exception here, as it will be the first occurence of it. 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" + e, this); Application.Quit(); return; } // Initialize the SteamAPI, if Init() returns false this can happen for many reasons. // Some examples include: // Steam Client is not running. // Launching from outside of steam without a steam_appid.txt file in place. // https://partner.steamgames.com/documentation/example // Under: Common Build Problems // https://partner.steamgames.com/documentation/bootstrap_stats // At the very bottom // If you're running into Init issues try running DbgView prior to launching to get the internal output from Steam. // http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx mInitialized = SteamAPI.Init(); if (!mInitialized) { Debug.LogError("[Steamworks.NET] SteamAPI_Init() failed. Refer to Valve's documentation or the comment above this line for more information.", this); Application.Quit(); return; } // Ensure that the user has logged into Steam. This will always return true if the game is launched // from Steam, but if Steam is at the login prompt when you run your game from outside of Steam, // while steam_appid.txt is present will return false. if (!SteamUser.BLoggedOn()) { Debug.LogError("[Steamworks.NET] Steam user must be logged in to play this game (SteamUser()->BLoggedOn() returned false).", this); Application.Quit(); return; } base.Initialize(); }
// Returns false if any initialization fails, it would be best to close the game afterwards, otherwise this return true so it's safe to continue game initialization public static bool Initialize() { // Make sure the game is being run through steam if (SteamAPI.RestartAppIfNecessary(APP_ID)) { return(false); } // Steam initialization try { if (!SteamAPI.Init()) { Console.WriteLine("SteamAPI.Init() failed!"); return(false); } } catch (DllNotFoundException e) { // We check this here as it will be the first instance of it. Console.WriteLine(e); return(false); } // Makes sure steamworks.net is running under the correct platform if (!Packsize.Test()) { Console.WriteLine("You're using the wrong Steamworks.NET Assembly for this platform!"); return(false); } // Makes sure steamworks redistributable binaries are the correct version if (!DllCheck.Test()) { Console.WriteLine("You're using the wrong dlls for this platform!"); return(false); } // Check that user is logged onto steam, mainly for when the game is launched from outside of steam in visual studio if (!SteamUser.BLoggedOn()) { Console.WriteLine("Steam user is not logged on, pls log on and try launching again."); return(false); } // Grab the name of player username = SteamFriends.GetPersonaName(); userID = SteamUser.GetSteamID(); Console.WriteLine("Hello " + Username + ". Welcome to Tetronminous."); isInitialized = true; InitializeCallbacks(); return(true); }
public override void OnEnter() { result.Value = SteamUser.BLoggedOn(); if (result.Value) { Fsm.Event(isLoggedOn); } else { Fsm.Event(notLoggedOn); } }
public void DebugInfo() { if (SteamAPI.IsSteamRunning()) { Game1.debugOutput = "steam is running"; if (SteamUser.BLoggedOn()) { Game1.debugOutput += ", user logged on"; } } else { Game1.debugOutput = "steam is not running"; SteamAPI.Init(); } }
private static void Main(string[] args) { if (!SteamAPI.Init()) { MessageBox.Show("Steam initialization failed. Is Steam running?", "Steam Error", MessageBoxButtons.OK); } else if (!SteamUser.BLoggedOn()) { MessageBox.Show("User is not logged into Steam.", "Steam Error", MessageBoxButtons.OK); } else { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new WorkshopTool(args)); } }
private static bool InitSteam() { // Sneaky trick to avoid the steam_appid.txt. Environment.SetEnvironmentVariable("SteamAppId", "252950"); if (!SteamAPI.Init()) { Debug.WriteLine("SteamAPI.Init() failed"); return(false); } if (!SteamUser.BLoggedOn()) { Debug.WriteLine("SteamUser.BLoggedOn() failed"); return(false); } return(true); }
public bool Initialize() { if (!SteamAPI.Init()) { Debug.LogError("Steam is not running!"); return(false); } SteamClient.SetWarningMessageHook(WarningHook); if (!SteamUser.BLoggedOn()) { Debug.LogError("Not signed into steam!"); return(false); } Debug.Log("Steamworks initialized."); return(true); }
// Token: 0x06001B97 RID: 7063 RVA: 0x0008DE48 File Offset: 0x0008C048 private void Start() { Debug.Log("INITIALIZING STEAMWORKS SDK"); if (SteamManager.m_instance != null) { UnityEngine.Object.Destroy(base.gameObject); return; } SteamManager.m_instance = this; try { if (SteamAPI.RestartAppIfNecessary((AppId_t)291210u)) { 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; } if (!SteamAPI.Init()) { Debug.LogError("[Steamworks.NET] SteamAPI_Init() failed. Refer to Valve's documentation or the comment above this line for more information.", this); Application.Quit(); return; } this.m_bInitialized = true; Debug.Log("SteamAPI was successfully initialized!"); if (!SteamUser.BLoggedOn()) { Debug.LogError("[Steamworks.NET] Steam user must be logged in to play this game (SteamUser()->BLoggedOn() returned false).", this); Application.Quit(); return; } }
public void RenderOnGUI() { GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height)); GUILayout.Label("m_HAuthTicket: " + m_HAuthTicket); GUILayout.Label("m_pcbTicket: " + m_pcbTicket); GUILayout.EndArea(); GUILayout.Label("GetHSteamUser() : " + SteamUser.GetHSteamUser()); GUILayout.Label("BLoggedOn() : " + SteamUser.BLoggedOn()); GUILayout.Label("GetSteamID() : " + SteamUser.GetSteamID()); //GUILayout.Label("InitiateGameConnection() : " + SteamUser.InitiateGameConnection()); // N/A - Too Hard to test like this. //GUILayout.Label("TerminateGameConnection() : " + SteamUser.TerminateGameConnection()); // ^ //GUILayout.Label("TrackAppUsageEvent() : " + SteamUser.TrackAppUsageEvent()); // Legacy function with no documentation { string Buffer; bool ret = SteamUser.GetUserDataFolder(out Buffer, 260); GUILayout.Label("GetUserDataFolder(out Buffer, 260) : " + ret + " -- " + Buffer); } if (GUILayout.Button("StartVoiceRecording()")) { SteamUser.StartVoiceRecording(); print("SteamUser.StartVoiceRecording()"); } if (GUILayout.Button("StopVoiceRecording()")) { SteamUser.StopVoiceRecording(); print("SteamUser.StopVoiceRecording()"); } { uint Compressed; uint Uncompressed; EVoiceResult ret = SteamUser.GetAvailableVoice(out Compressed, out Uncompressed, 11025); GUILayout.Label("GetAvailableVoice(out Compressed, out Uncompressed, 11025) : " + ret + " -- " + Compressed + " -- " + Uncompressed); if (ret == EVoiceResult.k_EVoiceResultOK && Compressed > 0) { byte[] DestBuffer = new byte[1024]; byte[] UncompressedDestBuffer = new byte[1024]; uint BytesWritten; uint UncompressedBytesWritten; ret = SteamUser.GetVoice(true, DestBuffer, 1024, out BytesWritten, true, UncompressedDestBuffer, (uint)DestBuffer.Length, out UncompressedBytesWritten, 11025); //print("SteamUser.GetVoice(true, DestBuffer, 1024, out BytesWritten, true, UncompressedDestBuffer, (uint)DestBuffer.Length, out UncompressedBytesWritten, 11025) : " + ret + " -- " + BytesWritten + " -- " + UncompressedBytesWritten); if (ret == EVoiceResult.k_EVoiceResultOK && BytesWritten > 0) { byte[] DestBuffer2 = new byte[11025 * 2]; uint BytesWritten2; ret = SteamUser.DecompressVoice(DestBuffer, BytesWritten, DestBuffer2, (uint)DestBuffer2.Length, out BytesWritten2, 11025); //print("SteamUser.DecompressVoice(DestBuffer, BytesWritten, DestBuffer2, (uint)DestBuffer2.Length, out BytesWritten2, 11025) - " + ret + " -- " + BytesWritten2); if (ret == EVoiceResult.k_EVoiceResultOK && BytesWritten2 > 0) { AudioSource source; if (!m_VoiceLoopback) { m_VoiceLoopback = new GameObject("Voice Loopback"); source = m_VoiceLoopback.AddComponent <AudioSource>(); source.clip = AudioClip.Create("Testing!", 11025, 1, 11025, false, false); } else { source = m_VoiceLoopback.GetComponent <AudioSource>(); } float[] test = new float[11025]; for (int i = 0; i < test.Length; ++i) { test[i] = (short)(DestBuffer2[i * 2] | DestBuffer2[i * 2 + 1] << 8) / 32768.0f; } source.clip.SetData(test, 0); source.Play(); } } } } GUILayout.Label("GetVoiceOptimalSampleRate() : " + SteamUser.GetVoiceOptimalSampleRate()); { if (GUILayout.Button("GetAuthSessionTicket(Ticket, 1024, out pcbTicket)")) { m_Ticket = new byte[1024]; m_HAuthTicket = SteamUser.GetAuthSessionTicket(m_Ticket, 1024, out m_pcbTicket); print("SteamUser.GetAuthSessionTicket(Ticket, 1024, out pcbTicket) - " + m_HAuthTicket + " -- " + m_pcbTicket); } if (GUILayout.Button("BeginAuthSession(m_Ticket, (int)m_pcbTicket, SteamUser.GetSteamID())")) { if (m_HAuthTicket != HAuthTicket.Invalid && m_pcbTicket != 0) { EBeginAuthSessionResult ret = SteamUser.BeginAuthSession(m_Ticket, (int)m_pcbTicket, SteamUser.GetSteamID()); print("SteamUser.BeginAuthSession(m_Ticket, " + (int)m_pcbTicket + ", " + SteamUser.GetSteamID() + ") - " + ret); } else { print("Call GetAuthSessionTicket first!"); } } } if (GUILayout.Button("EndAuthSession(SteamUser.GetSteamID())")) { SteamUser.EndAuthSession(SteamUser.GetSteamID()); print("SteamUser.EndAuthSession(" + SteamUser.GetSteamID() + ")"); } if (GUILayout.Button("CancelAuthTicket(m_HAuthTicket)")) { SteamUser.CancelAuthTicket(m_HAuthTicket); print("SteamUser.CancelAuthTicket(" + m_HAuthTicket + ")"); } GUILayout.Label("UserHasLicenseForApp(SteamUser.GetSteamID(), SteamUtils.GetAppID()) : " + SteamUser.UserHasLicenseForApp(SteamUser.GetSteamID(), SteamUtils.GetAppID())); GUILayout.Label("BIsBehindNAT() : " + SteamUser.BIsBehindNAT()); if (GUILayout.Button("AdvertiseGame(2, 127.0.0.1, 27015)")) { SteamUser.AdvertiseGame(CSteamID.NonSteamGS, 2130706433, 27015); print("SteamUser.AdvertiseGame(2, 2130706433, 27015)"); } if (GUILayout.Button("RequestEncryptedAppTicket()")) { byte[] k_unSecretData = System.BitConverter.GetBytes(0x5444); SteamAPICall_t handle = SteamUser.RequestEncryptedAppTicket(k_unSecretData, sizeof(uint)); OnEncryptedAppTicketResponseCallResult.Set(handle); print("SteamUser.RequestEncryptedAppTicket(k_unSecretData, " + sizeof(uint) + ") - " + handle); } if (GUILayout.Button("GetEncryptedAppTicket()")) { byte[] rgubTicket = new byte[1024]; uint cubTicket; bool ret = SteamUser.GetEncryptedAppTicket(rgubTicket, 1024, out cubTicket); print("SteamUser.GetEncryptedAppTicket() - " + ret + " -- " + cubTicket); } //GUILayout.Label("GetGameBadgeLevel(1, false) : " + SteamUser.GetGameBadgeLevel(1, false)); // SpaceWar does not have trading cards, so this function will only ever return 0 and produce an annoying warning. GUILayout.Label("GetPlayerSteamLevel() : " + SteamUser.GetPlayerSteamLevel()); if (GUILayout.Button("RequestStoreAuthURL(\"https://steampowered.com\")")) { SteamAPICall_t handle = SteamUser.RequestStoreAuthURL("https://steampowered.com"); OnStoreAuthURLResponseCallResult.Set(handle); print("SteamUser.RequestStoreAuthURL(\"https://steampowered.com\") - " + handle); } #if _PS3 //GUILayout.Label("LogOn() : " + SteamUser.LogOn()); //GUILayout.Label("LogOnAndLinkSteamAccountToPSN : " + SteamUser.LogOnAndLinkSteamAccountToPSN()); //GUILayout.Label("LogOnAndCreateNewSteamAccountIfNeeded : " + SteamUser.LogOnAndCreateNewSteamAccountIfNeeded()); //GUILayout.Label("GetConsoleSteamID : " + SteamUser.GetConsoleSteamID()); #endif }
public static bool SteamIsConnected() { return(SteamIsRunning() && SteamUser.BLoggedOn()); }
private static async Task Login() { ////var appId = new AppId_t(367500); ////if (SteamAPI.RestartAppIfNecessary(appId)) ////{ //// Debug.WriteLine("Could not init steam"); //// return; ////} if (!SteamAPI.Init()) { Debug.WriteLine("Could not initialize steam"); return; } SteamClient.SetWarningMessageHook((severity, text) => Console.WriteLine(text)); if (!SteamUser.BLoggedOn()) { Debug.WriteLine("Steam user not logged in"); return; } CSteamID userSteamId = SteamUser.GetSteamID(); ////if (SteamApps.BIsSubscribed()) ////{ //// Debug.WriteLine("Steam user has no license"); //// return; ////} ////if (SteamApps.BIsSubscribedApp(appId)) ////{ //// Debug.WriteLine("Steam user has no license"); //// return; ////} var cts = new CancellationTokenSource(10000); bool receivedTicket = false; byte[] rgubTicket = new byte[1024]; SteamAPICall_t handle = SteamUser.RequestEncryptedAppTicket(null, 0); var callback = CallResult <EncryptedAppTicketResponse_t> .Create((response, bIoFailure) => { if (response.m_eResult == EResult.k_EResultOK) { uint ticketLen; SteamUser.GetEncryptedAppTicket(rgubTicket, 1024, out ticketLen); Array.Resize(ref rgubTicket, (int)ticketLen); receivedTicket = true; } else { cts.Cancel(); } }); callback.Set(handle); while (!receivedTicket && !cts.Token.IsCancellationRequested) { SteamAPI.RunCallbacks(); await Task.Delay(1000); } if (receivedTicket) { _steamId = userSteamId.m_SteamID; _ticket = rgubTicket; } SteamAPI.Shutdown(); }
public void Rebind() { bool flag = displayMode == LevelSelectMenuMode.SubscribedWorkshop; UpdateTitle(); DisableLevelContinue(); bool flag2 = false; flag2 = SteamUser.BLoggedOn(); InLevelSelectMenu = (displayMode != 0 && displayMode != LevelSelectMenuMode.LocalWorkshop); showCustomButton.SetActive(value: false); showSubscribedButton.SetActive(value: false); subscribedSubtitle.SetActive(value: false); customSubtitle.SetActive(value: false); ShowLocalLevelButton.SetActive(value: false); InvalidLevelInfoPanel.SetActive(value: false); noSubscribedPrompt.SetActive(value: false); offlinePanel.SetActive(value: false); noLocalPrompt.SetActive(value: false); List <WorkshopLevelMetadata> list = null; switch (displayMode) { case LevelSelectMenuMode.Campaign: WorkshopRepository.instance.LoadBuiltinLevels(isMultiplayer && IsLobbyMode()); list = WorkshopRepository.instance.levelRepo.BySource(IsLobbyMode() ? WorkshopItemSource.BuiltInLobbies : WorkshopItemSource.BuiltIn); break; case LevelSelectMenuMode.EditorPicks: WorkshopRepository.instance.LoadEditorPickLevels(); list = WorkshopRepository.instance.levelRepo.BySource(WorkshopItemSource.EditorPick); break; case LevelSelectMenuMode.SubscribedWorkshop: if (flag2) { WorkshopRepository.instance.ReloadSubscriptions(); list = WorkshopRepository.instance.levelRepo.BySource(WorkshopItemSource.Subscription); } break; case LevelSelectMenuMode.LocalWorkshop: WorkshopRepository.instance.ReloadLocalLevels(); list = WorkshopRepository.instance.levelRepo.BySource(WorkshopItemSource.LocalWorkshop); break; case LevelSelectMenuMode.BuiltInLobbies: WorkshopRepository.instance.LoadBuiltinLevels(requestLobbies: true); list = WorkshopRepository.instance.levelRepo.BySource(WorkshopItemSource.BuiltInLobbies); break; case LevelSelectMenuMode.WorkshopLobbies: if (flag2) { WorkshopRepository.instance.ReloadSubscriptions(isLobby: true); list = WorkshopRepository.instance.levelRepo.BySource(WorkshopItemSource.SubscriptionLobbies); } break; } if (list == null) { list = new List <WorkshopLevelMetadata>(); } if (!CouldShowFindMore()) { FindMoreButton.SetActive(value: false); } customFolder.text = CustomDataPath; if (list.Count == 0) { this.list.Bind(list); itemListImage.color = itemListError; if (!flag2) { offlinePanel.SetActive(value: true); } else if (IsLobbyMode()) { noSubscribedPrompt.SetActive(value: true); } else if (displayMode == LevelSelectMenuMode.SubscribedWorkshop) { noSubscribedPrompt.SetActive(value: true); } else { noLocalPrompt.SetActive(value: true); } EventSystem.current.SetSelectedGameObject(BackButton.gameObject); levelImage.SetActive(value: false); LevelDescriptionPanel.SetActive(value: false); } else { itemListImage.color = itemListNormal; levelInfoPanel.SetActive(value: true); levelImage.SetActive(!flag); LevelDescriptionPanel.SetActive(flag); this.list.Bind(list); int num = 0; if (!string.IsNullOrEmpty(selectedPath)) { for (int i = 0; i < list.Count; i++) { if (FolderMatch(list[i].folder, selectedPath)) { num = i; break; } } } GameSave.GetLastSave(out int levelNumber, out int _, out int _, out float _); WorkshopItemSource lastCheckpointLevelType = GameSave.GetLastCheckpointLevelType(); bool flag3 = false; switch (lastCheckpointLevelType) { case WorkshopItemSource.BuiltIn: flag3 = (displayMode == LevelSelectMenuMode.Campaign); break; case WorkshopItemSource.EditorPick: flag3 = (displayMode == LevelSelectMenuMode.EditorPicks); break; default: flag3 = false; break; } if (flag3) { if (levelNumber < this.list.GetNumberItems - 1) { this.list.FocusItem(levelNumber); } else { this.list.FocusItem(0); } } else { this.list.FocusItem(0); } } topPanel.Invalidate(); EnableShowLevelButtons(); BindLevelIfNeeded(selectedMenuItem); if (previousSelectedItem != null) { StartCoroutine(WaitAndSelect()); } }
public override void OnGotFocus() { base.OnGotFocus(); if (deleteSelectedOnLoad) { deleteSelectedOnLoad = false; CustomizationController.instance.DeletePreset(selectedItem); dontReload = true; int num = items.IndexOf(selectedItem); items.Remove(selectedItem); if (num >= items.Count) { num = items.Count - 1; } if (items.Count > 0) { selectedItem = items[num]; } else { selectedItem = null; } if (mode == CustomizationPresetMenuMode.Save && items.Count < 128 && (items.Count < 1 || items[items.Count - 1] != null)) { items.Add(null); } } bool flag = true; if (!flag && showSubscribed) { showSubscribed = false; } showSubscribedButton.SetActive(mode == CustomizationPresetMenuMode.Load && !showSubscribed && flag); loadMyTitle.SetActive(mode == CustomizationPresetMenuMode.Load && !showSubscribed); bool flag2 = mode == CustomizationPresetMenuMode.Load && showSubscribed; showMyButton.SetActive(flag2); loadSubscribedTitle.SetActive(flag2); openWorkshopButton.SetActive(flag2); InCustomizationPresetMenu = flag2; saveTitle.SetActive(mode != CustomizationPresetMenuMode.Load); noSubscriptionsMessage.SetActive(value: false); offlineMessage.SetActive(value: false); noPresetsMessage.SetActive(value: false); list.onSelect = OnSelect; list.onPointerClick = OnPointerClick; list.onSubmit = OnSubmit; bool flag3 = false; flag3 = SteamUser.BLoggedOn(); if (!dontReload) { if (mode == CustomizationPresetMenuMode.Load) { WorkshopRepository.instance.ReloadLocalPresets(); if (!WorkshopRepository.instance.ReloadSubscriptions()) { } items = new List <RagdollPresetMetadata>(); if (showSubscribed) { if (flag3) { items.AddRange(WorkshopRepository.instance.presetRepo.BySource(WorkshopItemSource.Subscription)); } } else { items.AddRange(WorkshopRepository.instance.presetRepo.BySource(WorkshopItemSource.LocalWorkshop)); } } else { WorkshopRepository.instance.ReloadLocalPresets(); WorkshopRepository.instance.ReloadSubscriptions(); items = new List <RagdollPresetMetadata>(); items.AddRange(WorkshopRepository.instance.presetRepo.BySource(WorkshopItemSource.LocalWorkshop)); if (items.Count < 128) { items.Add(null); } } selectedItem = null; string skinPresetReference = CustomizationController.instance.GetSkinPresetReference(); for (int i = 0; i < items.Count; i++) { if (items[i] != null && items[i].folder.Equals(skinPresetReference)) { selectedItem = items[i]; } } } CustomizationController.instance.cameraController.FocusCharacterModel(); dontReload = false; if (items.Count == 0) { list.Bind(items); if (!flag3) { offlineMessage.SetActive(value: true); } else if (showSubscribed) { noSubscriptionsMessage.SetActive(value: true); } else { noPresetsMessage.SetActive(value: true); } BindButtons(); EventSystem.current.SetSelectedGameObject(GetComponentInChildren <Selectable>().gameObject); } else { list.Bind(items); int num2 = items.IndexOf(selectedItem); if (num2 < 0) { num2 = 0; } list.FocusItem(num2); } PageLeftButton.SetActive(list.isCarousel); PageRightButton.SetActive(list.isCarousel); }
public void RenderOnGUI() { GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height)); GUILayout.Label("Variables:"); GUILayout.Label("m_Ticket: " + m_Ticket); GUILayout.Label("m_pcbTicket: " + m_pcbTicket); GUILayout.Label("m_HAuthTicket: " + m_HAuthTicket); GUILayout.Label("m_VoiceLoopback: " + m_VoiceLoopback); GUILayout.EndArea(); GUILayout.BeginVertical("box"); m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(Screen.width - 215), GUILayout.Height(Screen.height - 33)); GUILayout.Label("GetHSteamUser() : " + SteamUser.GetHSteamUser()); GUILayout.Label("BLoggedOn() : " + SteamUser.BLoggedOn()); GUILayout.Label("GetSteamID() : " + SteamUser.GetSteamID()); //SteamUser.InitiateGameConnection() // N/A - Too Hard to test like this. //SteamUser.TerminateGameConnection() // ^ //SteamUser.TrackAppUsageEvent() // Legacy function with no documentation { string Buffer; bool ret = SteamUser.GetUserDataFolder(out Buffer, 260); GUILayout.Label("GetUserDataFolder(out Buffer, 260) : " + ret + " -- " + Buffer); } if (GUILayout.Button("StartVoiceRecording()")) { SteamUser.StartVoiceRecording(); print("SteamUser.StartVoiceRecording()"); } if (GUILayout.Button("StopVoiceRecording()")) { SteamUser.StopVoiceRecording(); print("SteamUser.StopVoiceRecording()"); } { uint Compressed; EVoiceResult ret = SteamUser.GetAvailableVoice(out Compressed); GUILayout.Label("GetAvailableVoice(out Compressed) : " + ret + " -- " + Compressed); if (ret == EVoiceResult.k_EVoiceResultOK && Compressed > 0) { byte[] DestBuffer = new byte[1024]; uint BytesWritten; ret = SteamUser.GetVoice(true, DestBuffer, 1024, out BytesWritten); //print("SteamUser.GetVoice(true, DestBuffer, 1024, out BytesWritten) : " + ret + " -- " + BytesWritten); if (ret == EVoiceResult.k_EVoiceResultOK && BytesWritten > 0) { byte[] DestBuffer2 = new byte[11025 * 2]; uint BytesWritten2; ret = SteamUser.DecompressVoice(DestBuffer, BytesWritten, DestBuffer2, (uint)DestBuffer2.Length, out BytesWritten2, 11025); //print("SteamUser.DecompressVoice(DestBuffer, BytesWritten, DestBuffer2, (uint)DestBuffer2.Length, out BytesWritten2, 11025) - " + ret + " -- " + BytesWritten2); if (ret == EVoiceResult.k_EVoiceResultOK && BytesWritten2 > 0) { AudioSource source; if (!m_VoiceLoopback) { m_VoiceLoopback = new GameObject("Voice Loopback"); source = m_VoiceLoopback.AddComponent <AudioSource>(); source.clip = AudioClip.Create("Testing!", 11025, 1, 11025, false); } else { source = m_VoiceLoopback.GetComponent <AudioSource>(); } float[] test = new float[11025]; for (int i = 0; i < test.Length; ++i) { test[i] = (short)(DestBuffer2[i * 2] | DestBuffer2[i * 2 + 1] << 8) / 32768.0f; } source.clip.SetData(test, 0); source.Play(); } } } } GUILayout.Label("GetVoiceOptimalSampleRate() : " + SteamUser.GetVoiceOptimalSampleRate()); { if (GUILayout.Button("GetAuthSessionTicket(Ticket, 1024, out pcbTicket)")) { m_Ticket = new byte[1024]; m_HAuthTicket = SteamUser.GetAuthSessionTicket(m_Ticket, 1024, out m_pcbTicket); print("SteamUser.GetAuthSessionTicket(Ticket, 1024, out pcbTicket) - " + m_HAuthTicket + " -- " + m_pcbTicket); } if (GUILayout.Button("BeginAuthSession(m_Ticket, (int)m_pcbTicket, SteamUser.GetSteamID())")) { if (m_HAuthTicket != HAuthTicket.Invalid && m_pcbTicket != 0) { EBeginAuthSessionResult ret = SteamUser.BeginAuthSession(m_Ticket, (int)m_pcbTicket, SteamUser.GetSteamID()); print("SteamUser.BeginAuthSession(m_Ticket, " + (int)m_pcbTicket + ", " + SteamUser.GetSteamID() + ") - " + ret); } else { print("Call GetAuthSessionTicket first!"); } } } if (GUILayout.Button("EndAuthSession(SteamUser.GetSteamID())")) { SteamUser.EndAuthSession(SteamUser.GetSteamID()); print("SteamUser.EndAuthSession(" + SteamUser.GetSteamID() + ")"); } if (GUILayout.Button("CancelAuthTicket(m_HAuthTicket)")) { SteamUser.CancelAuthTicket(m_HAuthTicket); print("SteamUser.CancelAuthTicket(" + m_HAuthTicket + ")"); } GUILayout.Label("UserHasLicenseForApp(SteamUser.GetSteamID(), SteamUtils.GetAppID()) : " + SteamUser.UserHasLicenseForApp(SteamUser.GetSteamID(), SteamUtils.GetAppID())); GUILayout.Label("BIsBehindNAT() : " + SteamUser.BIsBehindNAT()); if (GUILayout.Button("AdvertiseGame(CSteamID.NonSteamGS, TestConstants.k_IpAdress127_0_0_1, TestConstants.k_Port27015)")) { SteamUser.AdvertiseGame(CSteamID.NonSteamGS, TestConstants.k_IpAdress127_0_0_1, TestConstants.k_Port27015); print("SteamUser.AdvertiseGame(" + CSteamID.NonSteamGS + ", " + TestConstants.k_IpAdress127_0_0_1 + ", " + TestConstants.k_Port27015 + ")"); } if (GUILayout.Button("RequestEncryptedAppTicket(k_unSecretData, sizeof(uint))")) { byte[] k_unSecretData = System.BitConverter.GetBytes(0x5444); SteamAPICall_t handle = SteamUser.RequestEncryptedAppTicket(k_unSecretData, sizeof(uint)); OnEncryptedAppTicketResponseCallResult.Set(handle); print("SteamUser.RequestEncryptedAppTicket(" + k_unSecretData + ", " + sizeof(uint) + ") : " + handle); } if (GUILayout.Button("GetEncryptedAppTicket(rgubTicket, 1024, out cubTicket)")) { byte[] rgubTicket = new byte[1024]; uint cubTicket; bool ret = SteamUser.GetEncryptedAppTicket(rgubTicket, 1024, out cubTicket); print("SteamUser.GetEncryptedAppTicket(" + rgubTicket + ", " + 1024 + ", " + "out cubTicket" + ") : " + ret + " -- " + cubTicket); } // SpaceWar does not have trading cards, so this function will only ever return 0 and produce an annoying warning. if (GUILayout.Button("GetGameBadgeLevel(1, false)")) { int ret = SteamUser.GetGameBadgeLevel(1, false); print("SteamUser.GetGameBadgeLevel(" + 1 + ", " + false + ") : " + ret); } GUILayout.Label("GetPlayerSteamLevel() : " + SteamUser.GetPlayerSteamLevel()); if (GUILayout.Button("RequestStoreAuthURL(\"https://steampowered.com\")")) { SteamAPICall_t handle = SteamUser.RequestStoreAuthURL("https://steampowered.com"); OnStoreAuthURLResponseCallResult.Set(handle); print("SteamUser.RequestStoreAuthURL(" + "\"https://steampowered.com\"" + ") : " + handle); } GUILayout.Label("BIsPhoneVerified() : " + SteamUser.BIsPhoneVerified()); GUILayout.Label("BIsTwoFactorEnabled() : " + SteamUser.BIsTwoFactorEnabled()); GUILayout.Label("BIsPhoneIdentifying() : " + SteamUser.BIsPhoneIdentifying()); GUILayout.Label("BIsPhoneRequiringVerification() : " + SteamUser.BIsPhoneRequiringVerification()); if (GUILayout.Button("GetMarketEligibility()")) { SteamAPICall_t handle = SteamUser.GetMarketEligibility(); OnMarketEligibilityResponseCallResult.Set(handle); print("SteamUser.GetMarketEligibility() : " + handle); } GUILayout.EndScrollView(); GUILayout.EndVertical(); }
internal static void SendFile(SteamUploadEventHandler callBackSteamUploadResult, string name, string desc, byte[] preData, byte[] data, string[] tags, bool sendToServer = true, int id = -1, ulong fileId = 0, bool free = false) { ulong hash = CRC64.Compute(data); bool ret = false; try { if (string.IsNullOrEmpty(name)) { VCEMsgBox.Show(VCEMsgBoxType.EXPORT_EMPTY_NAME); LogManager.Error("File name cannot be null."); return; } if (!SteamUser.BLoggedOn()) { LogManager.Error("log back in steam..."); return; } bool bPublish = !sendToServer; if (SteamRemoteStorage.FileExists(hash.ToString() + "_preview")) { //file exist,don't publish it; } if (!SteamRemoteStorage.IsCloudEnabledForAccount()) { throw new Exception("Account cloud disabled."); } if (!SteamRemoteStorage.IsCloudEnabledForApp()) { throw new Exception("App cloud disabled."); } if (!bPublish) { SteamFileItem item = new SteamFileItem(callBackSteamUploadResult, name, desc, preData, data, hash, tags, bPublish, sendToServer, id, fileId, free); item.StartSend(); } else { SendIsoCache iso = new SendIsoCache(); iso.id = id; iso.hash = hash; iso.name = name; iso.preData = preData; iso.sendToServer = sendToServer; iso.tags = tags; iso.data = data; iso.desc = desc; iso.callBackSteamUploadResult = callBackSteamUploadResult; iso.bPublish = bPublish; if (AddToIsoCache(iso)) { LobbyInterface.LobbyRPC(ELobbyMsgType.UploadISO, hash, SteamMgr.steamId.m_SteamID); } else { return; } } VCEMsgBox.Show(VCEMsgBoxType.EXPORT_NETWORK); ret = true; } catch (Exception e) { VCEMsgBox.Show(VCEMsgBoxType.EXPORT_NETWORK_FAILED); Debug.LogWarning("workshop error :" + e.Message); ToolTipsMgr.ShowText(e.Message); } finally { if (!ret && callBackSteamUploadResult != null) { callBackSteamUploadResult(id, false, hash); } } }