IEnumerator BannerLoop() { yield return(new WaitForSeconds(20f)); banner = new BannerView("ca-app-pub-7143280300027830/7400835709", AdSize.SmartBanner, AdPosition.Top); AdRequest request = new AdRequest.Builder().Build(); if (GameController.isVip != 1) { banner.LoadAd(request); } yield return(new WaitForSeconds(20f)); banner.Hide(); while (GameController.isVip != 1) { yield return(new WaitForSeconds(90f)); if (GameController.isVip != 1) { banner.Show(); } yield return(new WaitForSeconds(20f)); banner.Hide(); } }
public void Show(bool _bFlag) { Debug.LogError(string.Format("showbanner:_bFlag={0} , hidecount={1}", _bFlag, m_iHideCount)); if (_bFlag) { m_iHideCount -= 1; if (m_iHideCount <= 0) { m_iHideCount = 0; showAdBanner(DeviceOrientationDetector.Instance.orientation); } } else { if (0 == m_iHideCount) { if (viewYoko != null) { viewYoko.Hide(); } if (viewTate != null) { viewTate.Hide(); } } m_iHideCount += 1; } }
public void HideBanner() { if (bannerView != null) { bannerView.Hide(); } }
public void HideBanner() { if (showBanner) { bannerView.Hide(); } }
void CloseBannerAD() { if (bannerView != null) { bannerView.Hide(); } }
public void _show_admob_Banner_Large(AdPosition pos, AdSize bannerType, bool _req = false) { if (PlayerPrefs.GetInt("RemoveAds") == 0) { try { if (!_req) { bannerView.SetPosition(pos); bannerView.Show(); } else { if (bannerView != null) { bannerView.Hide(); bannerView.Destroy(); } bannerView = new BannerView(_admob_Banner, bannerType, pos); bannerView.OnAdLoaded += HandleAdLoaded; bannerView.OnAdFailedToLoad += HandleAdFailedToLoad; bannerView.OnAdOpening += HandleAdOpened; bannerView.OnAdClosed += HandleAdClosed; bannerView.OnAdLeavingApplication += HandleAdLeftApplication; bannerView.LoadAd(CreateAdRequest()); } } catch (Exception) { } } }
void OnSceneLoaded(Scene scene, LoadSceneMode mode) { switch (scene.buildIndex) { case Constants.SCENE_INDEX_MAIN_MENU: if (!mainMenu) { mainMenu = FindObjectOfType <MainMenu>(); } RequestBanner(); RequestIntertitial(); break; case Constants.SCENE_INDEX_GAME: if (!gameOverMenu) { gameOverMenu = FindObjectOfType <GameOverMenu>(); } RequestRewarded(); bannerAd.Hide(); break; } }
public void __HideMedRectBanner() { if (bannerView_MedRect != null) { bannerView_MedRect.Hide(); } }
// Use this for initialization void Start() { if (!adsEnabled) { return; } #if !UNITY_WP8 if (bannerView == null) { //admob CreateBanner(); bannerView.Hide(); //unityads if (Advertisement.isSupported) { Advertisement.allowPrecache = true; Advertisement.Initialize("19490"); } else { Debug.Log("Platform not supported"); } } if (interstitial == null) { CreateInterstitial(); } #endif }
public void Resume() { Debug.Log("Resume"); bannerView.Hide(); paused = false; timer.Resume(); score.Resume(); }
public override void HideBanner() { #if ADS_ADMOB if (BannerView != null) { BannerView.Hide(); } #endif }
void Start() { MobileAds.Initialize(initStatus => { }); RequestRectangle(); bannerView.Hide(); SceneManager.activeSceneChanged += OnActiveSceneChanged; SceneManager.sceneLoaded += OnSceneLoaded; SceneManager.sceneUnloaded += OnSceneUnloaded; }
public void StartGame() { TransitionManager.Instance.TransitionOutAndLoadScene("Game"); if (banner != null) { banner.Hide(); } }
public void HideLargeAdmobBanner() { if (PlayerPrefs.GetInt("IsAdsRemoved") == 0) { if (LargeBannerOnceLoaded && CheckInitialization()) { largebannerView.Hide(); } } }
public static void DestroyBanner() { if (bannerView != null) { bannerView.Hide(); bannerView.Destroy(); bShow = false; bannerView = null; } }
void btnBack_onClick() { PopUpController.instance.HideGrade(); PopUpController.instance.ShowMainGame(); if (GameController.instance.checkvip != 10) { bannerView.Hide(); } }
/// <summary> /// 베너 광고 요청 /// </summary> private void LoadBannerAd() { AdRequest request; if (isTest) { request = new AdRequest.Builder().AddTestDevice(AdRequest.TestDeviceSimulator).AddTestDevice("Test") .Build(); #if UNITY_ANDROID _unitID = "ca-app-pub-3940256099942544/6300978111"; // Test ID #elif UNITY_IPHONE _unitID = "ca-app-pub-3940256099942544/2934735716"; // Test ID #else _unitID = "unexpected_platform"; return; #endif } else { request = new AdRequest.Builder().Build(); _unitID = BannerAdID; } // 광고 크기 설정 var width = (Screen.width * 0.625) / MobileAds.Utils.GetDeviceScale(); var height = (Screen.height * 0.12) / MobileAds.Utils.GetDeviceScale(); //_bannerView = new BannerView(_unitID, AdSize.Banner, AdPosition.Bottom); // 기본으로 제공하는 값을 통해 위치 설정 _bannerView = new BannerView(_unitID, AdSize.GetLandscapeAnchoredAdaptiveBannerAdSizeWithWidth((int)width), bannerX, bannerY); // 맞춤 설정 (광고 사이즈 및 위치) // 로드 실패시의 이벤트 추가 _bannerView.OnAdFailedToLoad += (sender, args) => { #if UNITY_EDITOR Debug.Log("Banner AD is not Loaded"); #endif }; _bannerView.OnAdLoaded += (sender, args) => { _isBannerViewLoaded = true; if (_isOnPlayBannerView) { _bannerView.Show(); } else { _bannerView.Hide(); } }; _bannerView.Hide(); // 기본 = 숨김상태 // 베너 광고 로드 _bannerView.LoadAd(request); }
public void ShowBannerRelative() { if (isBannerShowing) { banner.Hide(); } else { banner.Show(); } isBannerShowing = !isBannerShowing; }
//Ads public void BannerSetup() { if (Configuration.instance.admobBannerKey.Trim().Length != 0) { if (bannerView == null) { bannerView = new BannerView(Configuration.instance.admobBannerKey, AdSize.Banner, AdPosition.Top); AdRequest adRequest = new AdRequest.Builder().Build(); bannerView.LoadAd(adRequest); } bannerView.Hide(); } }
private void Update() { if (adFree == 1) { bannerView.Destroy(); bannerView.Hide(); } if (SceneManager.GetActiveScene().name == "MainMenu") { bannerView.Hide(); bannerView.Destroy(); } }
void Start() { Game.Prefs.Update(); StartGameButton.onClick.AddListener(() => { if (Banner != null) { Banner.Hide(); } gameObject.SetActive(false); Game.game.gameObject.SetActive(true); Game.game.StartGame(); }); ContinueButton.onClick.AddListener(() => { if (Banner != null) { Banner.Hide(); } Continue(); ContinueButton.gameObject.SetActive(false); StartGameButton.gameObject.SetActive(true); }); SettingsButton.onClick.AddListener(() => { Settings.SetActive(true); gameObject.SetActive(false); }); ExitButton.onClick.AddListener(Application.Quit); Settings.SetActive(true); ContinueButton.gameObject.SetActive(false); if (Application.platform == RuntimePlatform.WebGLPlayer) { ExitButton.gameObject.SetActive(false); } #if !UNITY_EDITOR CreateAdBanner(); #endif }
void Awake() { if (Advertisement.isSupported) { Advertisement.allowPrecache = true; string UnityAdsId = ""; #if UNITY_IOS && !UNITY_EDITOR //UnityAdsId = "33340"; #endif #if UNITY_ANDROID && !UNITY_EDITOR //UnityAdsId = "34245"; #endif Advertisement.Initialize(UnityAdsId); UI_ScoreText.GetComponent <UnityEngine.UI.Text>().text = "Platform supported"; } else { Debug.Log("Platform not supported"); UI_ScoreText.GetComponent <UnityEngine.UI.Text>().text = "Platform not supported"; } //ca-app-pub-7183026460514946/5522304910 is for IOS now //ca-app-pub-7183026460514946/2010435315 is for android // Create a 320x50 banner at the top of the screen. string bannerAdsId = ""; #if UNITY_IOS && !UNITY_EDITOR //bannerAdsId = "ca-app-pub-7183026460514946/5522304910"; #endif #if UNITY_ANDROID && !UNITY_EDITOR //bannerAdsId = "ca-app-pub-7183026460514946/2010435315"; #endif if (bannerView == null) { bannerView = new BannerView( bannerAdsId, AdSize.Banner, AdPosition.Top); // Create an empty ad request. request = new AdRequest.Builder().Build(); // Load the banner with the request. bannerView.LoadAd(request); bannerView.Hide(); } else { bannerView.Hide(); } }
/// <summary> /// Hides the banner ad is banner ads are enabled /// </summary> public void HideBannerAd() { if (IsBannerAdsEnabled) { if (topBanner != null) { topBanner.Hide(); } if (bottomBanner != null) { bottomBanner.Hide(); } } }
protected void HandleBannerLoaded(object sender, EventArgs e) { //the OnAdLoaded callback will also be trigerred on banner reload //so we need to make sure that we are waiting for a load callback, and ignore reload if (m_loadCallback == null) { return; } //We are hiding because it will be showed automatically when loaded //but we need to prevent this. m_banner.Hide(); HandleAdLoaded(sender, e); }
public void BannerHide(bool andDestroy) { Debug.Log("Hide Banner"); _visible = false; if (andDestroy) { _banner?.Destroy(); _banner = null; } else { _banner?.Hide(); } Change(); }
void OnLevelWasLoaded(int level) { if (Application.loadedLevelName == "Main Menu Scene") { int hasThePlayerReturnedFromGamePlay = PlayerPrefs.GetInt(GamePreferences.ShowBannerAfterGameplay); // check if the player has returned from gameplay if(hasThePlayerReturnedFromGamePlay == 1) { // if the game has been opened 5 times if(HowManyTimesTheGameWasPlayed == 5) { // show the interstitials if its created, if its not created create and interstitial if(interstitial != null) { StartCoroutine(WaitToShowAd(0.1f)); StartCoroutine(DestroyInterstitialAfterShowing()); } else { CreateAndLoadInterstitial(); } } // if the game has been opened 5 times // if the banner is null create the banner again if(bannerView == null) { CreateLoadAndShowBanner(); } PlayerPrefs.SetInt(GamePreferences.ShowBannerAfterGameplay, 0); } // if the player returned from gameplay } // if the game has been loaded if (Application.loadedLevelName == "Gameplay Scene") { // remove the banner if its active if(bannerView != null) { bannerView.Hide(); bannerView.Destroy(); bannerView = null; } PlayerPrefs.SetInt(GamePreferences.ShowBannerAfterGameplay, 1); } }
// Use this for initialization void Start() { //PlayerPrefs.DeleteAll(); Debug.Log("game manager start"); if (instance != null) { Destroy(this.gameObject); } replayBtn.gameObject.SetActive(false); menuBtn.gameObject.SetActive(false); Dmg.gameObject.SetActive(false); //HP.gameObject.SetActive(false); Reaction.gameObject.SetActive(false); Kills.gameObject.SetActive(false); instance = this; gameStarted = false; fired = false; killed = 0; remainingHp = 0; destroyTargetCount = 0; damageDone = 0f; timeWaited = 0f; targets = new List <GameObject>(); backgroundPlane.GetComponent <MeshRenderer>().material = allBackgrounds[Mathf.FloorToInt(Random.Range(0, allBackgrounds.Length))]; // start game after delay Invoke("StartGame", startDelay); RequestBanner(); bannerView.Hide(); }
protected override void InternalHideBannerAd(AdPlacement placement) { #if EM_ADMOB if (placement == AdPlacement.Default) // Default banner... { if (mDefaultBanner != null) { mDefaultBanner.Hide(); } } else // Custom banner... { if (mCustomBannerAds == null) { return; } if (!mCustomBannerAds.ContainsKey(placement) || mCustomBannerAds[placement].Value == null) { return; } mCustomBannerAds[placement].Value.Hide(); } #endif }
public void HideBanner() { if (IsAndroid()) { bannerView.Hide(); } }
private void RequestTopBanner() { #if UNITY_ANDROID string adUnitId = (!testing) ? AndroidBannerTopAdUnitId : TestAndroidBannerTopAdUnitId; #elif UNITY_IPHONE string adUnitId = (!testing) ? IOSBannerTopAdUnitId : TestIOSBannerTopAdUnitId; #else string adUnitId = "unexpected_platform"; #endif bannerView = new BannerView(adUnitId, AdSize.SmartBanner, AdPosition.Bottom); AdRequest request; if (testing) { request = new AdRequest.Builder() .AddTestDevice(AdRequest.TestDeviceSimulator) .AddTestDevice(SystemInfo.deviceUniqueIdentifier) .Build(); } else { request = new AdRequest.Builder().Build(); } bannerView.LoadAd(request); bannerView.Hide(); }