コード例 #1
0
        public override void Show(string zoneId, string adapterId, ShowOptions options = null)
        {
            if (options != null && options.pause == false)
            {
                Utils.LogWarning("Video ads will always pause engine, ignoring pause=false in ShowOptions");
            }

            Dictionary <string, object> configuration = _configurations[zoneId + adapterId];

            if (configuration != null && configuration.ContainsKey("network"))
            {
                UnityAds.setNetwork((string)configuration["network"]);
            }
            string videoZoneId = null;
            string rewardItem  = "";

            if (configuration != null && configuration.ContainsKey("zone"))
            {
                videoZoneId = (string)configuration["zone"];
            }
            if (configuration != null && configuration.ContainsKey("rewardItem"))
            {
                rewardItem = (string)configuration["rewardItem"];
            }

            UnityAds.OnShow           += UnityAdsShow;
            UnityAds.OnHide           += UnityAdsHide;
            UnityAds.OnVideoCompleted += UnityAdsVideoCompleted;
            UnityAds.OnVideoStarted   += UnityAdsVideoStarted;

            ShowOptionsExtended extendedOptions = options as ShowOptionsExtended;

            if (extendedOptions != null && extendedOptions.gamerSid != null && extendedOptions.gamerSid.Length > 0)
            {
                if (!UnityAds.show(videoZoneId, rewardItem, new Dictionary <string, string>()
                {
                    { "sid", extendedOptions.gamerSid }
                }))
                {
                    triggerEvent(EventType.error, EventArgs.Empty);
                }
            }
            else
            {
                if (!UnityAds.show(videoZoneId, rewardItem))
                {
                    triggerEvent(EventType.error, EventArgs.Empty);
                }
            }
        }
コード例 #2
0
 // Token: 0x06000162 RID: 354 RVA: 0x00005084 File Offset: 0x00003284
 public static bool show(string zoneId, string rewardItemKey, Dictionary <string, string> options)
 {
     if (!UnityAds.isShowing)
     {
         UnityAds.isShowing = true;
         if (UnityAds.SharedInstance)
         {
             string options2 = UnityAds.parseOptionsDictionary(options);
             if (UnityAdsExternal.show(zoneId, rewardItemKey, options2))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
コード例 #3
0
        // Token: 0x0600015F RID: 351 RVA: 0x00004F9C File Offset: 0x0000319C
        public void Show(string zoneId = null, ShowOptions options = null)
        {
            string text = null;

            UnityAds._resultDelivered = false;
            if (options != null)
            {
                if (options.resultCallback != null)
                {
                    UnityAds.resultCallback = options.resultCallback;
                }
                ShowOptionsExtended showOptionsExtended = options as ShowOptionsExtended;
                if (showOptionsExtended != null && showOptionsExtended.gamerSid != null && showOptionsExtended.gamerSid.Length > 0)
                {
                    text = showOptionsExtended.gamerSid;
                }
                else
                {
                    text = options.gamerSid;
                }
            }
            if (!UnityAds.isInitialized || UnityAds.isShowing)
            {
                UnityAds.deliverCallback(ShowResult.Failed);
                return;
            }
            if (text != null)
            {
                if (!UnityAds.show(zoneId, string.Empty, new Dictionary <string, string>
                {
                    {
                        "sid",
                        text
                    }
                }))
                {
                    UnityAds.deliverCallback(ShowResult.Failed);
                }
            }
            else if (!UnityAds.show(zoneId))
            {
                UnityAds.deliverCallback(ShowResult.Failed);
            }
        }
コード例 #4
0
        // Token: 0x0600015E RID: 350 RVA: 0x00004F08 File Offset: 0x00003108
        public static Dictionary <string, string> getRewardItemDetailsWithKey(string rewardItemKey)
        {
            Dictionary <string, string> dictionary = new Dictionary <string, string>();
            string text = string.Empty;

            text = UnityAdsExternal.getRewardItemDetailsWithKey(rewardItemKey);
            if (text != null)
            {
                List <string> list = new List <string>(text.Split(new char[]
                {
                    ';'
                }));
                Utils.LogDebug("UnityAndroid: getRewardItemDetailsWithKey() rewardItemDataString=" + text);
                if (list.Count == 2)
                {
                    dictionary.Add(UnityAds.getRewardItemNameKey(), list.ToArray().GetValue(0).ToString());
                    dictionary.Add(UnityAds.getRewardItemPictureKey(), list.ToArray().GetValue(1).ToString());
                }
            }
            return(dictionary);
        }
コード例 #5
0
        private void GatherNetworks(List <object> zones)
        {
            HashSet <string> networks = new HashSet <string>();

            foreach (object zone in zones)
            {
                List <object> adapters = (List <object>)((Dictionary <string, object>)zone)["adapters"];
                foreach (object adapter in adapters)
                {
                    Dictionary <string, object> adapterJson = (Dictionary <string, object>)adapter;
                    string className = (string)adapterJson["className"];
                    if (className.Equals("VideoAdAdapter"))
                    {
                        Dictionary <string, object> parameters = (Dictionary <string, object>)adapterJson["parameters"];
                        string network = (string)parameters["network"];
                        networks.Add(network);
                    }
                }
            }
            UnityAds.setNetworks(networks);
        }
コード例 #6
0
        public override void Show(string zoneId, string adapterId, ShowOptions options = null)
        {
            Dictionary <string, object> configuration = _configurations[zoneId + adapterId];

            if (configuration != null && configuration.ContainsKey("network"))
            {
                UnityAds.setNetwork((string)configuration["network"]);
            }
            string videoZoneId = null;
            string rewardItem  = "";

            if (configuration != null && configuration.ContainsKey("zone"))
            {
                videoZoneId = (string)configuration["zone"];
            }
            if (configuration != null && configuration.ContainsKey("rewardItem"))
            {
                rewardItem = (string)configuration["rewardItem"];
            }

            UnityAds.OnShow           += UnityAdsShow;
            UnityAds.OnHide           += UnityAdsHide;
            UnityAds.OnVideoCompleted += UnityAdsVideoCompleted;
            UnityAds.OnVideoStarted   += UnityAdsVideoStarted;

            ShowOptionsExtended extendedOptions = options as ShowOptionsExtended;

            if (extendedOptions != null && extendedOptions.gamerSid != null && extendedOptions.gamerSid.Length > 0)
            {
                UnityAds.show(videoZoneId, rewardItem, new Dictionary <string, string>()
                {
                    { "sid", extendedOptions.gamerSid }
                });
            }
            else
            {
                UnityAds.show(videoZoneId, rewardItem);
            }
        }
コード例 #7
0
 // Token: 0x06000167 RID: 359 RVA: 0x000052C6 File Offset: 0x000034C6
 public void onHide()
 {
     UnityAds.isShowing = false;
     UnityAds.deliverCallback(ShowResult.Skipped);
     Utils.LogDebug("onHide");
 }
コード例 #8
0
 // Token: 0x06000161 RID: 353 RVA: 0x00005077 File Offset: 0x00003277
 public static bool show(string zoneId, string rewardItemKey)
 {
     return(UnityAds.show(zoneId, rewardItemKey, null));
 }
コード例 #9
0
 // Token: 0x06000160 RID: 352 RVA: 0x00005069 File Offset: 0x00003269
 public static bool show(string zoneId = null)
 {
     return(UnityAds.show(zoneId, string.Empty, null));
 }
コード例 #10
0
 // Token: 0x06000123 RID: 291 RVA: 0x00004079 File Offset: 0x00002279
 public static bool IsReady(string zoneId)
 {
     return(UnityAds.canShowZone(zoneId));
 }