// Implement IUnityAdsListener interface methods: public void OnUnityAdsDidFinish(string placementId, UnityEngine.Advertisements.ShowResult showResult) { if (!string.IsNullOrEmpty(currentRewardId) && string.Equals(currentRewardId, placementId)) { // Define conditional logic for each ad completion status: if (showResult == UnityEngine.Advertisements.ShowResult.Finished) { onRewardWatched?.Invoke(new RewardResult(RewardResult.Type.Finished)); // Reward the user for watching the ad to completion. } else if (showResult == UnityEngine.Advertisements.ShowResult.Skipped) { onRewardWatched?.Invoke(new RewardResult(RewardResult.Type.Canceled)); Debug.Log("skipped ad"); // Do not reward the user for skipping the ad. } else if (showResult == UnityEngine.Advertisements.ShowResult.Failed) { onRewardWatched?.Invoke(new RewardResult(RewardResult.Type.LoadFailed)); AdsManager.ShowError(Advertisement.GetPlacementState(currentRewardId).ToString(), placementId); Debug.LogWarning("The ad did not finish due to an error."); } onRewardWatched = null; } else if (onInterstitialClosed != null) //closing a interstitial ads { onInterstitialClosed.Invoke(showResult == UnityEngine.Advertisements.ShowResult.Finished); onInterstitialClosed = null; } }
private void OnRewardedVideoShowResult(UnityEngine.Advertisements.ShowResult result) { _OnRewarded(result == ShowResult.Finished, "Reward", 1); switch (result) { case ShowResult.Failed: { Debug.Log("Rewarded Video Ads failed to show"); } break; case ShowResult.Finished: { Debug.Log("Rewarded Video Ads finished. User rewarded!"); } break; case ShowResult.Skipped: { Debug.Log("Rewarded Video Ads was skipped"); } break; default: break; } }
private void HandleShowResult(UnityEngine.Advertisements.ShowResult result) { switch (result) { case UnityEngine.Advertisements.ShowResult.Finished: { Debug.Log("The ad was successfully shown."); // todo ... // 광고 시청이 완료되었을 때 처리 } break; case UnityEngine.Advertisements.ShowResult.Skipped: { Debug.Log("The ad was skipped before reaching the end."); // todo ... // 광고가 스킵되었을 때 처리 } break; case UnityEngine.Advertisements.ShowResult.Failed: { Debug.LogError("The ad failed to be shown."); // todo ... // 광고 시청에 실패했을 때 처리 } break; } }
public void OnUnityAdsDidFinish(string placementId, ShowResult showResult) { Debug.Log($"class name: {GetType().Name}," + $" method name: {MethodBase.GetCurrentMethod().Name}," + $" placement id: {placementId}," + $" show result: {Enum.GetName(typeof(ShowResult), showResult)}"); }
void UnityAdsCallback(UnityEngine.Advertisements.ShowResult result) { if (result != UnityEngine.Advertisements.ShowResult.Failed) { closing.SendEvent("YesContinue"); GAManager.Instance.GAUnityadsEvent("complete"); AfterWatchingAds(); } else { NoContinue(); } }
void AdCallbackhandler(UnityEngine.Advertisements.ShowResult result) { switch (result) { case UnityEngine.Advertisements.ShowResult.Finished: GameManager.instance.AddCoins(reward); break; case UnityEngine.Advertisements.ShowResult.Skipped: break; case UnityEngine.Advertisements.ShowResult.Failed: break; } }
private void ResultShow(ShowResult result) { switch (result) { case ShowResult.Finished: Debug.Log("Ad Finished. Rewarding player..."); break; case ShowResult.Skipped: Debug.Log("Ad skipped. Son, I am dissapointed in you"); break; case ShowResult.Failed: Debug.Log("I swear this has never happened to me before"); break; } }
private void HandleShowResult(UnityEngine.Advertisements.ShowResult result) { switch (result) { case UnityEngine.Advertisements.ShowResult.Finished: Debug.Log("The ad was successfully shown."); // // YOUR CODE TO REWARD THE GAMER // Give coins etc. break; case UnityEngine.Advertisements.ShowResult.Skipped: Debug.Log("The ad was skipped before reaching the end."); break; case UnityEngine.Advertisements.ShowResult.Failed: Debug.LogError("The ad failed to be shown."); break; } }
/// <summary> /// OnUnityAdsDidFinish. /// </summary> public void OnUnityAdsDidFinish(string placementId, UnityEngine.Advertisements.ShowResult showResult) { #if DEBUG_MY_UNITY_ADS Debug.Log("[" + typeof(MyUnityAdsManager).Name + "] OnUnityAdsDidFinish(): placementId=" + placementId + " | showResult=" + showResult.ToString()); #endif switch (showResult) { case ShowResult.Failed: { if (mDictCallbacks.ContainsKey(placementId) && mDictCallbacks[placementId][0] != null) { mDictCallbacks[placementId][0](); } } break; case ShowResult.Skipped: { if (mDictCallbacks.ContainsKey(placementId) && mDictCallbacks[placementId][1] != null) { mDictCallbacks[placementId][1](); } } break; case ShowResult.Finished: { if (mDictCallbacks.ContainsKey(placementId) && mDictCallbacks[placementId][2] != null) { mDictCallbacks[placementId][2](); } } break; } if (mDictCallbacks.ContainsKey(placementId)) { mDictCallbacks.Remove(placementId); } }
public void OnUnityAdsDidFinish(string placementId, UnityEngine.Advertisements.ShowResult showResult) { VideoAdStatus status = VideoAdStatus.Cancel; switch (showResult) { case ShowResult.Failed: status = VideoAdStatus.Fail; break; case ShowResult.Skipped: status = VideoAdStatus.Cancel; break; case ShowResult.Finished: default: status = VideoAdStatus.Success; break; } onFinish.Invoke(status); }
public void OnUnityAdsDidFinish(string placementId, ShowResult showResult) { AdFinished?.Invoke(this, new AdFinishEventArgs(placementId, showResult)); }