public bool GetValue() { if (!this.AppOnly) { return(CVarScripts.GetCVar(this.Name) == "1"); } bool result = true; string @string = SecurePlayerPrefs.GetString(this.Name, Main.uniqueIdentifier); if (string.IsNullOrEmpty(@string)) { return(true); } bool.TryParse(@string, out result); return(result); }
public void GetBool(bool value) { // Arrange SecurePlayerPrefs.UseSecurePrefs = false; SecurePlayerPrefs.AutoConvertUnsecurePrefs = false; PlayerPrefs.DeleteKey("TestBool" + value); PlayerPrefs.SetInt("TestBool" + value, value ? 1 : 0); // Act // Assert Assert.AreEqual(value, SecurePlayerPrefs.GetBool("TestBool" + value), "The value was not set"); // Cleanup PlayerPrefs.DeleteKey("TestBool" + value); }
public override void Handle(string parts) { if (parts.StartsWith("OK")) { VRCModNetworkManager.SheduleForMainThread(() => { VRCModNetworkManager.IsAuthenticated = true; if (!parts.Equals("OK")) { string token = parts.Substring(3); SecurePlayerPrefs.SetString("vrcmnw_token_" + id, token, "vl9u1grTnvXA"); } }); } Destroy(); }
public void HasKeyNoAutoConvert(int value) { // Arrange PlayerPrefs.DeleteKey("TestInt" + value); PlayerPrefs.SetInt("TestInt" + value, 1); SecurePlayerPrefs.UseSecurePrefs = true; SecurePlayerPrefs.AutoConvertUnsecurePrefs = false; // Act // Assert Assert.IsFalse(SecurePlayerPrefs.HasKey("TestInt" + value), "The key was not found"); // Cleanup PlayerPrefs.DeleteKey("TestInt" + value); }
private void Start() { if (_id == 0) { SetLock(false); } else if (SecurePlayerPrefs.GetInt("faceAvailable_" + _id) != 1) { SetLock(true); } else { SetLock(false); } }
public void SetInt(int value) { // Arrange SecurePlayerPrefs.UseSecurePrefs = false; SecurePlayerPrefs.AutoConvertUnsecurePrefs = false; SecurePlayerPrefs.DeleteKey("TestInt" + value); SecurePlayerPrefs.SetInt("TestInt" + value, value); // Act // Assert Assert.AreEqual(value, PlayerPrefs.GetInt("TestInt" + value), "The value was not set"); // Cleanup SecurePlayerPrefs.DeleteKey("TestInt" + value); }
public void HasKey(int value) { // Arrange SecurePlayerPrefs.UseSecurePrefs = false; SecurePlayerPrefs.AutoConvertUnsecurePrefs = false; SecurePlayerPrefs.DeleteKey("TestInt" + value); SecurePlayerPrefs.SetInt("TestInt" + value, 1); // Act // Assert Assert.IsTrue(SecurePlayerPrefs.HasKey("TestInt" + value), "The key should have been found"); // Cleanup SecurePlayerPrefs.DeleteKey("TestInt" + value); }
public void CollisionMNGR(GameObject collisionObject, Vector3 pos) { if (collisionObject.tag == "Enemy" || collisionObject.tag == "Bomb") { CancelInvoke(); particleManager.GetComponent <ParticleManager>().SpawnParticle(transform.position, GetComponent <SpriteRenderer>().color); SecurePlayerPrefs.SetInt("coinsGrabbed", coinsGrabbed); gameOverScript.GameEnded(false); gameObject.SetActive(false); } else if (collisionObject.tag == "Star") { EarnCoins(pos); coinsGrabbed++; } }
public void GetString(string value) { // Arrange SecurePlayerPrefs.UseSecurePrefs = false; SecurePlayerPrefs.AutoConvertUnsecurePrefs = false; PlayerPrefs.DeleteKey("TestString" + value); PlayerPrefs.SetString("TestString" + value, value); // Act // Assert Assert.AreEqual(value, SecurePlayerPrefs.GetString("TestString" + value), "The value was not set"); // Cleanup PlayerPrefs.DeleteKey("TestString" + value); }
public void GetIntEncrypted(int value) { // Arrange SecurePlayerPrefs.UseSecurePrefs = true; SecurePlayerPrefs.AutoConvertUnsecurePrefs = false; SecurePlayerPrefs.DeleteKey("TestInt" + value); // Act SecurePlayerPrefs.SetInt("TestInt" + value, value); // Assert Assert.AreEqual(value, SecurePlayerPrefs.GetInt("TestInt" + value), "The value could not be decrypted"); // Cleanup SecurePlayerPrefs.DeleteKey("TestInt" + value); }
public void ArrowRightButton() { playerSkinslist[indexOfPlayerSkin].SetActive(false); do { indexOfPlayerSkin++; if (indexOfPlayerSkin > playerSkinslist.Length - 1) { indexOfPlayerSkin = 0; } SecurePlayerPrefs.SetInt("SelectedPlayer", indexOfPlayerSkin); } while(!PlayerScrollSnap.unlocked[indexOfPlayerSkin]); playerSkinslist[indexOfPlayerSkin].SetActive(true); }
public void Construct( TradableAssetPriceManager tradableAssetPriceManager, CurrencyManager currencyManager, LockPRPSManager lockPRPSManager, LockedPRPSManager lockedPRPSManager, GasPriceObserver gasPriceObserver, EtherBalanceObserver etherBalanceObserver, Hodler hodlerContract, UserWalletManager userWalletManager, ButtonClickObserver buttonClickObserver) { this.lockedPRPSManager = lockedPRPSManager; this.etherBalanceObserver = etherBalanceObserver; this.userWalletManager = userWalletManager; this.hodlerContract = hodlerContract; this.buttonClickObserver = buttonClickObserver; etherBalanceObserver.SubscribeObservable(this); buttonClickObserver.SubscribeObservable(this); Gas = new GasManager(tradableAssetPriceManager, currencyManager, lockPRPSManager, gasPriceObserver, slider, transactionFeeText, this); Amount = new AmountManager(lockPRPSManager, maxToggle, amountInputField, prpsBalanceText, dubiBalanceText, dubiRewardText, tooltipItems[2]); Time = new TimeManager(Amount, threeMonthsButton, sixMonthsButton, twelveMonthsButton, dubiRewardText); if (lockPRPSManager.PRPSBalance == 0) { maxToggle.SetInteractable(false); maxText.color = UIColors.LightGrey; } bool showTooltips = SecurePlayerPrefs.GetBool(PlayerPrefConstants.SETTING_SHOW_TOOLTIPS); foreach (TooltipItem tooltip in tooltipItems) { if (showTooltips) { tooltip.PopupManager = popupManager; } else if (tooltip.infoIcon) { tooltip.gameObject.SetActive(false); } else { tooltip.enabled = false; } } }
public void Collision() { if (sound != null) { if (SecurePlayerPrefs.GetInt("soundfx", 0) == 0) { Instantiate(sound, transform.position, transform.rotation); } } particleManager.SpawnParticle(transform.position, color); if (gameObject.tag == "Bomb") { particleManager.Bomb(new Vector3(transform.position.x, transform.position.y, 5)); } gameObject.SetActive(false); }
public void BtnEquip() { if (_quest.skinType == SkinType.Arrow) { ScreenSkins.CurrentFaceId = _quest.skinId; SecurePlayerPrefs.SetInt("currentFaceID", ScreenSkins.CurrentFaceId); GlobalEvents <OnChangeSkin> .Call(new OnChangeSkin { Id = ScreenSkins.CurrentFaceId }); } else { ScreenSkins.CurrentTargetId = _quest.skinId; SecurePlayerPrefs.SetInt("currentFaceID", ScreenSkins.CurrentTargetId); GlobalEvents <OnChangeTargetSkin> .Call(new OnChangeTargetSkin { Id = ScreenSkins.CurrentTargetId }); } Close(); }
public void OnClick() { int pref = SecurePlayerPrefs.GetInt(prefName, 0); if (pref == 0) { pref = 1; } else { pref = 0; } SecurePlayerPrefs.SetInt(prefName, pref); LoadSoundPrefs(); }
public void HasKeyEncrypted(int value) { // Arrange SecurePlayerPrefs.UseSecurePrefs = true; SecurePlayerPrefs.AutoConvertUnsecurePrefs = false; SecurePlayerPrefs.DeleteKey("TestInt" + value); SecurePlayerPrefs.SetInt("TestInt" + value, 1); // Act // Assert Assert.IsFalse(PlayerPrefs.HasKey("TestInt" + value), "The keys was not encrypted"); Assert.IsTrue(SecurePlayerPrefs.HasKey("TestInt" + value), "The keys was not found"); // Cleanup SecurePlayerPrefs.DeleteKey("TestInt" + value); }
IEnumerator ShowPopUp() { if (Advertisement.IsReady() && SecurePlayerPrefs.GetInt("DoubleStars", 0) == 0) { CollectText.text = "Watch Video to Double"; print("Show"); } else { CloseText.SetActive(false); print("No Video"); } yield return(new WaitForSeconds(timeToWaitForPopUp)); panel.SetActive(true); }
private void Start() { if (_id == 0) { SetLock(false); } else if (SecurePlayerPrefs.GetInt("targetsAvailable_" + _id) != 1) { SetLock(true); } else { SetLock(false); } transform.localScale = Vector3.zero; }
public override void RemoteError(string error) { base.RemoteError(error); if (id != null) { VRCModNetworkManager.SheduleForMainThread(() => { if (SecurePlayerPrefs.HasKey("vrcmnw_token_" + id)) { SecurePlayerPrefs.DeleteKey("vrcmnw_token_" + id); VRCModNetworkManager.userUuid = ""; } }); } VRCModNetworkManager.authError = error; }
public void PostNotification(string ID) { print("Post Notification Called"); if (SecurePlayerPrefs.GetInt("ActiveMessage", 0) == 0) { if (ID != null) { print(ID); var notification = new Dictionary <string, object>(); notification["contents"] = new Dictionary <string, string>() { { "en", "Your stars are ready to be collected" } }; notification["headings"] = new Dictionary <string, string>() { { "en", "Free Stars!🌟" } }; notification["include_player_ids"] = new List <string>() { ID }; // Example of scheduling a notification in the future. notification["send_after"] = System.DateTime.Now.ToUniversalTime().AddHours(12).ToString("U"); OneSignal.PostNotification(notification, (responseSuccess) => { print("Success"); oneSignalDebugMessage = "Notification posted successful! Delayed by about 30 secounds to give you time to press the home button to see a notification vs an in-app alert.\n" + Json.Serialize(responseSuccess); SecurePlayerPrefs.SetInt("ActiveMessage", 1); }, (responseFailure) => { print("Failure"); oneSignalDebugMessage = "Notification failed to post:\n" + Json.Serialize(responseFailure); }); } else { print("User ID not found"); OneSignal.SetSubscription(true); } } else { print("Message already being sent"); } }
public void ArrowLeftButton() { levelList[index].SetActive(false); do { index--; if (index < 0) { index = levelList.Length - 1; } SecurePlayerPrefs.SetInt("SelectedBG", index); } while (!BGScrollSnap.unlocked[index]); levelList[index].SetActive(true); }
void Start() { rbBall = GetComponent <Rigidbody2D>(); ballSkin = GetComponent <SpriteRenderer>(); audioCount = GetComponent <AudioSource>(); skinID = SecurePlayerPrefs.GetInt("SelectedBall", skinID); ballSkin.sprite = balls[skinID]; // Skin ID gameObject.SetActive(false); rbBall.gravityScale = minGravity; gameplayTime = 0; underLine = false; }
public void SetStringEncrypted(string value) { // Arrange SecurePlayerPrefs.UseSecurePrefs = true; SecurePlayerPrefs.AutoConvertUnsecurePrefs = false; SecurePlayerPrefs.DeleteKey("TestString" + value); // Act SecurePlayerPrefs.SetString("TestString" + value, value); // Assert Assert.IsNotNull(SecurePlayerPrefs.GetRawEncryptedPrefsEntry("TestString" + value), "The value was null"); Assert.AreNotEqual(value.ToString(), SecurePlayerPrefs.GetRawEncryptedPrefsEntry("TestString" + value), "The value was not set encrypted"); // Cleanup SecurePlayerPrefs.DeleteKey("TestString" + value); }
public void DeleteAll() { // Arrange SecurePlayerPrefs.SetInt("TestInt", 1); SecurePlayerPrefs.SetFloat("TestFloat", 1.1f); SecurePlayerPrefs.SetString("TestString", "Test String"); SecurePlayerPrefs.UseSecurePrefs = true; SecurePlayerPrefs.SetString("TestStringEncrypted", "Test String"); // Act SecurePlayerPrefs.DeleteAll(); // Assert Assert.IsFalse(SecurePlayerPrefs.HasKey("TestInt") && SecurePlayerPrefs.HasKey("TestFloat") && SecurePlayerPrefs.HasKey("TestString") && SecurePlayerPrefs.HasKey("TestStringEncrypted"), "The keys were not removed"); // Cleanup }
void reportScore(scoreSet m_score) { //get the different memorized score values m_score.__scoreActual = readScoreFromPlayerprefs(m_score.scoreKey); m_score.__scoreMax = readScoreFromPlayerprefs(m_score.maxScoreKey); m_score.__score_maxTransmitted = readScoreFromPlayerprefs(m_score.scoreKey + "_maxTransmit"); //select the score to transmit if (m_score.__scoreMax > m_score.__score_maxTransmitted) { m_score.__scoreToTransmit = m_score.__scoreMax; } else { m_score.__scoreToTransmit = m_score.__scoreActual; } mDebug("score: " + m_score.__scoreActual.ToString()); mDebug("score max: " + m_score.__scoreMax.ToString()); mDebug("score max trans.: " + m_score.__score_maxTransmitted.ToString()); mDebug("score to transmit: " + m_score.__score_maxTransmitted.ToString()); // post score 12345 to leaderboard ID "Cfji293fjsie_QA") Social.ReportScore(m_score.__scoreToTransmit, m_score.leaderBoardID, (bool success) => { // handle success or failure if (success) { m_score.__transmitOk = true; if (m_score.__scoreToTransmit > m_score.__score_maxTransmitted) { #if USE_SECURE_PLAYERPREFS SecurePlayerPrefs.SetFloat(m_score.scoreKey + "_maxTransmit", (float)(m_score.__scoreToTransmit)); #else PlayerPrefs.SetFloat(m_score.scoreKey + "_maxTransmit", (float)(m_score.__scoreToTransmit)); #endif } } else { m_score.__transmitFail = true; } m_score.__transmitted = true; }); }
/// <summary> /// Animates the unique elements of this form into view /// </summary> protected override void AnimateUniqueElementsIn() { bool hasMaxLoginPref = SecurePlayerPrefs.HasKey(PlayerPrefConstants.SETTING_MAX_LOGIN_ATTEMPTS); bool hasCurrentLoginAttemptPref = SecurePlayerPrefs.HasKey(unlockWalletPopup.WalletName + PlayerPrefConstants.SETTING_CURRENT_LOGIN_ATTEMPT); if (hasMaxLoginPref && hasCurrentLoginAttemptPref && !string.IsNullOrEmpty(unlockWalletPopup.WalletName) && (SecurePlayerPrefs.GetInt(PlayerPrefConstants.SETTING_MAX_LOGIN_ATTEMPTS) - SecurePlayerPrefs.GetInt(unlockWalletPopup.WalletName + PlayerPrefConstants.SETTING_CURRENT_LOGIN_ATTEMPT) + 1) == 0) { lockedOutSection.AnimateScale(1f, 0.15f); unlockWalletPopup.LockedOut = true; } else { passwordInputField.InputFieldBase.ActivateInputField(); passwordInputField.gameObject.AnimateScaleX(1f, 0.15f); } unlockButton.AnimateGraphicAndScale(1f, 1f, 0.25f, FinishedAnimating); }
public void GetColor() { // Arrange var value = new Color(10, 20, 30, 40); // can't pass objects as as paraameter so single hardcoded test SecurePlayerPrefs.UseSecurePrefs = false; SecurePlayerPrefs.AutoConvertUnsecurePrefs = false; PlayerPrefs.DeleteKey("TestColor" + value); PlayerPrefs.SetString("TestColor" + value, "10:20:30:40"); // Act // Assert Assert.AreEqual(value, SecurePlayerPrefs.GetColor("TestColor" + value), "The value was not set"); // Cleanup PlayerPrefs.DeleteKey("TestColor" + value); }
public void SetVector3() { // Arrange var value = new Vector3(10, 20, 30); // can't pass objects as as paraameter so single hardcoded test SecurePlayerPrefs.UseSecurePrefs = false; SecurePlayerPrefs.AutoConvertUnsecurePrefs = false; SecurePlayerPrefs.DeleteKey("TestVector3" + value); SecurePlayerPrefs.SetVector3("TestVector3" + value, value); // Act // Assert Assert.AreEqual("10:20:30", PlayerPrefs.GetString("TestVector3" + value), "The value was not set"); // Cleanup SecurePlayerPrefs.DeleteKey("TestVector3" + value); }
public void DeleteKeyNoAutoConvert(int value) { // Arrange SecurePlayerPrefs.UseSecurePrefs = true; SecurePlayerPrefs.AutoConvertUnsecurePrefs = false; PlayerPrefs.SetInt("TestInt" + value, value); SecurePlayerPrefs.SetInt("TestInt" + value, value); // Act SecurePlayerPrefs.DeleteKey("TestInt" + value); // Assert Assert.IsTrue(PlayerPrefs.HasKey("TestInt" + value), "The standard key was removed"); Assert.IsFalse(SecurePlayerPrefs.HasKey("TestInt" + value), "The encrypted key was not removed"); // Cleanup PlayerPrefs.DeleteKey("TestInt" + value); }
public void GetVector3Encrypted() { // Arrange var value = new Vector3(10, 20, 30); // can't pass objects as as paraameter so single hardcoded test SecurePlayerPrefs.UseSecurePrefs = true; SecurePlayerPrefs.AutoConvertUnsecurePrefs = false; SecurePlayerPrefs.DeleteKey("TestVector3" + value); // Act SecurePlayerPrefs.SetVector3("TestVector3" + value, value); // Assert Assert.AreEqual(value, SecurePlayerPrefs.GetVector3("TestVector3" + value), "The value could not be decrypted"); // Cleanup SecurePlayerPrefs.DeleteKey("TestVector3" + value); }