Example #1
0
 void Awake()
 {
     if (LaunchManager.IsFirstLaunchForCurrentSession)
     {
         AdsRemoved = PlayerPrefs.GetInt("RemoveAds", 0) == 1;
         DontDestroyOnLoad(gameObject);
         instance = this;
                     #if UNITY_ANDROID
         AppLovin.SetSdkKey(SDK_KEY);
         AppLovin.InitializeSdk();
         AppLovin.SetUnityAdListener(gameObject.name);
         if (!AdsRemoved)
         {
             AppLovin.PreloadInterstitial();
             ShowBanner();
         }
         AppLovin.LoadRewardedInterstitial();
                     #elif UNITY_IOS
         if (!LaunchManager.IsFirstSession)
         {
             Init();
         }
                     #endif
     }
     else
     {
                     #if UNITY_IOS
         if (!SkyRiseAds.instance.IsInit)
         {
             SkyRiseAds.instance.Init();
         }
                     #endif
         Destroy(gameObject);
     }
 }
Example #2
0
 void OnStartApplovin()
 {
         #if UNITY_ANDROID
     AppLovin.InitializeSdk();
     AppLovin.PreloadInterstitial();
             #endif
 }
Example #3
0
 void onAppLovinEventReceived(string ev)
 {
     if (ev.Contains("DISPLAYEDINTER"))
     {
         // An ad was shown.  Pause the game.
     }
     else if (ev.Contains("HIDDENINTER"))
     {
         // Ad ad was closed.  Resume the game.
         // If you're using PreloadInterstitial/HasPreloadedInterstitial, make a preload call here.
         AppLovin.PreloadInterstitial();
     }
     else if (ev.Contains("LOADEDINTER"))
     {
         // An interstitial ad was successfully loaded.
     }
     else if (string.Equals(ev, "LOADINTERFAILED"))
     {
         // An interstitial ad failed to load.
     }
     else if (ev.Contains("LOADEDREWARDED"))
     {
         // A rewarded video was successfully loaded.
     }
     else if (ev.Contains("LOADREWARDEDFAILED"))
     {
         // A rewarded video failed to load.
     }
     else if (ev.Contains("HIDDENREWARDED"))
     {
         // A rewarded video was closed.  Preload the next rewarded video.
         AppLovin.LoadRewardedInterstitial();
     }
 }
Example #4
0
    // Awake function from Unity's MonoBehavior
    void Awake()
    {
        // GameAnalytics.Initialize();
        AppLovin.InitializeSdk();
        AppLovin.PreloadInterstitial();

        if (Instance != null)
        {
            Destroy(this.gameObject);
        }
        else
        {
            Instance = this;
            DontDestroyOnLoad(this);
        }

        if (!FB.IsInitialized)
        {
            // Initialize the Facebook SDK
            FB.Init(InitCallback, OnHideUnity);
        }
        else
        {
            // Already initialized, signal an app activation App Event
            FB.ActivateApp();
        }

        // StartEvent();
    }
Example #5
0
    void Start()
    {
        //PlayerPrefs.DeleteAll();
        GameObject.Find("DontDestroy").GetComponent <AudioSource>().volume = 1.0f;

        Physics.gravity = new Vector3(0, -55f, 0);               //reset the gravity of the ball to -30
        pointScore      = 0;
        starScore       = 0;
        bestPoint       = PlayerPrefs.GetInt("HighPoint");
        bestStars       = PlayerPrefs.GetInt("HighStar");

        rend        = GetComponent <Renderer>();
        myRigidbody = GetComponent <Rigidbody>();
        gameObject.GetComponent <Renderer>().material.color = myMaterials[random.Next(0, myMaterials.Length)].color;

        ballTouchSounds = GetComponents <AudioSource>();
        hit             = ballTouchSounds[0];
        notHit          = ballTouchSounds[1];
        hitCircle       = ballTouchSounds[2];
        jumpSound       = ballTouchSounds[3];
        starSound       = ballTouchSounds[4];

        //Ad
        numOfPlay++;

        if (numOfPlay % 4 == 0)
        {
            if (PlayerPrefs.GetInt("IsPurchased", 0) == 0)
            {
                AppLovin.PreloadInterstitial();
            }
        }
    }
 /// <summary>
 /// preload an interstitial ad before showing
 /// if it fails for maxRetryCount times do not try anymore
 /// </summary>
 void PreloadInterstitial()
 {
     retryNumberInterstitial++;
     if (retryNumberInterstitial < maxRetryCount)
     {
         AppLovin.PreloadInterstitial();
     }
 }
