public void SetInPlayAd(CachedInplay inplay)       //call from ShowInPlayAd & after click the inplayad.
    {
        if (inplay != null)
        {
            AdMob.destroyBanner();              //inplay광고로 대체됨.
            if (mInplayAd != null)
            {
                GameObject.Destroy(mInplayAd);
                mInplayAd = null;
            }

            mInplayAd = (GameObject)Instantiate(inPlayAd, Vector3.zero, Quaternion.identity);
            mInplayAd.transform.parent = inPlayAdSpawnPoint;
            mInplayAd.GetComponent <InPlayAd>().SetInplayData(inplay);
            inplay.Show();
        }
        else
        {
            if (mInplayAd != null)
            {
                GameObject.Destroy(mInplayAd);
                mInplayAd = null;
                ShowBanner();
            }
        }
    }
Exemple #2
0
    private void HandleADconsent(bool state)
    {
        if (state)
        {
            if (DataManager.Instance.adsSettings.nonpersonalizedAds)
            {
                ChangeColor(yes);
                ChangeColor(no);
                PlayerPrefs.SetInt("gdpr", 0);
                DataManager.Instance.adsSettings.nonpersonalizedAds = false;
#if ENABLE_ADMOB
                AdMob.RequestAtStart();
#endif
            }
        }
        else
        {
            if (!DataManager.Instance.adsSettings.nonpersonalizedAds)
            {
                ChangeColor(no);
                ChangeColor(yes);
                PlayerPrefs.SetInt("gdpr", 1);
                DataManager.Instance.adsSettings.nonpersonalizedAds = true;
#if ENABLE_ADMOB
                AdMob.RequestAtStart();
#endif
            }
        }
    }
Exemple #3
0
    public bool admobHideBannerAd()
    {
        #if AD_USE_ADMOB
        if (Application.platform == RuntimePlatform.Android)
        {
        #if UNITY_ANDROID
            AdMob.destroyBanner();
            return(true);
        #endif
        }
        else if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
        #if UNITY_IPHONE
            AdMobBinding.destroyBanner();
            return(true);
        #endif
        }
        else
        {
            // Web player...
        #if UNITY_WEBPLAYER
            //Application.ExternalCall("if(window.console) window.console.log","web show twitter login");
        #endif
        }
        #endif

        return(false);
    }
 private void ShowBanner()
 {
     if (!SaveManager.GetRemoveAdsPurchased())
     {
         AdMob.createBanner("ca-app-pub-6553814907597998/7730326661", "ca-app-pub-6553814907597998/3300127061", AdMobBanner.SmartBanner, AdMobLocation.BottomCenter);
     }
 }
Exemple #5
0
    void Ad()
    {
        int randomNumber = Random.Range(0, 10);

        if (hide)
        {
            AdMob.destroyBanner();               //oculta banner do AdMob
#if UNITY_ANDROID
            FlurryAndroid.removeAd("main_menu"); //oculta banner do Flurry
#endif
#if UNITY_IOS
            FlurryAds.removeAdFromSpace("main_menu");               //oculta banner do Flurry
#endif
        }

        if (randomNumber <= chance)
        {
            if (banner == false && interstitial == false)
            {
                banner = true;
            }

            if (show && P31Prefs.getInt("rads") == 0)
            {
                if (banner)
                {
                    AdMob.createBanner("ca-app-pub-8470511340989148/5727361119", "ca-app-pub-8470511340989148/7343695112", AdMobBanner.SmartBanner, AdMobBannerLocation);
                }
                if (interstitial)
                {
                    ShowInterstitial(location);
                }
            }
        }
    }
        public override void StartController()
        {
            Application.targetFrameRate = 30;
            this.gameData=this.GetManager ().GetComponent<GameData>();
            if (this.gameData == null) {
                throw new UnassignedReferenceException("Obiekt "+this.GetManager().gameObject.name+" nie ma komponentu GameData");
            }
            this.guiAssets = this.GetManager ().GetComponent<GuiStatesAssets> ();
            if (this.guiAssets == null) {
                throw new UnassignedReferenceException("Obiekt "+this.GetManager().gameObject.name+" nie ma komponentu GuiStatesAssets");
            }
            /**
             * zliczamy włączenia gry
             */
            this.GetData ().countGames = PlayerPrefs.GetInt ("CountGames");
            this.GetData ().countGames++;
            PlayerPrefs.SetInt ("CountGames",this.GetData ().countGames);
            PlayerPrefs.Save();

            adMob = new AdMob ();
            adMob.StartBanner ();

            this.ChangeState(new States.MainMenuState());
            GameCenter.Authenticate();
        }
    private IEnumerator WaitAndShowCB()
    {
        float delay = Config.GetFloat("ad_delay", 0.2f);

        yield return(new WaitForSeconds(delay));

        if (Chartboost.hasInterstitial(CBLocation.GameOver))
        {
            int playCount = PlayerPrefs.GetInt("Play Chartboost Ads", 0);
            playCount++;
            PlayerPrefs.SetInt("Play Chartboost Ads", playCount);
            PlayerPrefs.Save();

            Chartboost.showInterstitial(CBLocation.GameOver);
        }
        else if (AdMob.isInterstitalReady())
        {
            int playCount = PlayerPrefs.GetInt("Play Admob Ads", 0);
            playCount++;
            PlayerPrefs.SetInt("Play Admob Ads", playCount);
            PlayerPrefs.Save();

            AdMob.displayInterstital();
            GAManager.Instance.GAAdMobEvent("display");
        }
    }
