示例#1
0
        public override void Show(string zoneId, string adapterId)
        {
            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;

            UnityAds.show(videoZoneId, rewardItem);
        }
示例#2
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);
                }
            }
        }
        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);
            }
        }