public void ShowRewarded() { Debug.Log("rewarded"); if (Enhance.IsRewardedAdReady()) { Enhance.ShowRewardedAd(OnRewardGranted, OnRewardDeclined, OnRewardUnavailable); } }
// Rewarded Ad public void OnShowRewardedAd() { // Check whether a rewarded ad is ready if (!Enhance.IsRewardedAdReady()) { writeLog("Rewarded ad is not ready"); return; } // The ad is ready, show it Enhance.ShowRewardedAd(OnRewardGranted, OnRewardDeclined, OnRewardUnavailable); writeLog("Showing rewarded ad"); }
/** * Show rewarded ad * * @param placement placement type for this ad * @param onRewardGrantedCallback callback executed when the ad reward is granted * @param onRewardDeclinedCallback callback executed when the ad reward is declined * @param onRewardUnavailableCallback callback executed when the ad reward is unavailable */ public static void ShowRewardedAd(string placement, Action <FGLEnhance.RewardType, int> onRewardGrantedCallback, Action onRewardDeclinedCallback, Action onRewardUnavailableCallback) { Action <Enhance.RewardType, int> onGrantedAction = delegate(Enhance.RewardType rType, int rValue) { FGLEnhance.RewardType fglRewardType = FGLEnhance.RewardType.REWARDTYPE_ITEM; if (rType == Enhance.RewardType.COINS) { fglRewardType = FGLEnhance.RewardType.REWARDTYPE_COINS; } onRewardGrantedCallback(fglRewardType, rValue); }; Action onDeclinedAction = delegate() { onRewardDeclinedCallback(); }; Action onUnavailableAction = delegate() { onRewardUnavailableCallback(); }; Enhance.ShowRewardedAd(placement, onGrantedAction, onDeclinedAction, onUnavailableAction); }