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(); } } }
private void Awake() { #if UNITY_EDITOR Debug.unityLogger.logEnabled = true; #else Debug.unityLogger.logEnabled = false; #endif Application.targetFrameRate = 60; if (FB.IsInitialized) { FB.ActivateApp(); } else { //Handle FB.Init FB.Init(() => { FB.ActivateApp(); }); } //PlayerPrefs.DeleteAll(); #if !UNITY_EDITOR AppLovin.InitializeSdk(); #endif }
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(); } }
public void GameOverEvent(int score) { // Showing without using PreloadInterstitial AppLovin.ShowInterstitial(); // Showing utilizing PreloadInterstitial and HasPreloadedInterstitial if (AppLovin.HasPreloadedInterstitial()) { // An ad is currently available, so show the interstitial. AppLovin.ShowInterstitial(); } else { // No ad is available. Perform failover logic... } // GameAnalytics.NewProgressionEvent(GAProgressionStatus.Complete, "game", score); var param = new Dictionary <string, object>(); param[AppEventParameterName.ContentID] = "game"; param[AppEventParameterName.Success] = "0"; FB.LogAppEvent( AppEventName.CompletedRegistration, parameters: param ); }
public void ShowInterstitial() { Log("Showing interstitial ad"); // Optional: You can call `AppLovin.PreloadInterstitial()` and listen to the "LOADED" event to preload the ad from the network before showing it AppLovin.ShowInterstitial(); }
public bool PreLoadAd() { if (m_RewardVideoHandler == null) { return(false); } if (!m_HasInit) { m_HasInit = true; ApplovinEventCenter.S.on_RewardLoaded += HandleOnAdLoaded; ApplovinEventCenter.S.on_RewardClose += HandleOnAdClosed; ApplovinEventCenter.S.on_RewardLoadFailed += HandleOnAdFailedToLoad; ApplovinEventCenter.S.on_RewardReward += HandleOnAdRewarded; } if (isAdReady) { return(false); } AppLovin.LoadRewardedInterstitial(m_RewardVideoHandler.GetAdConfig().unitID); return(true); }
void OnStartApplovin() { #if UNITY_ANDROID AppLovin.InitializeSdk(); AppLovin.PreloadInterstitial(); #endif }
protected override void InternalShowRewardedAd(AdPlacement placement) { #if EM_APPLOVIN if (placement.Equals(AdPlacement.Default)) { if (string.IsNullOrEmpty(mAdSettings.DefaultRewardedAdId.Id)) { AppLovin.ShowRewardedInterstitial(); } else { AppLovin.ShowRewardedInterstitialForZoneId(mAdSettings.DefaultRewardedAdId.Id); } currentShowingRewarded = placement; } else { if (mAdSettings.CustomRewardedAdIds.ContainsKey(placement)) { if (string.IsNullOrEmpty(mAdSettings.CustomRewardedAdIds[placement].Id)) { AppLovin.ShowRewardedInterstitial(); } else { AppLovin.ShowRewardedInterstitialForZoneId(mAdSettings.CustomRewardedAdIds[placement].Id); } currentShowingRewarded = placement; } } #endif }
public static void showAppLovinBanner() { if (SSAdInitializer.AppLovinStaticFlag) { AppLovin.ShowAd(AppLovin.AD_POSITION_CENTER, AppLovin.AD_POSITION_BOTTOM); } }
public void RunAppLovinAd(AdType type) { switch (type) { case AdType.Interstitial: if (AppLovin.HasPreloadedInterstitial()) { AppLovin.ShowInterstitial(); } break; case AdType.Rewarded: if (AppLovin.IsIncentInterstitialReady()) { AppLovin.ShowRewardedInterstitial(); } break; case AdType.Banner: throw new System.NotImplementedException("Applovin does't have type of Banner."); default: throw new System.NotImplementedException("Unknown type."); } }
void Start() { AppLovin.ShowAd(AppLovin.AD_POSITION_CENTER, AppLovin.AD_POSITION_BOTTOM); StartCoroutine(ExecuteAfterTime(0.1f)); startTimer = 3.2f; gameTimer = 30f; scoreNum = 0; scoreTemp = 0; coin.sortingOrder = -1; net.sortingOrder = -2; scoreText.text = PlayerPrefs.GetInt("TimeScore", 0).ToString(); moveNet = true; highscoreMusic = true; highscoreText.text = PlayerPrefs.GetInt("TimeChallengeScore", 0).ToString(); coins = PlayerPrefs.GetInt("Coins"); coinsText.text = PlayerPrefs.GetInt("Coins", 0).ToString(); height = Camera.main.orthographicSize * 2.0f; width = height * Screen.width / Screen.height; netWidth = barMover.bounds.size.x; goalSource.clip = goalSound; loseSource.clip = loseSound; coinSource.clip = coinSound; highscoreSource.clip = highscoreSound; Button retryBtn = retry.GetComponent <Button>(); retry.onClick.AddListener(RetryBtnClick); Button mainMenuBtn = mainMenu.GetComponent <Button>(); mainMenu.onClick.AddListener(MainMenuBtnClick); }
// Start is called before the first frame update void Start() { deaths = 0; //AppLovin.SetSdkKey(SDK_KEY); AppLovin.InitializeSdk(); AppLovin.SetUnityAdListener(this.gameObject.name); }
public void ShowInterstitialAd() { if (AppLovin.HasPreloadedInterstitial()) { AppLovin.ShowInterstitial(); } }
public void ShowBanner() { #if UNITY_ANDROID || UNITY_IPHONE AppLovin.ShowAd(AppLovin.AD_POSITION_CENTER, AppLovin.AD_POSITION_BOTTOM); AppsFlyerManager.Instance.TrackBannerAppLovinView(); #endif }
// 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(); }
// Use this for initialization void Start() { AppLovin.SetSdkKey(SDK_KEY); AppLovin.InitializeSdk(); AppLovin.SetUnityAdListener(this.gameObject.name); StartCoroutine(CallAds()); }
void FreeCoinsButtonClick() { if (AppLovin.IsIncentInterstitialReady()) { AppLovin.ShowRewardedInterstitial(); } }
public void ShowRewardedVideo() { if (AppLovin.IsIncentInterstitialReady()) { AppLovin.ShowRewardedInterstitial(); } }
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); } }
IEnumerator waitAfterDead() { ballForwardSpeed = 0; ballJumpSpeed = 0; if (gameObject.GetComponent <Renderer>().material.color == myMaterials[0].color) { Instantiate(afterDeathRed, new Vector3(transform.position.x, transform.position.y + .5f, transform.position.z), transform.rotation); } if (gameObject.GetComponent <Renderer>().material.color == myMaterials[1].color) { Instantiate(afterDeathGreen, new Vector3(transform.position.x, transform.position.y + .5f, transform.position.z), transform.rotation); } if (gameObject.GetComponent <Renderer>().material.color == myMaterials[2].color) { Instantiate(afterDeathBlue, new Vector3(transform.position.x, transform.position.y + .5f, transform.position.z), transform.rotation); } gameObject.GetComponent <MeshRenderer>().enabled = false; Debug.Log("Start"); //ad if (numOfPlay % 4 == 0) { if (PlayerPrefs.GetInt("IsPurchased", 0) == 0) { if (AppLovin.HasPreloadedInterstitial()) { AppLovin.ShowInterstitial(); } } } GameObject.Find("DontDestroy").GetComponent <AudioSource>().volume = 0.8f; yield return(new WaitForSeconds(0.2f)); GameObject.Find("DontDestroy").GetComponent <AudioSource>().volume = 0.5f; yield return(new WaitForSeconds(0.2f)); GameObject.Find("DontDestroy").GetComponent <AudioSource>().volume = 0.3f; yield return(new WaitForSeconds(0.2f)); GameObject.Find("DontDestroy").GetComponent <AudioSource>().volume = 0.05f; GameObject.Find("DontDestroy").GetComponent <SetDontDestroyOnLoad>().PlayRandomMusic(); yield return(new WaitForSeconds(1.0f)); Debug.Log("end"); GoToRandomStage(); }
/// <summary> /// Initializing AppLovin /// </summary> /// <param name="consent">user consent -> if true show personalized ads</param> /// <param name="platformSettings">contains all required settings for this publisher</param> public void InitializeAds(UserConsent consent, UserConsent ccpaConsent, List <PlatformSettings> platformSettings) { debug = Advertisements.Instance.debug; if (initialized == false) { if (debug) { AppLovin.SetVerboseLoggingOn("true"); } //get settings #if UNITY_ANDROID PlatformSettings settings = platformSettings.First(cond => cond.platform == SupportedPlatforms.Android); #endif #if UNITY_IOS PlatformSettings settings = platformSettings.First(cond => cond.platform == SupportedPlatforms.iOS); #endif //preparing AppLovin SDK for initialization Debug.Log("APPID: " + settings.appId.id.ToString()); AppLovin.SetSdkKey(settings.appId.id.ToString()); if (consent == UserConsent.Accept || consent == UserConsent.Unset) { AppLovin.SetHasUserConsent("true"); } else { AppLovin.SetHasUserConsent("false"); } if (settings.directedForChildren == true) { AppLovin.SetIsAgeRestrictedUser("true"); } else { AppLovin.SetIsAgeRestrictedUser("false"); } AppLovin.InitializeSdk(); AppLovin.SetUnityAdListener(gameObject.name); if (debug) { Debug.Log(this + " " + "Start Initialization"); ScreenWriter.Write(this + " " + "Start Initialization"); Debug.Log(this + " SDK key: " + settings.appId.id); ScreenWriter.Write(this + " SDK key: " + settings.appId.id); } //start loading ads PreloadInterstitial(); PreloadRewardedVideo(); initialized = true; } }
public bool isRewardedVideoReady() { #if UNITY_EDITOR return(false); #else return(AppLovin.IsIncentInterstitialReady()); #endif }
void ShowInterstitial(Action OnInterClosed) { if (!AdsRemoved) { this.OnInterClosed = OnInterClosed; AppLovin.ShowInterstitial(); } }
IEnumerator CallAds() { yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(3f))); LoadInterstitial(); LoadVideo(); AppLovin.ShowAd(AppLovin.AD_POSITION_TOP, AppLovin.AD_POSITION_CENTER); }
private void LoadVideoDelay() { AppLovin.LoadRewardedInterstitial(); if (GameSettings.settings.boughtRemoveAds) { AppLovin.HideAd(); } }
//显示 插页广告 public void ShowInsert(Action <int> finishAction = null) { this.mFinishAction = finishAction; //注册事件 AppLovin.ShowInterstitialForZoneId(insert_zoneID); //by id 显示广告 LoadInsert(); //下载一个广告 }
public void SetAdsCount() { int Count = PlayerPrefs.GetInt("GameAdsCount", 0); Count += 1; PlayerPrefs.SetInt("GameAdsCount", Count); AppLovin.ShowAd(AppLovin.AD_POSITION_CENTER, AppLovin.AD_POSITION_BOTTOM); }
public bool ShowInterstitial() { Debug.Log("show applovin ads intertitial"); #if !UNITY_EDITOR AppLovin.ShowInterstitial(); #endif return(true); }
public void InitInterstitial() { Debug.Log("init applovin"); #if !UNITY_EDITOR AppLovin.SetSdkKey(Data.UnitId.Trim()); AppLovin.InitializeSdk(); #endif }
void ApplovinHideBanner() { if (!disableBannerAd) { AppLovin.HideAd(); disableBannerAd = true; } }
/** * Gets the default AppLovin plugin */ public static AppLovin getDefaultPlugin() { if (DefaultPlugin == null) { #if UNITY_ANDROID AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); DefaultPlugin = new AppLovin( jc.GetStatic<AndroidJavaObject>("currentActivity") ); #else DefaultPlugin = new AppLovin(); #endif } return DefaultPlugin; }