Exemple #8
0
    public override void OnActive()
    {
        time          = 0;
        proccessEvent = false;

        timer.PauseTimer();
        playGUI.SetActive(false);
        gameMenu.SetActive(false);
        finishWindow.SetActive(true);
        GameObject successMessage = GameObject.Find("SuccessMessage");
        GameObject failureMessage = GameObject.Find("FailureMessage");

        successMessage.GetComponent <Image> ().enabled = false;
        failureMessage.GetComponent <Image> ().enabled = true;
        successMessage.gameObject.GetComponentInChildren <Text> ().enabled = false;
        failureMessage.gameObject.GetComponentInChildren <Text> ().enabled = true;
        mapController.isHexDownBlock = true;

        Data data = ((StateController)StateManager.GetController()).GetData();

        if (data.numberOfGames > data.adPopupTime)
        {
            data.numberOfGames = 0;
            showAd             = true;

            adMob = new AdMob();
            adMob.StartInterstitial();
        }
    }
Exemple #9
0
    public override void OnActive()
    {
        time = 0;
        proccessEvent = false;

        timer.PauseTimer ();
        playGUI.SetActive (false);
        gameMenu.SetActive (false);
        finishWindow.SetActive (true);
        GameObject successMessage = GameObject.Find ("SuccessMessage");
        GameObject failureMessage = GameObject.Find ("FailureMessage");
        successMessage.GetComponent<Image> ().enabled = false;
        failureMessage.GetComponent<Image> ().enabled = true;
        successMessage.gameObject.GetComponentInChildren<Text> ().enabled = false;
        failureMessage.gameObject.GetComponentInChildren<Text> ().enabled = true;
        mapController.isHexDownBlock = true;

        Data data = ((StateController)StateManager.GetController ()).GetData ();

        if (data.numberOfGames > data.adPopupTime) {
            data.numberOfGames = 0;
            showAd = true;

            adMob = new AdMob();
            adMob.StartInterstitial();
        }
    }
Exemple #10
0
        public MainPage()
        {
            InitializeComponent();
            adMob = new AdMob();
#if __ANDROID__
            adMob.Context = Android.MainActivity.Context;
#endif
            adMob.CreateAndRequestInterstitial();
        }
Exemple #11
0
    public void Title_gotoSurvival()
    {
        //    SceneManager.LoadScene("loading");
        AdMob ad = admob.GetComponent <AdMob>();//スコアを取得

        //        nextscene = 1;
        ad.StopBanner();
        GAMEMODE = 1;
        SceneManager.LoadScene("survival");//puzzleシーンをロードする
    }
