public void ForceCloseAds() { CurrentCrossPromo = null; if (_currentPromoPanel != null) { _currentPromoPanel.DeactivatePanel(); _currentPromoPanel = null; } }
void OnClick(CrossPromoData data) { var activeLink = data.GooglePlayLink; //for editor #if UNITY_ANDROID activeLink = data.GooglePlayLink; #elif UNITY_IOS activeLink = data.AppStoreLink; #endif if (!string.IsNullOrEmpty(activeLink)) { Application.OpenURL(activeLink); //AnalyticsManager.Instance.LogLinkClick(activeLink, "Promo App"); } }
public void ShowCrossPromoAds(PromoAdsStyle type, float duration) { if (ExternalAdsAvailable) //when external ads are present cross promo ads are ignored { Debug.Log("External Ads is available, cross promo ads are not shown."); return; } var initIndex = Random.Range(0, PromoData.Count); CurrentCrossPromo = PromoData.JumpBy(initIndex, 1, out initIndex); _lastDuration = duration; if (CurrentCrossPromo != null) { var correctType = AvailableAdsType.Find(x => x.AdsStyle == type); if (correctType != null) { _currentPromoPanel = correctType.AdsPanel; } if (_currentPromoPanel == null) { return; } switch (type) { case PromoAdsStyle.Banner: { _currentPromoPanel.SetPromoPanel(() => OnClick(CurrentCrossPromo), CurrentCrossPromo.Banner, duration, ResetBanner); //force deactivate when necessary } break; case PromoAdsStyle.Fullscreen: { _currentPromoPanel.SetPromoPanel(() => OnClick(CurrentCrossPromo), CurrentCrossPromo.Fullscreen, duration, ForceCloseAds); } break; } _currentPromoPanel.ActivatePanel(); } }