public void OnPurchaseComplete(Product product) { switch (product.definition.id) { case _10Coins: PlayerPrefsSafe.SetInt("savescoins", _secureCoin.Coin + 10); break; case _50Coins: PlayerPrefsSafe.SetInt("savescoins", _secureCoin.Coin + 50); break; case _100Coins: PlayerPrefsSafe.SetInt("savescoins", _secureCoin.Coin + 100); break; case _bird: //code break; case _noAds: PurchaseSubscription(); break; } }
// Start is called before the first frame update void Start() { if (PlayerPrefsSafe.HasKey("TotalCoals")) { coals = PlayerPrefsSafe.GetFloat("TotalCoals"); totalCoals.text = ((float)coals).ToString("0"); } PlayerPrefsSafe.SetFloat("IsBought" + 0, 1); for (int i = 1; i < skins.Count; i++) { if (!PlayerPrefsSafe.HasKey("IsBought" + i)) { PlayerPrefsSafe.SetFloat("IsBought" + i, 0); } } if (PlayerPrefsSafe.HasKey("SelectedSkin")) { Instantiate(skins[currIndex], skinSpawnPoint.position, Quaternion.identity); FindObjectOfType <PlayerMovement>().enabled = false; GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <AudioSource>().Stop(); if (PlayerPrefsSafe.GetFloat("SelectedSkin") != 0) { selectedText.gameObject.SetActive(false); selectButton.gameObject.SetActive(true); } } else { PlayerPrefsSafe.SetFloat("SelectedSkin", 0f); Instantiate(skins[currIndex], skinSpawnPoint.position, Quaternion.identity); FindObjectOfType <PlayerMovement>().enabled = false; GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <AudioSource>().Stop(); } }
public void onRewardedVideoFinished(double amount, string name) { PlayerPrefsSafe.SetFloat("TotalCoals", PlayerPrefsSafe.GetFloat("TotalCoals") + coals); coals *= 2; endCoalsUI.text = ((float)coals).ToString("0"); GameObject.Find("Coals x2 Button").GetComponent <Button>().interactable = false; }
//Проверка покупки подписки. //Subscription purchase verification. public void OnInitialized(IStoreController controller, IExtensionProvider extensions) { m_GooglePlayStoreExtensions = extensions.GetExtension <IGooglePlayStoreExtensions>(); m_StoreController = controller; m_StoreExtensionProvider = extensions; Dictionary <string, string> Dict = m_GooglePlayStoreExtensions.GetProductJSONDictionary(); foreach (Product item in controller.products.all) { if (item.receipt != null) { if (item.definition.type == ProductType.Subscription) { string json = (Dict == null || !Dict.ContainsKey(item.definition.storeSpecificId)) ? null : Dict[item.definition.storeSpecificId]; SubscriptionManager s = new SubscriptionManager(item, json); SubscriptionInfo info = s.getSubscriptionInfo(); if (info.getProductId() == "pay_noads") { if (info.isSubscribed() == Result.True) { PlayerPrefsSafe.SetInt("ADS", 1); } else { PlayerPrefsSafe.SetInt("ADS", 0); } } } } } }
private void Start() { mainCamera = Camera.main; gems = PlayerPrefsSafe.GetInt("gems", 0); GemsText.text = gems.ToString(); transform.Translate(Vector3.up * PlayerPrefsSafe.GetFloat("distance", 0)); }
void Start() { Appodeal.setRewardedVideoCallbacks(this); if (PlayerPrefsSafe.HasKey("HighestScore")) { highScore = PlayerPrefsSafe.GetFloat("HighestScore"); } highScoreUI.text = "HI " + ((float)highScore).ToString("0"); }
public void EndGame() { SetPlayerBrightness(0, 0, 0); fireSoundsSource.Stop(); musicSource.Stop(); isLose = true; PlayerPrefsSafe.SetFloat("TotalCoals", PlayerPrefsSafe.GetFloat("TotalCoals") + coals); Invoke("GameResults", restartTime); }
private void GameResults() { if (highScore < score) { PlayerPrefsSafe.SetFloat("HighestScore", score); } endScoreUI.text = ((float)score).ToString("0"); endCoalsUI.text = ((float)coals).ToString("0"); gameOverPanel.SetActive(true); }
// Start is called before the first frame update void Start() { Instantiate(skins[(int)PlayerPrefsSafe.GetFloat("SelectedSkin")], transform.position, Quaternion.identity); Instantiate(cameraPrefab, cameraSpawnPoint.position, Quaternion.identity); FindObjectOfType <GameManager>().SetGameSettings(); Instantiate(obstacleDestroyerPrefab, new Vector3(transform.position.x, transform.position.y, transform.position.z - obstacleDestroyerOffsetZ), Quaternion.identity); FindObjectOfType <PlayerCollision>().EdgeInit(); FindObjectOfType <ChunkManager>().GetPlayerTransform(); }
private void OnPurchaseSubscription(PurchaseEventArgs args) { var id = args.purchasedProduct.definition.id; if (id == "pay_noads") { PlayerPrefsSafe.SetInt("ADS", 1); return; } }
private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.layer == 8) { gems++; PlayerPrefsSafe.SetInt("gems", gems); GemsText.text = gems.ToString(); Destroy(other.gameObject); } else if (other.gameObject.layer == 9) { PlayerPrefsSafe.DeleteKey("gems"); PlayerPrefsSafe.DeleteKey("distance"); lost = true; SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); } }
public void BuySkin() { if (currPrice <= coals) { coals -= currPrice; PlayerPrefsSafe.SetFloat("TotalCoals", coals); PlayerPrefsSafe.SetFloat("IsBought" + currIndex, 1); totalCoals.text = ((float)coals).ToString("0"); selectButton.gameObject.SetActive(true); buyButton.gameObject.SetActive(false); priceText.gameObject.SetActive(false); } else { notEnoughMoneyPanel.SetActive(true); } }
private void Update() { if (Input.GetMouseButton(0)) { Vector3 world = mainCamera.ScreenToWorldPoint(Input.mousePosition); world.z = 0; transform.position = world; } else { transform.Translate(Vector3.up * Time.deltaTime * 5); } if (!lost) { PlayerPrefsSafe.SetFloat("distance", transform.position.y); } }
private void OnPurchaseConsumable(PurchaseEventArgs args) { var id = args.purchasedProduct.definition.id; var payId = _purchaseManager.C_PRODUCTS; int[] coinsValue = { 10, 50, 100 }; for (int i = 0; i < payId.Length; i++) { if (id != payId[i]) { continue; } _secureCoin.CoinUpdate(); PlayerPrefsSafe.SetInt("savescoins", _secureCoin.Coin + coinsValue[i]); break; } _txtCoinsInShop.text = $"{PlayerPrefsSafe.GetInt("savescoins")}"; }
// Start is called before the first frame update void Start() { if (!PlayerPrefs.HasKey("ResultGDPR")) { gdprPanel.SetActive(true); } else { CheckConsent(); } if (PlayerPrefsSafe.HasKey("TotalCoals")) { totalCoals.text = PlayerPrefsSafe.GetFloat("TotalCoals").ToString("0"); } if (PlayerPrefsSafe.HasKey("HighestScore")) { highScore.text = "HI " + PlayerPrefsSafe.GetFloat("HighestScore").ToString("0"); } }
public void NextSkin() { if (currIndex < skins.Count - 1) { prevButton.gameObject.SetActive(true); currIndex++; Destroy(GameObject.FindGameObjectWithTag("Player").gameObject); var tmpSkin = Instantiate(skins[currIndex], skinSpawnPoint.position, Quaternion.identity); FindObjectOfType <PlayerMovement>().enabled = false; tmpSkin.GetComponentInChildren <AudioSource>().Stop(); if (PlayerPrefsSafe.GetFloat("SelectedSkin") != currIndex) { if (PlayerPrefsSafe.GetFloat("IsBought" + currIndex) == 0) { selectedText.gameObject.SetActive(false); selectButton.gameObject.SetActive(false); buyButton.gameObject.SetActive(true); priceText.gameObject.SetActive(true); currPrice = FindObjectOfType <Skin>().price; priceText.text = currPrice.ToString(); } else { buyButton.gameObject.SetActive(false); priceText.gameObject.SetActive(false); selectedText.gameObject.SetActive(false); selectButton.gameObject.SetActive(true); } } else { buyButton.gameObject.SetActive(false); priceText.gameObject.SetActive(false); selectedText.gameObject.SetActive(true); selectButton.gameObject.SetActive(false); } } if (currIndex == skins.Count - 1) { nextButton.gameObject.SetActive(false); } }
public void SelectSkin() { PlayerPrefsSafe.SetFloat("SelectedSkin", currIndex); selectedText.gameObject.SetActive(true); selectButton.gameObject.SetActive(false); }
private void Start() { transform.Translate(Vector3.up * PlayerPrefsSafe.GetFloat("distance", 0)); prevY = transform.position.y; }