private IEnumerator RewardedBasedVideoClosedDelayCoroutine(object sender, EventArgs args, AdPlacement placement) { yield return(new WaitForEndOfFrame()); yield return(new WaitForEndOfFrame()); // Ad is not playing anymore. mIsRewardedAdPlaying = false; // If the ad was completed, the "rewarded" event should be fired previously, // setting the completed bool to true. Otherwise the ad was skipped. // Events are raised on main thread. Action callback = mIsRewardedAdCompleted ? GetRewardedAdCompletedAction(placement) : GetRewardedAdSkippedAction(placement); callback(); // Reset the completed flag. mIsRewardedAdCompleted = false; //Destroy the RewardedAd to create a new one. DestroyRewardedAds(placement); if (OnRewardedAdClosed != null) { OnRewardedAdClosed.Invoke(sender, args); } }
public virtual void onRewardedAdClosed(string placementId, bool isRewarded) { AdiveryEventExecutor.ExecuteInUpdate(() => { AdiveryReward reward = new AdiveryReward(); reward.PlacementId = placementId; reward.IsRewarded = isRewarded; OnRewardedAdClosed?.Invoke(this, reward); }); }
private void HandleAdMobRewardBasedVideoClosed(object sender, EventArgs args) { // Ad is not playing anymore. mIsRewardedAdPlaying = false; // If the ad was completed, the "rewarded" event should be fired previously, // setting the completed bool to true. Otherwise the ad was skipped. // Events are raised on main thread. Action callback = mIsRewardedAdCompleted ? GetRewardedAdCompletedAction() : GetRewardedAdSkippedAction(); RuntimeHelper.RunOnMainThread(callback); // Reset the completed flag. mIsRewardedAdCompleted = false; if (OnRewardedAdClosed != null) { OnRewardedAdClosed.Invoke(sender, args); } }