Example #7
0
    void onAppLovinEventReceived(string ev)
    {
        Debug.Log("ENTERED APPLOVIN CALLABACK REGION.");
        Debug.Log("EVENT: " + ev);

        if (ev.Contains("DISPLAYEDINTER"))
        {
            // An ad was shown.  Pause the game.
        }
        else if (ev.Contains("HIDDENINTER"))
        {
            // Ad ad was closed.  Resume the game.
            // If you're using PreloadInterstitial/HasPreloadedInterstitial, make a preload call here.
            AppLovin.PreloadInterstitial();
            AdsHandler.currentAdState = Result.Closed;
            OnInterstitialAdClosed();
        }
        else if (ev.Contains("LOADEDINTER"))
        {
            // An interstitial ad was successfully loaded.
        }
        else if (string.Equals(ev, "LOADINTERFAILED"))
        {
            // An interstitial ad failed to load.
        }

        if (ev.Contains("REWARDAPPROVEDINFO"))
        {
            // The format would be "REWARDAPPROVEDINFO|AMOUNT|CURRENCY" so "REWARDAPPROVEDINFO|10|Coins" for example
            string delimeter = "|";

            // Split the string based on the delimeter
            string[] split = ev.Split(delimeter.ToCharArray());

            // Pull out the currency amount
            double amount = double.Parse(split[1]);

            // Pull out the currency name
            string currencyName = split[2];

            // Do something with the values from above.  For example, grant the coins to the user.
        }
        else if (ev.Contains("LOADEDREWARDED"))
        {
            // A rewarded video was successfully loaded.
        }
        else if (ev.Contains("LOADREWARDEDFAILED"))
        {
            // A rewarded video failed to load.
        }
        else if (ev.Contains("HIDDENREWARDED"))
        {
            // A rewarded video was closed.  Preload the next rewarded video.
            AppLovin.LoadRewardedInterstitial();
            AdsHandler.currentAdState = Result.Closed;
            OnRewardedAdClosed();
        }
    }
    void onAppLovinEventReceived(string ev)
    {
        if (ev.Contains("DISPLAYEDINTER"))
        {
            // An ad was shown.  Pause the game.
        }
        else if (ev.Contains("HIDDENINTER"))
        {
            // Ad ad was closed.  Resume the game.
            // If you're using PreloadInterstitial/HasPreloadedInterstitial, make a preload call here.
            AppLovin.PreloadInterstitial();
        }
        else if (ev.Contains("LOADEDINTER"))
        {
            // An interstitial ad was successfully loaded.
        }
        else if (string.Equals(ev, "LOADINTERFAILED"))
        {
            // An interstitial ad failed to load.
            LoadInterstitial();
        }
        else if (ev.Contains("REWARDAPPROVEDINFO"))
        {
            // The format would be "REWARDAPPROVEDINFO|AMOUNT|CURRENCY" so "REWARDAPPROVEDINFO|10|Coins" for example

            /*string delimeter = "|";
             *
             * // Split the string based on the delimeter
             * string[] split = ev.Split(delimeter);
             *
             * // Pull out the currency amount
             * double amount = double.Parse(split[1]);
             *
             * // Pull out the currency name
             * string currencyName = split[2];
             *
             * // Do something with the values from above.  For example, grant the coins to the user.
             * updateBalance(amount, currencyName);*/
        }
        else if (ev.Contains("LOADEDREWARDED"))
        {
            // A rewarded video was successfully loaded.
        }
        else if (ev.Contains("LOADREWARDEDFAILED"))
        {
            // A rewarded video failed to load.
            LoadVideo();
        }
        else if (ev.Contains("HIDDENREWARDED"))
        {
            // A rewarded video was closed.  Preload the next rewarded video.
            //AppLovin.LoadRewardedInterstitial();
            LoadVideo();
        }
    }