Exemple #12
0
    public void Title_gotoRanking()
    {
        AdMob ad = admob.GetComponent <AdMob>();//スコアを取得

        //      SceneManager.LoadScene("loading");

        //      nextscene = 2;
        ad.StopBanner();
        SceneManager.LoadScene("ranking");//puzzleシーンをロードする
    }
    //What to do after level complete
    public static void OnLevelComplete(LevelInfo data)
    {
        bool isUnityAd = DataManager.Instance.adsSettings.unityAds;
        bool isAdmob   = DataManager.Instance.adsSettings.adMob;
        int  devider   = DataManager.Instance.adsSettings.showAdAfterLevel;

        if (devider > 0) //Show AD depending on setted preferences
        {
            if (((data.currentLevel - 1) % devider) == 0)
            {
                if (isUnityAd && isAdmob)
                {
#if ENABLE_ADMOB && UNITY_ADS
                    if (Random.Range(0, 2) == 1)
                    {
                        if (!AdMob.ShowAdMobAD())
                        {
                            ShowUnityAD();
                        }
                    }

                    else if (!ShowUnityAD())
                    {
                        AdMob.ShowAdMobAD();
                    }
#endif
                }
                else
                {
                    if (isUnityAd)
                    {
#if UNITY_ADS
                        ShowUnityAD();
#endif
                    }
#if ENABLE_ADMOB
                    else
                    {
                        AdMob.ShowAdMobAD();
                    }
#endif
                }
            }
        }
        //Load new scene
        if (data.currentLevel > DataManager.Instance.GetData(data.directoryName).dirLength)
        {
            LoadScene(0);
        }
        else
        {
            LoadScene(1);
        }
    }
        /// <summary>
        /// Called on Awake after the singleton has been setup.
        /// </summary>
        protected override void GameSetup()
        {
#if GOOGLE_ADS
            if (!GameManager.Instance.IsUnlocked && !string.IsNullOrEmpty(AdmobUnitIdAndroid) && !string.IsNullOrEmpty(AdmobUnitIdIos))
            {
                Adverts = new AdMob(AdmobUnitIdAndroid, AdmobUnitIdIos);
                Adverts.HideBanner();
                Adverts.RequestBanner();
            }
#endif
        }
Exemple #15
0
    public void timeup()
    {
        AdMob        ad = admob.GetComponent <AdMob>();            //スコアを取得
        SE_container se = scriptbox.GetComponent <SE_container>(); //スコアを取得

        //  se.DestroyReady();
//        nextscene = 0;
//        SceneManager.LoadScene("loading");
        ad.StopBanner();
        SceneManager.LoadScene("title");//puzzleシーンをロードする
    }
Exemple #16
0
 public void DestroyAds()
 {
     if (SaveManager.GetRemoveAdsPurchased())
     {
         AdMob.destroyBanner();
         HidePurchaseBtn();
         if (mInplayAd != null)
         {
             Destroy((Object)mInplayAd);
         }
     }
 }
