Beispiel #1
0
        public static void Request(Segment segment, System.Action <bool> callback)
        {
            var zone = segment.ZoneId;

            Debug.Log("FunAd.Rewarded.Request: " + zone);

            if (zone.IsNullOrEmpty())
            {
                admono.Call(callback, false);
                return;
            }

            if (segment.IsReady)
            {
                admono.Call(callback, true);
                return;
            }

#if ABR || TAPSELL
            TapsellPlus.RequestRewardedVideoAd(zone,
                                               zoneId =>
            {
                segment.ResponseZone = zoneId.zoneId;
                callback?.Invoke(true);
                OnLoaded?.Invoke(segment);
            },
                                               error =>
            {
                Debug.Log("Tapsell.RequestRewardedVideo.Error: " + error.message);
                callback?.Invoke(false);
                OnError?.Invoke(segment);
            });
#elif UAD
            UnityAd.Load(zone, success =>
            {
                if (success)
                {
                    segment.ResponseZone = zone;
                    callback?.Invoke(true);
                    OnLoaded?.Invoke(segment);
                }
                else
                {
                    OnError?.Invoke(segment);
                    callback?.Invoke(false);
                }
            });
#elif ADMOB
            AdMob.RequestRewarded(zone,
                                  zid =>
            {
                segment.ResponseZone = zone;
                callback?.Invoke(true);
                OnLoaded?.Invoke(segment);
            },
                                  error =>
            {
                Debug.Log("AdMob.RequestRewarded.Error: " + error);
                callback?.Invoke(false);
                OnError?.Invoke(segment);
            });
#else
            callback?.Invoke(false);
#endif
        }