public void OnClickedChangeNetwork() { SelectedAdNetwork++; if (SelectedAdNetwork > 5) { SelectedAdNetwork = 0; } if (SelectedAdNetwork == 1) { adPartner = AdsMaster.FindActiveAdProvider(ProviderID.Admob); } else if (SelectedAdNetwork == 2) { adPartner = AdsMaster.FindActiveAdProvider(ProviderID.ChartBoost); } else if (SelectedAdNetwork == 3) { adPartner = AdsMaster.FindActiveAdProvider(ProviderID.UnityAd); } else if (SelectedAdNetwork == 4) { adPartner = AdsMaster.FindActiveAdProvider(ProviderID.Vungle); } else if (SelectedAdNetwork == 5) { adPartner = AdsMaster.FindActiveAdProvider(ProviderID.FbAd); } else { adPartner = null; } }
public override void ShowInterstitial(string key = null) { if (IsLoadedInterstitial(key)) { Chartboost.showInterstitial(CBLocation.Default); AdsMaster.OnDisplayAd(this, AdType.Interstitial); } }
public override void ShowReward() { if (IsRewardReady) { Chartboost.showRewardedVideo(CBLocation.Default); AdsMaster.OnDisplayAd(this, AdType.Rewarded); } }
IEnumerator CheckRewardedTimer() { yield return(checkDelay); do { hasRewarded = AdsMaster.HasReward(); yield return(checkDelay); } while (true); }
public void Initialize(AdsMaster manager) { this.manager = manager; // Only init if provider is assigned to load any ad. if ((IsSupport(AdType.Interstitial) && AdsMaster.IsAllowedInterstitial(ID)) || (IsSupport(AdType.Rewarded) && AdsMaster.IsAllowedReward(ID)) || (IsSupport(AdType.Banner) && AdsMaster.IsAllowedBanner(ID))) { OnIntialize(); } }
public override void ShowInterstitial(string key = null) { if (IsLoadedInterstitial()) { AdsMaster.OnDisplayAd(this, AdType.Interstitial); var options = new ShowOptions { resultCallback = HandleShowResultInterstitial }; Advertisement.Show(VideoPlacementId, options); } }
public override void ShowReward() { if (IsRewardReady) { var options = new ShowOptions { resultCallback = HandleShowResultReward }; AdsMaster.OnDisplayAd(this, AdType.Rewarded); Advertisement.Show(RewardedPlacementId, options); } }
void Awake() { if (!AdsMaster.IsAllowedBanner(this.providerId)) return; //CLog.Log(this, "Initializing banners..."); adUnits = GetAdUnitsFromConfigs(); loaderDict = new Dictionary<string, Loader>(); for (int i = 0; i < adUnits.Count; i++) { var adUnit = adUnits[i]; InstantiateLoader(adUnit); } }
void Init() { if (!AdsMaster.SupportedAdPlatform) { return; } if (!AdsMaster.IsAllowedReward(providerId) || !IsValidConfiguration()) { return; } resendTime = new WaitForSeconds(AdsMaster.RESEND_FAILED_REQUEST_DELAY); OnInitialize(); SendRequest(); }
public void OnClickedShowInterstitial() { if (SelectedAdNetwork == 0) { AdsMaster.ShowInterstitial((result) => { CLog.Log("Interstitial result " + result); }); } else if (adPartner != null && adPartner.IsSupport(AdType.Interstitial)) { adPartner.ShowInterstitial(); } }
public void OnClickedShowRewarded() { if (SelectedAdNetwork == 0) { AdsMaster.ShowReward(success => { if (success) { coin++; } }); } else if (adPartner != null && adPartner.IsSupport(AdType.Rewarded)) { adPartner.ShowReward(); } }
void HandleClicked() { if (action == Action.ShowInterstitial) { AdsMaster.ShowInterstitial(null, key); } else if (action == Action.ShowBanner) { AdsMaster.ShowBannerIfLoaded(key); } else if (action == Action.HideBanner) { AdsMaster.HideBanner(); } }
public AdUnit ShowBanner(string key = null) { if (!AdsMaster.IsAllowedBanner(this.providerId)) return null; Loader loader = FindLoaderByKey(key); if (loader != null && loader.IsLoaded) { // Hiển thị banner mới loader.Show(); return loader.AdUnit; } else { return null; } }
public static void Initialize(AdsMasterSetting settings) { if (instance != null || settings == null) { return; } // Tạo game object var go = new GameObject("AdsMaster"); instance = go.AddComponent <AdsMaster>(); DontDestroyOnLoad(go); // Assign settings AdsMaster.settings = settings; // Load remote config if need instance.InitRemoteConfig(); InitAdNetworks(); #if FBAD FbNativeAdManager.Initialize(); #endif }
private void HandleShowResultReward(ShowResult result) { switch (result) { case ShowResult.Finished: CLog.Log(this, "The ad was successfully shown."); AdsMaster.OnCompletedReward(ProviderID.UnityAd, true); break; case ShowResult.Skipped: CLog.Log(this, "The ad was skipped before reaching the end."); AdsMaster.OnCompletedReward(ProviderID.UnityAd, false); break; case ShowResult.Failed: CLog.Err(this, "The ad failed to be shown."); AdsMaster.OnCompletedReward(ProviderID.UnityAd, false); break; } AdsMaster.OnDimissAd(AdType.Rewarded); }
IEnumerator CheckInterstititalTimer() { foreach (var item in interstitialButtons) { item.interactable = hasInterstitial; } yield return(checkDelay); do { var isLoaded = AdsMaster.IsLoadedInterstitial(); if (isLoaded != hasInterstitial) { hasInterstitial = isLoaded; foreach (var item in interstitialButtons) { item.interactable = hasInterstitial; } } yield return(checkDelay); } while (true); }
protected override void OnIntialize() { Chartboost.didCacheInterstitial += didCacheInterstitial; Chartboost.didFailToLoadInterstitial += didFailToLoadInterstitial; Chartboost.didDismissInterstitial += didDismissInterstitial; Chartboost.didCloseInterstitial += didCloseInterstitial; Chartboost.didCacheRewardedVideo += didCacheRewardedVideo; Chartboost.didFailToLoadRewardedVideo += didFailToLoadRewardedVideo; Chartboost.didCloseRewardedVideo += didCloseRewardedVideo; Chartboost.didDismissRewardedVideo += didDismissRewardedVideo; Chartboost.didCompleteRewardedVideo += didCompleteRewardedVideo; if (AdsMaster.IsAllowedReward(ProviderID.ChartBoost)) { StartCoroutine(CacheRewardTask(2f)); } if (AdsMaster.IsAllowedInterstitial(ProviderID.ChartBoost)) { StartCoroutine(CacheInterstitialTask(0f)); } }
public void OnClickedBottomBanner() { AdsMaster.ShowBannerIfLoaded("bottom banner"); }
/// <summary> /// Thông báo kết của của hành động xem video /// </summary> /// <param name="success"></param> protected void DidCompletedVideo(bool success) { AdsMaster.OnCompletedReward(providerId, success); }
/// <summary> /// Thông báo video đã được đóng /// </summary> protected void DidClosedVideo() { AdsMaster.OnDimissAd(AdType.Rewarded); SendRequest(); }
private void didCloseRewardedVideo(CBLocation location) { //CLog.Log(this, "didCloseRewardedVideo"); AdsMaster.OnDimissAd(AdType.Rewarded); }
public void OnClickedShowBannerSoon() { AdsMaster.ShowBanner(); }
private void didDismissRewardedVideo(CBLocation location) { //CLog.Log(this, "didDismissRewardedVideo"); AdsMaster.OnDimissAd(AdType.Rewarded); StartCoroutine(CacheRewardTask(2f)); }
public void OnClickedHideBanner() { AdsMaster.HideBanner(); }
private void didCompleteRewardedVideo(CBLocation location, int reward) { //CLog.Log(this, "didCompleteRewardedVideo"); AdsMaster.OnCompletedReward(ID, true); }
// Use this for initialization void Start() { AdsMaster.ShowBanner(); }
public void OnClickedTopBanner() { AdsMaster.ShowBannerIfLoaded("top banner"); }
private void didDismissInterstitial(CBLocation location) { //CLog.Log(this, "didDismissInterstitial"); AdsMaster.OnDimissAd(AdType.Interstitial); }
public void OnClickedShowInterstitialAd2() { AdsMaster.ShowInterstitial(null, "ad2"); }
public void OnClickedDefaultBanner() { AdsMaster.ShowBannerIfLoaded(); }