Exemple #17
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
Exemple #18
0
 private void Awake()
 {
     DontDestroyOnLoad(this.gameObject);
     if (reference == null)
     {
         reference = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
Exemple #19
0
    public static void Refresh()
    {
        if (P31Prefs.getInt("rads") == 3)
        {
            AdMob.destroyBanner();
#if UNITY_ANDROID
            FlurryAndroid.removeAd("main_menu");               //oculta banner do Flurry
#endif
#if UNITY_IOS
            FlurryAds.removeAdFromSpace("main_menu");
#endif
        }
    }
Exemple #20
0
 public void LoadInterstitials()
 {
     if (!SaveManager.GetRemoveAdsPurchased())
     {
         if (!AdMob.isInterstitalReady())
         {
             AdMob.requestInterstital("ca-app-pub-6553814907597998/1683793064", "ca-app-pub-6553814907597998/9207059865");
         }
         if (!Chartboost.hasInterstitial(CBLocation.GameOver))
         {
             Chartboost.cacheInterstitial(CBLocation.GameOver);
         }
         //		Inplay.Cache();
     }
 }
Exemple #21
0
 // Use this for initialization
 void Start()
 {
     camera = GameObject.Find("Main Camera");
     this.firebaseManagement = camera.GetComponent <FirebaseManagement>();
     this.adMob    = camera.GetComponent <AdMob>();
     gameOverPanel = GameObject.Find("GameOverPanel");
     hiScorePanel  = GameObject.Find("HiScorePanel");
     gameOverPanel.SetActive(false);
     hiScorePanel.SetActive(false);
     PlayerInit();
     this.newAnswer();
     for (int i = 0; i < 4000; i++)
     {
         // just a delay...
         Debug.Log("");
     }
 }
Exemple #22
0
    void ShowAd()
    {
        if (usingMixed) //When unity ads and AdMob enabled togather
        {
#if UNITY_ADS && ENABLE_ADMOB
            UnityEngine.Random.InitState(DateTime.Now.Millisecond);
            int rng = UnityEngine.Random.Range(0, 2);
            if (rng == 1) //Chose AD network randomly with 50/50 chanse
            {
                StartLoading();

                if (!ShowUnityAdsRewardedVideo())
                {
                    AdMob.ShowAdMobRewardedVideo();
                }
            }
            else
            {
                StartLoading();
                if (!AdMob.ShowAdMobRewardedVideo())
                {
                    ShowUnityAdsRewardedVideo();
                }
            }
#endif
        }
        else
        {
            if (usingUnityAds)
            {
#if UNITY_ADS
                StartLoading();
                ShowUnityAdsRewardedVideo();
#endif
            }
            else if (usingAdmob)
            {
#if ENABLE_ADMOB
                StartLoading();
                AdMob.ShowAdMobRewardedVideo();
#endif
            }
        }
    }
    protected void Start()
    {
        audioSource = GetComponent <AudioSource>();
        admob       = GameObject.Find("AdMob").GetComponent <AdMob>();
        videoPlayer = GameObject.Find("Video Player").GetComponent <VideoPlayer>();
        BGM         = GameObject.Find("BGM").GetComponent <AudioSource>();

        courseButtons    = new GameObject[theNumberOfCourses];
        admobBannerExist = false;
        canClick         = true; //初めはボタンをクリックできる状態にしておく

        /*バナー広告を最初の1回だけリクエストする*/
        if (!admobBannerExist)
        {
            admob.RequestBanner();
            admobBannerExist = true;
        }

        /*アプリ起動時のみオープニング動画を再生する*/
        if (moviePlay)
        {
            lastScreen = Screen.title;
            PlayOpeningMovie();
            moviePlay = false;

            /*デバッグ用*/
            //PlayerPrefs.SetInt("Course1".ToString(), 0);
            //for (int i = 1; i <= 15; i++) {
            //    /*15コースをクリア済みにしておく*/
            //    PlayerPrefs.SetInt("Course" + (i + 1).ToString(), 1);
            //}
        }
        else
        {
            BGM.mute = false;
            //BGM.Play();
            videoPlayer.Pause();
            initialMovieBackground.gameObject.SetActive(false);
        }

        Initialize();
    }
Exemple #24
0
 /// <summary>
 /// Init this instance.
 /// </summary>
 private void Init()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
         if (admob == null)
         {
             admob = GetComponent <AdMob> ();
         }
         if (chartBoostAd == null)
         {
             chartBoostAd = GetComponent <ChartboostAd> ();
         }
     }
     else
     {
         Destroy(gameObject);
     }
 }
Exemple #25
0
 void Awake()
 {
     score          = transform.Find("Game/ScorePanel/Score").GetComponent <Text> ();
     time           = transform.Find("Game/Time").GetComponent <Slider> ();
     life           = transform.Find("Game/Life").GetComponent <Slider> ();
     timeremaining  = time.transform.Find("Seconds").GetComponent <Text> ();
     liferemaining  = life.transform.Find("Lives").GetComponent <Text> ();
     starttimetext  = transform.Find("Game/AnimTime").GetComponent <Text> ();
     gamepanel      = transform.Find("Game");
     gameover       = gamepanel.Find("GameOver");
     blockRaycast   = gamepanel.Find("BlockRaycast");
     pause          = gamepanel.Find("Pause").GetComponent <Button> ();
     layoutlength   = 12;
     Time.timeScale = 0;
     layoutnumber   = 0;
     admob          = GameObject.FindGameObjectWithTag("AdMob").GetComponent <AdMob> ();
     bestscore [1]  = transform.Find("Score/Classic/Score").GetComponent <Text> ();
     bestscore [2]  = transform.Find("Score/LightAttack/Score").GetComponent <Text> ();
     bestscore [3]  = transform.Find("Score/Countto3/Score").GetComponent <Text> ();
 }