Example #9
0
    // Use this for initialization
    private void Awake()
    {
        instance = this;

        Application.targetFrameRate = 60;
        isGameOver = false;
        AppLovin.SetSdkKey("Mw_ES5QLA1N9SQwMF5ZANA5GH26ffm80f8E7DfSNgqX8ERUUX3evEkAVnGAQ0JRgRfofKE203Z8I0cnTgPSv8c");
        AppLovin.InitializeSdk();
        AppLovin.SetUnityAdListener("_GameManager");
        AppLovin.PreloadInterstitial();
        AppLovin.LoadRewardedInterstitial();
    }
 // Token: 0x06000DD3 RID: 3539 RVA: 0x000583B4 File Offset: 0x000567B4
 private void Start()
 {
     if (Application.platform == RuntimePlatform.Android && !Application.isEditor)
     {
         Advertisement.Initialize(Adpack.Unity_ID);
         AppLovin.SetSdkKey(Adpack.apploving);
         AppLovin.InitializeSdk();
         AppLovin.SetUnityAdListener(base.gameObject.name);
         AppLovin.PreloadInterstitial(null);
     }
     this.levelname = Application.loadedLevelName;
 }
    public bool InterstitialIsReady() // if readey inter
    {
        var result = AppLovin.HasPreloadedInterstitial();

        if (result)
        {
        }
        else
        {
            AppLovin.PreloadInterstitial();
        }

        return(result);
    }
    public bool ShowInterstitial()
    {
        if (!AppLovin.HasPreloadedInterstitial())
        {
            AppLovin.PreloadInterstitial();
        }
        else
        {
            AppLovin.ShowInterstitial();
            return(true);
        }

        return(false);
    }
Example #13
0
    /// <summary>
    /// Initialize Applovin SDK.
    /// </summary>
    /// <param name="preLoadAds">Enable pre-load ads.</param>
    public void InitializeApplovin(bool preLoadAds = true, string listenergo = null)
    {
        AppLovin.SetSdkKey("kVL0LZFNc8EVPKb9s4tuJRZOu0UHxTphLiVnq4BoOahg-2NEK5Urh5f3gu7G9ttx9FkLeHvD7v08TMOrF-w1Hv");
        AppLovin.InitializeSdk();
        AppLovin.SetTestAdsEnabled("true");
        AppLovin.SetUnityAdListener(listenergo);

        if (preLoadAds)
        {
            AppLovin.LoadRewardedInterstitial();
            AppLovin.PreloadInterstitial();
        }

        Debug.Log("<color=blue> AppLovin Initialized.</color>");
    }
Example #14
0
 public void Init()
 {
     if (!IsInit)
     {
         AppLovin.SetSdkKey(SDK_KEY);
         AppLovin.InitializeSdk();
         AppLovin.SetUnityAdListener(gameObject.name);
         IsInit = true;
         Debug.Log("ads are removed: " + AdsRemoved);
         if (!AdsRemoved)
         {
             AppLovin.PreloadInterstitial();
             ShowBanner();
         }
         AppLovin.LoadRewardedInterstitial();
     }
 }
        public bool PreLoadAd()
        {
            if (m_InterstitialHandler == null)
            {
                return(false);
            }

            if (!m_HasInit)
            {
                m_HasInit = true;
                ApplovinEventCenter.S.on_InterLoaded     += HandleOnAdLoaded;
                ApplovinEventCenter.S.on_InterClose      += HandleOnAdClosed;
                ApplovinEventCenter.S.on_InterLoadFailed += HandleOnAdFailedToLoad;
            }

            AppLovin.PreloadInterstitial(m_InterstitialHandler.GetAdConfig().unitID);
            return(true);
        }
