public override void OnShow() { bool bRated = false; if (PlayerPrefs.HasKey(PlayerPrefHandler.keyRateUs) == false) { PlayerPrefs.SetInt(PlayerPrefHandler.keyRateUs, 0); } else { if (PlayerPrefs.GetInt(PlayerPrefHandler.keyRateUs) == 1) { bRated = true; } } if (bRated) { buttonRateUs.gameObject.SetActive(false); } else { buttonRateUs.gameObject.SetActive(true); } if (!bPokktInitialized) { bPokktInitialized = true; pokktConfig = new PokktConfig(); pokktConfig.setSecurityKey("0c264c7465abbe0bf7327b59cd86bffd"); pokktConfig.setApplicationId("b9ae5052bc5209c0b9fc026d5598eba5"); pokktConfig.setIntegrationType(PokktIntegrationType.INTEGRATION_TYPE_ALL); pokktConfig.setAutoCacheVideo(Storage.getAutoCaching()); PokktManager.initPokkt(pokktConfig); pokktConfig.setThirdPartyUserId("123456"); //StartCacheButton.gameObject.SetActive(!Storage.getAutoCaching()); // set default skip time pokktConfig.setDefaultSkipTime(10); pokktConfig.setScreenName("sample_screen"); // handle pokkt video ad events PokktManager.Dispathcer.VideoClosedEvent += (string message) => { //dialogBox.Show ("Info", message, false, "", this.gameObject); //GiveCoinToUserAfterWatchingAds(); }; PokktManager.Dispathcer.VideoSkippedEvent += (string message) => { //dialogBox.Show ("Info", message, false, "", this.gameObject); dialogBox.Show("Info", "Skipping ads will not give you any GemuGold.", false, "", this.gameObject); }; PokktManager.Dispathcer.VideoCompletedEvent += (string message) => { //dialogBox.Show ("Info", message, false, "", this.gameObject); //GiveCoinToUserAfterWatchingAds(); }; PokktManager.Dispathcer.VideoGratifiedEvent += (string message) => { //dialogBox.Show ("Info", message, false, "", this.gameObject); //_totalPointsEarned += float.Parse(message); //PointsEarned.text = "Points Earned: " + _totalPointsEarned.ToString(); //StatusMessage.text = "Points earned from last video: " + message; GiveCoinToUserAfterWatchingAds(); }; PokktManager.Dispathcer.VideoDisplayedEvent += (string message) => { //dialogBox.Show ("Info", message, false, "", this.gameObject); //StatusMessage.text = message; }; PokktManager.Dispathcer.DownloadCompletedEvent += OnDownloadCompleted; PokktManager.Dispathcer.DownloadFailedEvent += (string message) => { dialogBox.Show("Info", message, false, "", this.gameObject); //StatusMessage.text = message; }; // if video is available then enable the buttons if (PokktManager.IsVideoAvailable()) { float vc = PokktManager.GetVideoVc(); OnDownloadCompleted(vc.ToString()); } } }
void Awake() { // You will need PokktConfig at different method calls // it is single place fro all sdk related info pokktConfig = new PokktConfig(); // set pokkt params pokktConfig.setSecurityKey("iJ02lJss0M"); pokktConfig.setApplicationId("a2717a45b835b5e9f50284a38d62a74e"); pokktConfig.setIntegrationType(PokktIntegrationType.INTEGRATION_TYPE_ALL); pokktConfig.setAutoCacheVideo(Storage.getAutoCaching()); // this will be a unique id per user from developer side // developer is free to choose any String data point. pokktConfig.setThirdPartyUserId("123456"); // enable 'Start Caching' button in case of manual caching StartCacheButton.gameObject.SetActive(!Storage.getAutoCaching()); // set default skip time pokktConfig.setDefaultSkipTime(10); pokktConfig.setScreenName("sample_screen"); // handle pokkt video ad events PokktManager.Dispathcer.VideoClosedEvent += (string message) => { StatusMessage.text = message; }; PokktManager.Dispathcer.VideoSkippedEvent += (string message) => { StatusMessage.text = message; }; PokktManager.Dispathcer.VideoCompletedEvent += (string message) => { StatusMessage.text = message; }; PokktManager.Dispathcer.VideoGratifiedEvent += (string message) => { _totalPointsEarned += float.Parse(message); PointsEarned.text = "Points Earned: " + _totalPointsEarned.ToString(); StatusMessage.text = "Points earned from last video: " + message; }; PokktManager.Dispathcer.VideoDisplayedEvent += (string message) => { StatusMessage.text = message; }; PokktManager.Dispathcer.DownloadCompletedEvent += OnDownloadCompleted; PokktManager.Dispathcer.DownloadFailedEvent += (string message) => { StatusMessage.text = message; }; // it is mandatory to call init. PokktManager.initPokkt(pokktConfig); // if video is available then enable the buttons if (PokktManager.IsVideoAvailable()) { float vc = PokktManager.GetVideoVc(); OnDownloadCompleted(vc.ToString()); } }