Exemple #26
0
 private void Start()
 {
     slowmotionClass                       = slowmotion.GetComponent <Slowmotion>();
     playerClass                           = player.GetComponent <Player>();
     playerActionsClass                    = player.GetComponent <PlayerActions>();
     coinsAcquiredOnScreenText             = coinsAcquired.GetComponent <TextMeshProUGUI>();
     coinsInScene                          = FindObjectsOfType <Coin>().Length;
     coinsAcquiredOnScreenText.text        = currentCoinsAcquired.ToString() + " / " + coinsInScene;
     playerStats                           = FindObjectOfType <PlayerStatistics>();
     taskHandler                           = FindObjectOfType <TaskHandler>();
     prevLowerBound                        = Camera.main.ViewportToWorldPoint(new Vector3(0, 0, 0)).y;
     playSpaceCollider                     = playSpace.GetComponent <PolygonCollider2D>();
     gameLinesClass                        = gameLines.GetComponent <GameLines>();
     levelCompletedText                    = levelCompletedTextGO.GetComponent <TextMeshProUGUI>();
     PersistentInformation.LevelIdentifier = gameObject.scene.name;
     pg = FindObjectOfType <ProceduralGeneration>();
     initialTimeForAdButtonAnimation = timeForAdButtonAnimation;
     adMobClass = FindObjectOfType <AdMob>();
     adMobClass.RequestRewardBasedVideo();
     adMobClass.RequestInterstitial();
 }
Exemple #27
0
    void Start()
    {
        if (o == null)
        {
            o = this;
        }
        else
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);
        AndroidBannerID = "ca-app-pub-8367138567926894/2262318963";
        AndroidVideoID  = "ca-app-pub-8367138567926894/3739052162";
        AppleBannerID   = "ca-app-pub-8367138567926894/2122718160";
        AppleVideoID    = "ca-app-pub-8367138567926894/8169251764";
        //Admob.Instance ().setTesting (true);
        #if UNITY_IOS
        Admob.Instance().initAdmob(AppleBannerID, AppleVideoID);
#endif
#if UNITY_ANDROID
        Admob.Instance().initAdmob(AndroidBannerID, AndroidVideoID);
                #endif
        Admob.Instance().loadInterstitial();
    }
        void Awake()
        {
            if (instance != null)
            {
                Destroy(gameObject);
            }
            else
            {
                DontDestroyOnLoad(gameObject);
                instance = this;

                                #if ALLINONE_ADMOB
                adMob = GetComponent <AdMob> ();
                                #endif

                                #if ALLINONE_UNITYADS
                unityAds = GetComponent <UnityAds> ();
                                #endif

                                #if ALLINONE_CHARTBOOST
                chartboost = GetComponent <ChartboostAds.ChartboostAds> ();
                                #endif
            }
        }
    void Start()
    {
        intrebare           = this.transform.Find("GameScreen").Find("QuestionText").GetComponent <Text> ();
        questionCurrentText = this.transform.Find("GameScreen").Find("QuestionCurrent").GetComponent <Text> ();
        GameScreen          = this.transform.Find("GameScreen").gameObject;
        EndScreen           = this.transform.Find("EndScreen").gameObject;
        admob = this.gameObject.GetComponent <AdMob> ();
        PlayerPrefs.DeleteAll();


        for (i = 0; i <= 3; i++)
        {
            answers [i] = this.transform.Find("GameScreen").Find("B" + (i + 1).ToString()).Find("Text").GetComponent <Text> ();
        }

        visited  = new bool[questions.Length];
        answered = new Answered[16];         //modificat dupa nr maxim de intrebari ce vin in total!

        for (i = 1; i <= 15; i++)
        {
            scoreTextsEnd [i] = this.transform.Find("EndScreen").Find("Q" + i.ToString()).gameObject;
            scoreTextsAux [i] = this.transform.Find("EndScreen").Find("QuestionTexts" + i.ToString()).gameObject;
        }
    }
