Пример #1
0
	public static void playAd( Dictionary<string,object> options, string placement)
	{
		if (sdk != null && sdk.IsAdPlayable(placement)) {
			cfg = new AdConfig ();
			if (options.ContainsKey("userTag") && options["userTag"] is string)
				cfg.SetUserId ((string) options["userTag"]);
			cfg.SetSoundEnabled (_isSoundEnabled);
			if (options.ContainsKey("orientation")) {
				if (options ["orientation"] is bool) {
					cfg.SetOrientation (((bool)options ["orientation"]) ? VungleSDKProxy.DisplayOrientations.Landscape : VungleSDKProxy.DisplayOrientations.AutoRotate);
				}
				if (options ["orientation"] is VungleAdOrientation) {
					cfg.SetOrientation(((VungleAdOrientation)options ["orientation"] == VungleAdOrientation.AutoRotate) ? VungleSDKProxy.DisplayOrientations.AutoRotate : VungleSDKProxy.DisplayOrientations.Landscape);
				}
			} else
				cfg.SetOrientation((_orientation == VungleAdOrientation.AutoRotate) ? VungleSDKProxy.DisplayOrientations.AutoRotate : VungleSDKProxy.DisplayOrientations.Landscape);
			if (options.ContainsKey("alertText") && options["alertText"] is string)
				cfg.SetIncentivizedDialogBody ((string) options["alertText"]);
			if (options.ContainsKey("alertTitle") && options["alertTitle"] is string)
				cfg.SetIncentivizedDialogTitle ((string) options["alertTitle"]);
			if (options.ContainsKey("closeText") && options["closeText"] is string)
				cfg.SetIncentivizedDialogCloseButton ((string) options["closeText"]);
			if (options.ContainsKey("continueText") && options["continueText"] is string)
				cfg.SetIncentivizedDialogContinueButton ((string) options["continueText"]);
			if (options.ContainsKey("backImmediately") && options["backImmediately"] is string)
				cfg.SetBackButtonImmediatelyEnabled ((bool) options["backImmediately"]);
            if (options.ContainsKey("flexCloseSec") && options["flexCloseSec"] is string) {
                int seconds = 0;
                Int32.TryParse((string)options["flexCloseSec"], out seconds);
                sdk.SetFlexViewCloseTimeInSec(placement, seconds);
            }
			sdk.PlayAd(cfg, placement);
		}
	}