Example #16
0
    private void onAppLovinEventReceived(string value)
    {
        Debug.Log(value);
        switch (value)
        {
                #if UNITY_IOS
        case "HIDDENREWARDED":
            Music.instance.UnPause();
            OnRewardedInterClosed();
            AppLovin.LoadRewardedInterstitial();
            break;
                #elif UNITY_ANDROID
        case "REWARDAPPROVED":
            OnRewardedInterClosed();
            AppLovin.LoadRewardedInterstitial();
            break;
                #endif

        case "HIDDENINTER":
                #if UNITY_IOS
            Music.instance.UnPause();
                #endif
            if (OnInterClosed != null)
            {
                OnInterClosed();
            }
            AppLovin.PreloadInterstitial();
            break;

        case "REWARDREJECTED":
        case "REWARDOVERQUOTA":
        case "REWARDTIMEOUT":
            OnRewardedInterFailed();
            break;

                #if UNITY_IOS
        case "DISPLAYEDREWARDED":
        case "DISPLAYEDINTER":
            Music.instance.Pause();
            break;
                #endif
        }
    }
Example #17
0
        protected override void InternalLoadInterstitialAd(AdPlacement placement)
        {
#if EM_APPLOVIN
            string id = placement == AdPlacement.Default ?
                        mAdSettings.DefaultInterstitialAdId.Id :
                        FindIdForPlacement(mAdSettings.CustomInterstitialAdIds, placement);

            if (placement.Equals(AdPlacement.Default)) // Default interstitial ad...
            {
                if (string.IsNullOrEmpty(id))
                {
                    AppLovin.PreloadInterstitial();
                }
                else
                {
                    AppLovin.PreloadInterstitial(id);
                }
            }
            else // Custom interstitial ad...
            {
                if (!mCustomInterstitialAds.Contains(placement))
                {
                    mCustomInterstitialAds.Add(placement);
                }

                if (string.IsNullOrEmpty(id))
                {
                    AppLovin.PreloadInterstitial();
                }
                else
                {
                    AppLovin.PreloadInterstitial(id);
                }
            }
#endif
        }
Example #18
0
 // Token: 0x06000CB6 RID: 3254 RVA: 0x000502DC File Offset: 0x0004E6DC
 private void Start()
 {
     Time.timeScale          = 1f;
     this.audio              = base.GetComponent <AudioSource>();
     this.audio.volume       = 1f;
     this.defaultClip        = this.audio.clip;
     Screen.orientation      = ScreenOrientation.LandscapeLeft;
     this.exitscreen         = this.exitscreen.GetComponent <Canvas>();
     this.exitscreen.enabled = false;
     base.StartCoroutine(this.StartButtons());
     if (Application.platform == RuntimePlatform.Android && !Application.isEditor)
     {
         Advertisement.Initialize(Adpack.Unity_ID);
         Admob.Instance().removeBanner("defaultBanner");
         Admob.Instance().initAdmob(Adpack.AD_MOB_ID, Adpack.AD_MOB_INTERSTITIAL_ID);
         Admob.Instance().loadInterstitial();
         HeyzapAds.Start("20af69e9c1ecd52279380e39b0c6216f", 0);
         HZInterstitialAd.fetch("default");
         AppLovin.SetSdkKey(Adpack.apploving);
         AppLovin.InitializeSdk();
         AppLovin.SetUnityAdListener(base.gameObject.name);
         AppLovin.PreloadInterstitial(null);
     }
 }
Example #19
0
    void PlayerDiedEndTheGame()
    {
        if (!PlayerPrefs.HasKey("Score"))
        {
            PlayerPrefs.SetInt("Score", 0);
        }
        else
        {
            int highscore = PlayerPrefs.GetInt("Score");

            if (highscore < score)
            {
                PlayerPrefs.SetInt("Score", score);
            }
        }
        AdsController.instance.deaths++;
        AppLovin.PreloadInterstitial();

        pauseText.text = "Game Over";
        pausePanel.SetActive(true);
        restartGameButton.onClick.RemoveAllListeners();
        restartGameButton.onClick.AddListener(() => RestartGame());
        Time.timeScale = 0f;

        if (AdsController.instance.deaths % 3 == 0)
        {
            if (AppLovin.HasPreloadedInterstitial())
            {
                AppLovin.ShowInterstitial();
            }
            else
            {
                AdsController.instance.deaths--;
            }
        }
    }
