/// <summary> /// Прямой запрос произвольного показа рекламы. /// </summary> /// <param name="adsCase">Сценарий показа</param> /// <param name="onAnyResult">Колбек на любой исход показа</param> /// <param name="onSuccess">Колбек на успешный показ</param> /// <param name="userAgreed">Дал ли согласие игрок?</param> public void DirectCall(AdsCase adsCase, System.Action onAnyResult, System.Action onSuccess, bool userAgreed = true) { if (userAgreed) { ShowRewardedVideo(onAnyResult, onSuccess); // AnalyticsManager.Instance.LogEvent(AnalyticsManager.Event.ClickAdsAgree, adsCase.ToString()); } else { // AnalyticsManager.Instance.LogEvent(AnalyticsManager.Event.ClickAdsDisagree, adsCase.ToString()); } }
/// <summary> /// Показать диалог соответствующий настройкам сценария показа. /// </summary> /// <param name="adsCase">Сценарий показа</param> /// <param name="onSuccess">Колбек на успешный показ</param> /// <param name="message">Сообщение диалога</param> public void ShowDialog(AdsCase adsCase, System.Action onSuccess, string message = null) { var setup = caseSettings.FirstOrDefault(s => s.id == adsCase); if (setup == null) { //Debug.LogError("ADS: Settings for case \"" + adsCase + "\" NOT FOUND!"); return; } /* * if (adsCase == AdsCase.MoreCoins) * { * AnalyticsManager.Instance.LogEvent(AnalyticsManager.Event.ClickMoreCoins); * } */ /* var dialog = setup.dialog; * var localMessage = string.IsNullOrEmpty(message) ? string.Empty : DLocalizationManager.Instance.GetLocalText(message); * * dialog.Define(localMessage, * new UIDialog.Option * { * type = UIDialog.OptionType.Yes, * action = () => * { * // AnalyticsManager.Instance.LogEvent(AnalyticsManager.Event.ClickAdsAgree, adsCase.ToString()); * ShowRewardedVideo(dialog.HideByAnimation, onSuccess); * } * }, * new UIDialog.Option * { * type = UIDialog.OptionType.No, * action = () => * { * // AnalyticsManager.Instance.LogEvent(AnalyticsManager.Event.ClickAdsDisagree, adsCase.ToString()); * dialog.HideByAnimation(); * } * }); * * dialog.ShowByAnimation(); */ }