Пример #2
0
 public static void playAdEx(Dictionary <string, object> options)
 {
     if (sdk != null && sdk.AdPlayable)
     {
         cfg = new AdConfig();
         if (options.ContainsKey("incentivized") && options["incentivized"] is bool)
         {
             cfg.SetIncentivized((bool)options["incentivized"]);
         }
         if (options.ContainsKey("userTag") && options["userTag"] is string)
         {
             cfg.SetUserId((string)options["userTag"]);
         }
         cfg.SetSoundEnabled(_isSoundEnabled);
         if (options.ContainsKey("orientation") && options["orientation"] is bool)
         {
             cfg.SetOrientation(((bool)options["orientation"])?VungleSDKProxy.DisplayOrientations.AutoRotate:VungleSDKProxy.DisplayOrientations.Landscape);
         }
         else
         {
             cfg.SetOrientation((_orientation == VungleAdOrientation.AutoRotate)?VungleSDKProxy.DisplayOrientations.AutoRotate:VungleSDKProxy.DisplayOrientations.Landscape);
         }
         if (options.ContainsKey("placement") && options["placement"] is string)
         {
             cfg.SetPlacement((string)options["placement"]);
         }
         if (options.ContainsKey("alertText") && options["alertText"] is string)
         {
             cfg.SetIncentivizedDialogBody((string)options["alertText"]);
         }
         if (options.ContainsKey("alertTitle") && options["alertTitle"] is string)
         {
             cfg.SetIncentivizedDialogTitle((string)options["alertTitle"]);
         }
         if (options.ContainsKey("closeText") && options["closeText"] is string)
         {
             cfg.SetIncentivizedDialogCloseButton((string)options["closeText"]);
         }
         if (options.ContainsKey("continueText") && options["continueText"] is string)
         {
             cfg.SetIncentivizedDialogContinueButton((string)options["continueText"]);
         }
         if (options.ContainsKey("backImmediately") && options["backImmediately"] is string)
         {
             cfg.SetBackButtonImmediatelyEnabled((bool)options["backImmediately"]);
         }
         string[] extra = cfg.GetExtra();
         if (options.ContainsKey("key1") && options["key1"] is string)
         {
             extra[0] = (string)options["key1"];
         }
         if (options.ContainsKey("key2") && options["key2"] is string)
         {
             extra[1] = (string)options["key2"];
         }
         if (options.ContainsKey("key3") && options["key3"] is string)
         {
             extra[2] = (string)options["key3"];
         }
         if (options.ContainsKey("key4") && options["key4"] is string)
         {
             extra[3] = (string)options["key4"];
         }
         if (options.ContainsKey("key5") && options["key5"] is string)
         {
             extra[4] = (string)options["key5"];
         }
         if (options.ContainsKey("key6") && options["key6"] is string)
         {
             extra[5] = (string)options["key6"];
         }
         if (options.ContainsKey("key7") && options["key7"] is string)
         {
             extra[6] = (string)options["key7"];
         }
         if (options.ContainsKey("key8") && options["key8"] is string)
         {
             extra[7] = (string)options["key8"];
         }
         sdk.PlayAd(cfg);
     }
 }
	public static void playAdEx( Dictionary<string,object> options)
	{
		if (sdk != null && sdk.AdPlayable) {
			cfg = new AdConfig ();
			if (options.ContainsKey("incentivized") && options["incentivized"] is bool)
				cfg.SetIncentivized ((bool) options["incentivized"]);
			if (options.ContainsKey("userTag") && options["userTag"] is string)
				cfg.SetUserId ((string) options["userTag"]);
			cfg.SetSoundEnabled (_isSoundEnabled);
			if (options.ContainsKey("orientation") && options["orientation"] is bool)
				cfg.SetOrientation(((bool)options["orientation"])?VungleSDKProxy.DisplayOrientations.AutoRotate:VungleSDKProxy.DisplayOrientations.Landscape);
			else
				cfg.SetOrientation((_orientation == VungleAdOrientation.AutoRotate)?VungleSDKProxy.DisplayOrientations.AutoRotate:VungleSDKProxy.DisplayOrientations.Landscape);
			if (options.ContainsKey("placement") && options["placement"] is string)
				cfg.SetPlacement ((string) options["placement"]);
			if (options.ContainsKey("alertText") && options["alertText"] is string)
				cfg.SetIncentivizedDialogBody ((string) options["alertText"]);
			if (options.ContainsKey("alertTitle") && options["alertTitle"] is string)
				cfg.SetIncentivizedDialogTitle ((string) options["alertTitle"]);
			if (options.ContainsKey("closeText") && options["closeText"] is string)
				cfg.SetIncentivizedDialogCloseButton ((string) options["closeText"]);
			if (options.ContainsKey("continueText") && options["continueText"] is string)
				cfg.SetIncentivizedDialogContinueButton ((string) options["continueText"]);
			if (options.ContainsKey("backImmediately") && options["backImmediately"] is string)
				cfg.SetBackButtonImmediatelyEnabled ((bool) options["backImmediately"]);
			string[] extra = cfg.GetExtra();
			if (options.ContainsKey("key1") && options["key1"] is string)
				extra[0] = (string) options["key1"];
			if (options.ContainsKey("key2") && options["key2"] is string)
				extra[1] = (string) options["key2"];
			if (options.ContainsKey("key3") && options["key3"] is string)
				extra[2] = (string) options["key3"];
			if (options.ContainsKey("key4") && options["key4"] is string)
				extra[3] = (string) options["key4"];
			if (options.ContainsKey("key5") && options["key5"] is string)
				extra[4] = (string) options["key5"];
			if (options.ContainsKey("key6") && options["key6"] is string)
				extra[5] = (string) options["key6"];
			if (options.ContainsKey("key7") && options["key7"] is string)
				extra[6] = (string) options["key7"];
			if (options.ContainsKey("key8") && options["key8"] is string)
				extra[7] = (string) options["key8"];
			sdk.PlayAd (cfg);
		}
	}