private AdConfig LoadDefaultConfig() { AdConfig adConfig = null; string @string = PlayerPrefs.GetString("adsconfig", string.Empty); if (!string.IsNullOrEmpty(@string)) { adConfig = JsonUtility.FromJson <AdConfig>(@string); } FMLogger.vCore("cfg str: " + @string); if (adConfig == null) { adConfig = ((!this.isTablet) ? AdConfig.DefaultPhone() : AdConfig.DefaultTablet()); } if (string.IsNullOrEmpty(adConfig.bannerAdUnit)) { adConfig.bannerAdUnit = ((!this.isTablet) ? "f22e60410d82403aa5e0fb791ef9c153" : "1253b5589a4d45869288611de14229d6"); FMLogger.vAds("cfg fix banner unit"); } if (string.IsNullOrEmpty(adConfig.fsAdUnit)) { adConfig.fsAdUnit = ((!this.isTablet) ? "72bb0678c400487b8d1a941944fa6888" : "8cae328870984a9987623f9c6e52b25d"); FMLogger.vAds("cfg fix fs unit"); } if (string.IsNullOrEmpty(adConfig.rewardAdUnit)) { adConfig.rewardAdUnit = ((!this.isTablet) ? "6bc3898062484e71a114d0ab59cb1c78" : "0543e571406140dd96252ac1351b99f5"); FMLogger.vAds("cfg fix reward unit"); } this.SaveConfig(adConfig); FMLogger.vAds("loaded saved cfg: " + adConfig); return(adConfig); }
void Start() { // For Test // AdManager.Initialize(); // For Production AdConfig adConfig = new AdConfig(); adConfig.SetApiKey(AdNetwork.Dclick, "test"); adConfig.SetApiKey(AdNetwork.Google, "ca-app-pub-3940256099942544~3347511713"); adConfig.SetUnitId(AdNetwork.Dclick, AdType.Banner, "test/test"); adConfig.SetUnitId(AdNetwork.Google, AdType.Banner, "ca-app-pub-3940256099942544/6300978111"); adConfig.SetUnitId(AdNetwork.Dclick, AdType.Interstitial, "test/test"); adConfig.SetUnitId(AdNetwork.Google, AdType.Interstitial, "ca-app-pub-3940256099942544/1033173712"); adConfig.SetUnitId(AdNetwork.Dclick, AdType.Rewarded, "test/test"); adConfig.SetUnitId(AdNetwork.Google, AdType.Rewarded, "ca-app-pub-3940256099942544/5224354917"); AdManager.Initialize(adConfig); // Load Ads this.LoadBannerAd(); this.LoadInterstitialAd(); this.LoadRewardedAd(); }
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); } }
public void PlayAd(Dictionary <string, object> options, string placementId) { InvokeSafelyOnUIThreadAsync(delegate { if (sdk != null && sdk.IsAdPlayable(placementId)) { if (options == null) { options = new Dictionary <string, object>(); } cfg = new AdConfig(); SetAdConfig(cfg, options); if (options.ContainsKey(OptionConstants.FlexCloseSec) && options[OptionConstants.FlexCloseSec] is string) { int seconds = 0; if (int.TryParse((string)options[OptionConstants.FlexCloseSec], out seconds)) { sdk.SetFlexViewCloseTimeInSec(placementId, seconds); } else { VungleLog.Log(VungleLog.Level.Warning, VungleLog.Context.LogEvent, "PlayAd", "FlexViewCloseTime was not an integer."); } } sdk.PlayAd(cfg, placementId); } }); }
private void SetAdConfig(AdConfig config, Dictionary <string, object> options) { cfg.SetSoundEnabled(this.isSoundEnabled); SetValue <string>(options, OptionConstants.UserTag, cfg.SetUserId); if (options.ContainsKey(OptionConstants.Orientation)) { if (!SetValue(options, OptionConstants.Orientation, cfg.SetOrientation, (bool b) => { return(b ? DisplayOrientations.Landscape : DisplayOrientations.AutoRotate); })) { SetValue(options, OptionConstants.Orientation, cfg.SetOrientation, (VungleAdOrientation vao) => { return((vao == VungleAdOrientation.AutoRotate) ? DisplayOrientations.AutoRotate : DisplayOrientations.Landscape); }); } } else { cfg.SetOrientation((orientation == VungleAdOrientation.AutoRotate) ? DisplayOrientations.AutoRotate : DisplayOrientations.Landscape); } SetValue <string>(options, OptionConstants.AlertText, cfg.SetIncentivizedDialogBody); SetValue <string>(options, OptionConstants.AlertTitle, cfg.SetIncentivizedDialogTitle); SetValue <string>(options, OptionConstants.CloseText, cfg.SetIncentivizedDialogCloseButton); SetValue <string>(options, OptionConstants.ContinueText, cfg.SetIncentivizedDialogContinueButton); SetValue <bool>(options, OptionConstants.BackImmediately, cfg.SetBackButtonImmediatelyEnabled); }
public static AdConfig DefaultTablet() { return(new AdConfig { placements = new List <AdPlacement> { AdPlacement.Solved, AdPlacement.GameboardStart }, chances = new List <int> { 100, 100 }, interval = 30, startInterval = 90, appLaunchDelay = 3f, bannerAdUnit = "1253b5589a4d45869288611de14229d6", fsAdUnit = "8cae328870984a9987623f9c6e52b25d", rewardAdUnit = "0543e571406140dd96252ac1351b99f5", fsInternalOnReward = 5, bannerLoadDelay = 10, bannerShowTime = 15, adsTest = false, bannerPos = BannerPosition.Bottom, bannerPlaces = new List <BannerPlacement> { BannerPlacement.Gameboard }, adsDisabled = false, rewardConfig = AdConfig.DefaultRewardConfig() }); }
public static AdConfig DefaultPhone() { return(new AdConfig { placements = new List <AdPlacement> { AdPlacement.Solved, AdPlacement.GameboardStart }, chances = new List <int> { 100, 100 }, interval = 30, startInterval = 90, appLaunchDelay = 3f, fsInternalOnReward = 5, bannerLoadDelay = 10, bannerShowTime = 15, adsTest = false, bannerAdUnit = "f22e60410d82403aa5e0fb791ef9c153", fsAdUnit = "72bb0678c400487b8d1a941944fa6888", rewardAdUnit = "6bc3898062484e71a114d0ab59cb1c78", bannerPos = BannerPosition.Bottom, bannerPlaces = new List <BannerPlacement> { BannerPlacement.Gameboard }, adsDisabled = false, rewardConfig = AdConfig.DefaultRewardConfig() }); }
public async void playAdForInMobiInstance(String placement) { AdConfig adConfig = new AdConfig(); adConfig.Orientation = DisplayOrientations.Landscape; adConfig.SoundEnabled = true; await inmobiProvider.PlayAdAsync(adConfig, placement); }
private void GetServerConfig() { this.configRequested = true; string url = this.adsUrl + this.adsUrlQueue; WebGetTask task = new WebGetTask(url, delegate(bool success, string text) { if (!this.IsEnabled()) { FMLogger.vAds("recieved ads config, but ads is off"); return; } if (success && !string.IsNullOrEmpty(text)) { try { byte[] bytes = Convert.FromBase64String(text); text = Encoding.UTF8.GetString(bytes); char[] array = text.ToCharArray(); Array.Reverse(array); text = new string(array); byte[] bytes2 = Convert.FromBase64String(text); text = Encoding.UTF8.GetString(bytes2); AdsServerResponse adsServerResponse = JsonUtility.FromJson <AdsServerResponse>(text); if (adsServerResponse != null) { if (adsServerResponse.ad_module_active == 0) { FMLogger.vAds("disable ads from config"); this.DisableAds(); this.config.DisableAds(); this.config.UpdateReward(AdConfig.FromRespone(adsServerResponse.rewarded_config, true), adsServerResponse.adUnit_rewarded); this.SaveConfig(this.config); } else { AdConfig adConfig = AdConfig.FromResponse(adsServerResponse, this.isTablet); this.SaveConfig(adConfig); this.config.UpdateFsParamsFromServer(adConfig); this.fsDisabled = !this.config.FsIsOn(); this.bannerDisabled = !adConfig.BannerIsOn(); } } } catch (Exception ex) { FMLogger.vAds("config parse ex. msg:" + ex.Message); } } else { FMLogger.vAds("config req server error. reschedule request"); base.StartCoroutine(this.DelayAction(20f, new Action(this.GetServerConfig))); } }); WebLoader.Instance.LoadText(task); }
private void SaveConfig(AdConfig c) { if (c == null) { return; } PlayerPrefs.SetString("adsconfig", JsonUtility.ToJson(c)); FMLogger.vAds("saving new cfg: " + c); }
public void ShowInterstitial(AdPlacement fsPlacement) { if (!this.fsEnabled) { return; } this.fsAdPlacement = AdConfig.AdPlacementToString(fsPlacement); FMLogger.vAds("fs show inv"); FAdsIOS.ShowInterstitial(); }
// Plays an ad with the given options. The user option is only supported for incentivized ads. public static void playAd(string placement) { if (sdk != null && sdk.IsAdPlayable(placement)) { cfg = new AdConfig (); cfg.SetUserId (""); cfg.SetSoundEnabled (_isSoundEnabled); cfg.SetOrientation((_orientation == VungleAdOrientation.AutoRotate)?VungleSDKProxy.DisplayOrientations.AutoRotate:VungleSDKProxy.DisplayOrientations.Landscape); sdk.PlayAd(cfg, placement); } }
// Plays an ad with the given options. The user option is only supported for incentivized ads. public static void playAd( bool incentivized = false, string user = "" ) { if (sdk != null && sdk.AdPlayable) { cfg = new AdConfig (); cfg.SetIncentivized (incentivized); cfg.SetUserId (user); cfg.SetSoundEnabled (_isSoundEnabled); cfg.SetOrientation((_orientation == VungleAdOrientation.AutoRotate)?VungleSDKProxy.DisplayOrientations.AutoRotate:VungleSDKProxy.DisplayOrientations.Landscape); sdk.PlayAd (cfg); } }
public void ShowInterstitial(AdPlacement fsPlacement) { if (!this.fsEnabled) { return; } this.fsAdPlacement = AdConfig.AdPlacementToString(fsPlacement); FMLogger.vAds("fs show inv"); MoPubAndroid.ShowInterstitialAd(this.interstitialAdUnit); this.hasLoadedInterstitial = false; AnalyticsManager.FsImpression(this.interstitialAdUnit, this.fsAdPlacement); }
// Plays an ad with the given options. The user option is only supported for incentivized ads. public static void playAd(bool incentivized = false, string user = "") { if (sdk != null && sdk.AdPlayable) { cfg = new AdConfig(); cfg.SetIncentivized(incentivized); cfg.SetUserId(user); cfg.SetSoundEnabled(_isSoundEnabled); cfg.SetOrientation((_orientation == VungleAdOrientation.AutoRotate)?VungleSDKProxy.DisplayOrientations.AutoRotate:VungleSDKProxy.DisplayOrientations.Landscape); sdk.PlayAd(cfg); } }
private async void PlayPlacement3_Click(Object sender, RoutedEventArgs e) { //Play ad for placement3 AdConfig adConfig = new AdConfig(); adConfig.IncentivizedDialogBody = null; adConfig.IncentivizedDialogCloseButton = ""; adConfig.IncentivizedDialogContinueButton = ""; adConfig.IncentivizedDialogTitle = ""; adConfig.UserId = "VTest"; await sdkInstance.PlayAdAsync(adConfig, placement3); }
private async void PlayPlacement3_Click(Object sender, RoutedEventArgs e) { //Play ad for placement3 AdConfig adConfig = new AdConfig(); adConfig.IncentivizedDialogBody = "Are you sure you want to skip this ad? You must finish watching to claim your reward."; adConfig.IncentivizedDialogCloseButton = "Close"; adConfig.IncentivizedDialogContinueButton = "Continue"; adConfig.IncentivizedDialogTitle = "Close this ad?"; adConfig.UserId = "VungleTest"; await sdkInstance.PlayAdAsync(adConfig, placement3); }
void Awake() { if (AppSceneBase.main == null) { AppSceneBase.main = this; } isReLayout = false; IPInfo.main.StartParserInfo(); InitScalerMatch(); if (canvasCamera != null) { SetCanvasScalerMatch(canvasCamera.gameObject); } Common.CleanCache(); AdConfig.main.InitSDK(); InitValue(); //Component this.gameObject.AddComponent <AdKitCommon>(); this.gameObject.AddComponent <IAPCommon>(); this.gameObject.AddComponent <ShareCommon>(); this.gameObject.AddComponent <TTSCommon>(); //this.gameObject.AddComponent<MusicBgPlay>(); this.gameObject.AddComponent <AudioPlay>(); this.gameObject.AddComponent <PopUpManager>(); //app启动初始化多线程工具LOOM Loom loom = Loom.Current; //初始化广告id key等参数 AdConfig adcf = AdConfig.main; //bg // Texture2D tex = AppResImage.texMainBg; // if (tex) { //ios unity 2017.3.1 Sprite.Create 会出现crash // Sprite sp = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f)); // imageBg.sprite = sp; // RectTransform rctan = imageBg.GetComponent<RectTransform>(); // rctan.sizeDelta = new Vector2(tex.width, tex.height); } if (Common.isWeb) { GameManager.main.PreLoadDataForWeb(); } }
override public void LoadAd(AdConfig adConfig) { Debug.Log("iOSNativeAdView > LoadAd(" + adConfig + ")"); if (_currentAdView != -1) { _isWaitingForSuccessOrFailure = true; _isWaitingForReward = true; // After launching the ad loading using the native wrapper, the polling timer is enabled to // enable notification at the end of the ad loading. _LoadAd(_currentAdView, adConfig.BaseUrl, adConfig.SiteId, adConfig.PageId, adConfig.FormatId, adConfig.Master ? 1 : 0, adConfig.Target); _delegatePollingTimer.Enabled = true; } }
public void PlayAd(string placementId) { InvokeSafelyOnUIThreadAsync(delegate { if (sdk != null && sdk.IsAdPlayable(placementId)) { cfg = new AdConfig(); cfg.SetUserId(string.Empty); cfg.SetSoundEnabled(this.isSoundEnabled); cfg.SetOrientation((orientation == VungleAdOrientation.AutoRotate) ? DisplayOrientations.AutoRotate : DisplayOrientations.Landscape); sdk.PlayAd(cfg, placementId); } }); }
public AdConfig() { this.adsDisabled = false; this.bannerPos = BannerPosition.Bottom; this.bannerPlaces = new List <BannerPlacement> { BannerPlacement.Gameboard }; this.rewardConfig = AdConfig.DefaultRewardConfig(); this.fsInternalOnReward = 5; this.bannerLoadDelay = 10; this.bannerShowTime = 15; this.adsTest = false; }
public static void Initialize(AdConfig adConfig) { AndroidJavaClass playerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject activity = playerClass.GetStatic <AndroidJavaObject>("currentActivity"); Instance.androidAdManager = new AndroidJavaObject("io.dclick.ads.unity.UnityAdManager"); AndroidJavaObject androidAdConfig = new AndroidJavaObject("io.dclick.ads.AdConfig"); AndroidJavaClass androidAdNetwork = new AndroidJavaClass("io.dclick.ads.AdNetwork"); AndroidJavaClass androidAdType = new AndroidJavaClass("io.dclick.ads.AdType"); foreach (DictionaryEntry each in adConfig.ApiKeys) { string adNetwork = each.Key.ToString(); string apiKey = (string)each.Value; androidAdConfig.Call( "setApiKey", androidAdNetwork.GetStatic <AndroidJavaObject>(adNetwork), apiKey); } ; foreach (DictionaryEntry networks in adConfig.UnitIds) { string adNetwork = networks.Key.ToString(); Hashtable types = (Hashtable)networks.Value; foreach (DictionaryEntry each in types) { string adType = each.Key.ToString().ToUpper(); string unitId = (string)each.Value; androidAdConfig.Call( "setUnitId", androidAdNetwork.GetStatic <AndroidJavaObject>(adNetwork), androidAdType.GetStatic <AndroidJavaObject>(adType), unitId ); } } Instance.androidAdManager.Call("initialize", activity, androidAdConfig); }
public void UpdateFsParamsFromServer(AdConfig upd) { if (upd == null) { return; } this.interval = upd.interval; if (GeneralSettings.AppLaunchCounter > 1) { this.startInterval = upd.startInterval; } this.appLaunchDelay = upd.appLaunchDelay; this.placements = upd.placements; this.chances = upd.chances; }
public static RewardConfig FromRespone(RewardedAdResponseConfig response, bool allowNull = true) { if (response != null) { return(new RewardConfig { dailyBonus = Mathf.Clamp(response.dailyBonusHints, 1, 1000), timingBonus = Mathf.Clamp(response.timingBonusHints, 1, 1000), timingDelay = Mathf.Clamp(response.timingBonusDelay / 1000, 1, int.MaxValue), timingBonusShowTime = Mathf.Clamp(response.timingBonusShowTime / 1000, 1, int.MaxValue), timingInterval = Mathf.Clamp(response.timingBonusInterval / 1000, 30, int.MaxValue) }); } if (allowNull) { return(null); } return(AdConfig.DefaultRewardConfig()); }
void LoadBanner() { Debug.Log("GameController: LoadAd"); // Create a new banner view instance if needed if (_bannerView == null) { _bannerView = new BannerView(); } // Create an adconfig object that will store informations about the ad placement and use it to load the ad AdConfig adConfig = new AdConfig("https://mobile.smartadserver.com", 104808, "663262", 15140, true, ""); _bannerView.LoadAd(adConfig); // Register success & failure events _bannerView.AdViewLoadingSuccess += BannerViewSuccess; _bannerView.AdViewLoadingFailure += BannerViewFailure; }
void DisplayInterstitial() { Debug.Log("GameController: DisplayInterstitial"); // Destroy the old interstitialview if needed if (_interstitialView != null) { _interstitialView.Destroy(); } // Create a new interstitialview instance _interstitialView = new InterstitialView(); // Create an adconfig object that will store informations about the ad placement and use it to load the ad AdConfig adConfig = new AdConfig("https://mobile.smartadserver.com", 104808, "663264", 12167, true, ""); _interstitialView.LoadAd(adConfig); // The interstitial is displayed automatically when loaded // Register success & failure events _interstitialView.AdViewLoadingSuccess += InterstitialViewSuccess; _interstitialView.AdViewLoadingFailure += InterstitialViewFailure; }
void DisplayRewardedInterstitial() { Debug.Log("GameController: DisplayRewardedInterstitial"); // Destroy the old interstitialview if needed if (_rewardedInterstitialView != null) { _rewardedInterstitialView.Destroy(); } // Create a new interstitialview instance _rewardedInterstitialView = new InterstitialView(); // Create an adconfig object that will store informations about the ad placement and use it to load the ad AdConfig adConfig = new AdConfig("https://mobile.smartadserver.com", 94198, "627899", 15140, true, "video-interstitial-endcard"); _rewardedInterstitialView.LoadAd(adConfig); // The interstitial is displayed automatically when loaded // Register success & failure events _rewardedInterstitialView.AdViewLoadingSuccess += RewardedInterstitialViewSuccess; _rewardedInterstitialView.AdViewLoadingFailure += RewardedInterstitialViewFailure; _rewardedInterstitialView.AdViewRewardReceived += RewardedInterstitialViewRewardReceived; }
public void GetFromAdConfig() { var adConfig = AdConfig.GetInstance(); List <AdConfigParameter> parameters = new List <AdConfigParameter>(); AdConfigParameter param1 = new AdConfigParameter(); AdConfigParameter param2 = new AdConfigParameter(); AdConfigParameter param3 = new AdConfigParameter(); AdConfigParameter param4 = new AdConfigParameter(); param1.key = "stringKey"; param1.value = "string"; parameters.Add(param1); param2.key = "intKey"; param2.value = "6000"; parameters.Add(param2); param3.key = "boolKey"; param3.value = "true"; parameters.Add(param3); param4.key = "longKey"; param4.value = "60000000"; parameters.Add(param4); adConfig.parameters = parameters; adConfig.Init(adConfig); Assert.That(adConfig.Get("stringKey", "key"), Is.EqualTo("string")); Assert.That(adConfig.GetInt("intKey", 0), Is.EqualTo(6000)); Assert.That(adConfig.GetBool("boolKey", false), Is.EqualTo(true)); Assert.That(adConfig.GetLong("longKey", 0), Is.EqualTo(60000000)); Assert.That(adConfig.Get("intKey", "key"), Is.EqualTo("6000")); Assert.That(adConfig.GetInt("stringKey", 0), Is.EqualTo(0)); Assert.That(adConfig.GetBool("longKey", false), Is.EqualTo(false)); Assert.That(adConfig.GetLong("boolKey", 0), Is.EqualTo(0)); }
public static void Initialize(AdConfig adConfig) { }
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); } }
void IAdManager.Initialize(AdConfig adConfig) { AdManager.Initialize(adConfig); }