Exemple #30
0
        public static void Request(Segment segment, System.Action <bool> callback)
        {
            var zone = segment.ZoneId;

            Debug.Log("FunAd.Rewarded.Request: " + zone);

            if (zone.IsNullOrEmpty())
            {
                admono.Call(callback, false);
                return;
            }

            if (segment.IsReady)
            {
                admono.Call(callback, true);
                return;
            }

#if ABR || TAPSELL
            TapsellPlus.RequestRewardedVideoAd(zone,
                                               zoneId =>
            {
                segment.ResponseZone = zoneId.zoneId;
                callback?.Invoke(true);
                OnLoaded?.Invoke(segment);
            },
                                               error =>
            {
                Debug.Log("Tapsell.RequestRewardedVideo.Error: " + error.message);
                callback?.Invoke(false);
                OnError?.Invoke(segment);
            });
#elif UAD
            UnityAd.Load(zone, success =>
            {
                if (success)
                {
                    segment.ResponseZone = zone;
                    callback?.Invoke(true);
                    OnLoaded?.Invoke(segment);
                }
                else
                {
                    OnError?.Invoke(segment);
                    callback?.Invoke(false);
                }
            });
#elif ADMOB
            AdMob.RequestRewarded(zone,
                                  zid =>
            {
                segment.ResponseZone = zone;
                callback?.Invoke(true);
                OnLoaded?.Invoke(segment);
            },
                                  error =>
            {
                Debug.Log("AdMob.RequestRewarded.Error: " + error);
                callback?.Invoke(false);
                OnError?.Invoke(segment);
            });
#else
            callback?.Invoke(false);
#endif
        }
Exemple #31
0
    void OnGUI()
    {
        beginColumn();


        if (GUILayout.Button("Set Test Devices"))
        {
            // replace with your device info!
            AdMob.setTestDevices(new string[] { "6D13FA054BC989C5AC41900EE14B0C1B", "8E2F04DC5B964AFD3BC2D90396A9DA6E", "3BAB93112BBB08713B6D6D0A09EDABA1", "079adeed23ef3e9a9ddf0f10c92b8e18", "E2236E5E84CD318D4AD96B62B6E0EE2B", "149c34313ce10e43812233aad0b9aa4d" });
        }


        if (GUILayout.Button("Create Smart Banner"))
        {
            // place it on the top
            AdMob.createBanner("ca-app-pub-8386987260001674/2631573141", "ca-app-pub-8386987260001674/8398905145", AdMobBanner.SmartBanner, AdMobLocation.BottomCenter);
        }


        if (GUILayout.Button("Create 320x50 banner"))
        {
            // place it on the top
            AdMob.createBanner("ca-app-pub-8386987260001674/2631573141", "ca-app-pub-8386987260001674/8398905145", AdMobBanner.Phone_320x50, AdMobLocation.TopCenter);
        }


        if (GUILayout.Button("Create 300x250 banner"))
        {
            // center it on the top
            AdMob.createBanner("ca-app-pub-8386987260001674/2631573141", "ca-app-pub-8386987260001674/8398905145", AdMobBanner.Tablet_300x250, AdMobLocation.BottomCenter);
        }


        if (GUILayout.Button("Destroy Banner"))
        {
            AdMob.destroyBanner();
        }


        endColumn(true);


        if (GUILayout.Button("Request Interstitial"))
        {
            AdMob.requestInterstital("ca-app-pub-8386987260001674/9875638345", "ca-app-pub-8386987260001674/7061772743");
        }


        if (GUILayout.Button("Is Interstitial Ready?"))
        {
            var isReady = AdMob.isInterstitalReady();
            Debug.Log("is interstitial ready? " + isReady);
        }


        if (GUILayout.Button("Display Interstitial"))
        {
            AdMob.displayInterstital();
        }

        endColumn();
    }
 // Use this for initialization
 void Start()
 {
     adMobScript = gameObject.GetComponent <AdMob>();
     GenerateAnswers();
 }