IEnumerator ShowVideoRewardedCoroutine(Action success, Action failed) { if (statusVideoRewarded != StatusVideoRewarded.Loaded) { failed?.Invoke(); yield break; } ui.Block(); music.SetVolume(0f); Log("Ads - Appodeal - Predicted eCPM for Rewarded Video: " + Appodeal.getPredictedEcpm(Appodeal.REWARDED_VIDEO)); Log($"Ads - Appodeal - Reward currency: {Appodeal.getRewardParameters().Key}, amount: {Appodeal.getRewardParameters().Value}"); Appodeal.show(Appodeal.REWARDED_VIDEO); while (statusVideoRewarded != StatusVideoRewarded.Closed) { yield return(null); } Log("Ads - Appodeal Result Finished"); Analytic.EventPropertiesImportant("Ads", "Appodeal VideoRewarded Result", "Finished"); ui.Unblock(); music.SetVolume(music.volumeNormal); success?.Invoke(); }
public virtual void Activate() { ObscuredPrefs.SetString(id.ToString(), "activated"); Analytic.EventPropertiesImportant("Promocode", new Dictionary <string, object>() { { "code", code }, { "action", Json.Serialize(action) } }); }
IEnumerator ShowCoroutine(string id, Action success, Action failed) { if (!Advertisement.isInitialized || status == Status.Shown || !isReady(id)) { failed?.Invoke(); yield break; } ui.Block(); music.SetVolume(0f); Advertisement.Show(id); //float startTime = Time.time; //while (statusInterstitial != StatusInterstitial.Shown || Time.time - startTime < 5f) yield return null; status = Status.Shown; while (status == Status.Shown) { yield return(null); } Analytic.EventPropertiesImportant("Ads", $"Unity {id} Result", status); music.SetVolume(music.volumeNormal); ui.Unblock(); if (status == Status.Finished) { success?.Invoke(); } else { failed?.Invoke(); } }