Example #20
0
    // Use this for initialization
    void Start()
    {
        GameObject[] enemys = GameObject.FindGameObjectsWithTag("PlayManager");
        if (enemys.GetLength(0) != 1)
        {
            Destroy(transform.gameObject);
        }
        instance    = this;
        games_count = 0;
        count       = 0;

        AppLovin.InitializeSdk();
        AppLovin.PreloadInterstitial();
        AppLovin.SetUnityAdListener(gameObject.name);
        //AdMob init

        //Admob.Instance ().initAdmob ("ca-app-pub-5744130550718724/8983149295", "ca-app-pub-5744130550718724/6345910496");
        //Admob.Instance().loadInterstitial();
        //RequestBanner ();
        //ShowBannerTop ();
        //RequestInterstitial ();
        //Chartboost.cacheInterstitial (CBLocation.HomeScreen);
        //StartApp

        AudioSrc = GetComponent <AudioSource> ();
        PlayGamesPlatform.Activate();
        PlayGamesPlatform.Instance.Authenticate((bool success) => {
            //IsConnectedToGooglePlay = success;
        });
        SetHiScore();

        //Social.ReportScore (PlayerPrefs.GetInt ("HighScore"), "FirstDaily", GPGSIds.leaderboard_top_ninjas, (bool success) => {
        //});
        if (PlayerPrefs.HasKey("Pirate"))
        {
            GooglePlayManager.instance.UnlockAchi("Pirate");
        }
        if (PlayerPrefs.HasKey("Maiden"))
        {
            GooglePlayManager.instance.UnlockAchi("Maiden");
        }
        if (PlayerPrefs.HasKey("Samurai"))
        {
            GooglePlayManager.instance.UnlockAchi("Samurai");
        }
        if (PlayerPrefs.HasKey("Spy"))
        {
            GooglePlayManager.instance.UnlockAchi("Spy");
        }
        if (PlayerPrefs.HasKey("Ranger"))
        {
            GooglePlayManager.instance.UnlockAchi("Ranger");
        }

        if (PlayerPrefs.GetInt("HighScore") >= 40)
        {
            GooglePlayManager.instance.UnlockAchi("cow");
            PlayerPrefs.SetInt("EnemyUnlocked", 11);
        }

        if (PlayerPrefs.GetInt("HighScore") >= 70)
        {
            GooglePlayManager.instance.UnlockAchi("Ghost");
            PlayerPrefs.SetInt("EnemyUnlocked", 12);
        }

        if (PlayerPrefs.GetInt("HighScore") >= 100)
        {
            GooglePlayManager.instance.UnlockAchi("Hero");
            PlayerPrefs.SetInt("EnemyUnlocked", 13);
        }
    }
Example #21
0
    //private InterstitialAd interstitial;
    //private RewardBasedVideoAd rewardBasedVideo;


    // Use this for initialization
    void Start()
    {
        AppLovin.PreloadInterstitial();
    }
 public void LoadInterstitial()
 {
     //Debug.Log("XXXXX Calling AppLovin Preload Interstitial");
     AppLovin.PreloadInterstitial();
 }
    /****************************************插页广告******************************************** */

    //下载 插页广告
    private void LoadInsert()
    {
        AppLovin.PreloadInterstitial(insert_zoneID);//预加载 插页广告
    }
Example #24
0
 public void LoadInsterstitial()
 {
     AppLovin.PreloadInterstitial();
 }
 private void Start()
 {
     AppLovin.InitializeSdk();
     AppLovin.PreloadInterstitial();
 }