/// <summary> /// 检查是否触发了意外事件。如果在室外,触发概率高一些。 /// </summary> /// <returns><c>true</c>, if serendipity was checked, <c>false</c> otherwise.</returns> /// <param name="outdoor">If set to <c>true</c> outdoor.</param> public void CheckSerendipity() { if (GameData._playerData.minutesPassed < 1440) { return; } int r = Random.Range(0, 9999); //不触发意外事件 if (r > 750) { return; } //0信息 1广告 //如果广告没有准备好,则显示信息 if (r > 500 || !Vungle.isAdvertAvailable()) { ShowSerendipity(0); } else { ShowSerendipity(1); } }
public void videoMethod() { AudioListener.volume = 0; btn = GameObject.FindGameObjectWithTag("CoinsTag"); btn.GetComponent <Button>().interactable = false; if (InternetStatus()) { Vungle.playAd(true, "QuantumLeap"); Vungle.onAdFinishedEvent += (adFinishedEventArgs) => { if (adFinishedEventArgs.IsCompletedView) { AudioListener.volume = 1; UFE.videoCheck = true; IntroScreen.characterValue = 100; UFE.StartGame(0); } else { } }; } else { UFE.tryAgainPopUp(0f); } }
/// <summary> /// 根据类型显示意外事件,0是叙事,1是广告 /// </summary> /// <param name="sType">S type.</param> void ShowSerendipity(int sType) { SDetail.localScale = new Vector3(0.01f, 0.01f, 0.01f); SDetail.localPosition = Vector3.zero; SDetail.DOBlendableScaleBy(Vector3.one, 0.5f); if (sType == 0) { int index = Algorithms.GetIndexByRange(0, nameList.Count); headText.text = nameList[index]; detailText.text = "You found a " + nameList[index] + ", there is something wrote on it."; noticeText.text = ""; studyText.text = "Check"; studyButton.interactable = true; isAd = false; } else { headText.text = "Magic Stone"; detailText.text = "You found a magic stone, check it and you may get some prize unexpected."; noticeText.text = "(It's an Ad, your will get a reward after watching it.)"; studyButton.interactable = Vungle.isAdvertAvailable(); isAd = true; } studyText.name = sType.ToString(); }
void ShowVungleAds() { Vungle.playAd(true, "", 1); Vungle.onAdFinishedEvent += (args) => { if (args.IsCompletedView) { if (congtrathuong == false) { StartCoroutine(TraThuong(2)); StartCoroutine(doitrathuong()); congtrathuong = true; check = false; } } else { check = false; time = 15; } }; if (!Vungle.isAdvertAvailable()) { check = false; ShowRewardedAd(); } }
void ShowAd() { GetComponent <AudioSource>().mute = true; foreach (var tank in m_Tanks) { tank.Mute = true; } #if SHOW_VUNGLE_ADS if (Vungle.isAdvertAvailable()) { Vungle.playAd(); } else { OnAdCompleted(); return; } #elif SHOW_MS_ADS if (m_MicrosoftAd.State == Microsoft.UnityPlugins.InterstitialAdState.Ready) { m_MicrosoftAd.Show(); } else { m_MicrosoftAd.RequestAndShow(MicrosoftAdsAppId, NextMicrosoftAd); } #endif m_isDisplayingAd = true; }
public override bool isLoad() { #if UNITY_IPHONE || UNITY_ANDROID return(Vungle.isAdvertAvailable()); #endif return(false); }
/// <summary> /// Vungle specific event triggered after initialization is done /// </summary> private void InitCOmplete() { initComplete = true; Vungle.onInitializeEvent -= InitCOmplete; switch (consent) { case UserConsent.Unset: Vungle.updateConsentStatus(Vungle.Consent.Undefined); break; case UserConsent.Accept: Vungle.updateConsentStatus(Vungle.Consent.Accepted); break; case UserConsent.Deny: Vungle.updateConsentStatus(Vungle.Consent.Denied); break; } //load ads if (!string.IsNullOrEmpty(interstitialPlacementID)) { Vungle.loadAd(interstitialPlacementID); } if (!string.IsNullOrEmpty(rewardedPlacementId)) { Vungle.loadAd(rewardedPlacementId); } if (debug) { ScreenWriter.Write(this + " " + "Init Complete"); } }
// ---------------------------------------------------------------------- // VUNGLE - http://prime31.com/docs#comboVungle public void vungleInit() { LogUtil.Log("vungleInit"); Vungle.init(AppConfigs.publisherIdVungleAndroid, AppConfigs.publisherIdVungleiOS); //Vungle.init(AppConfigs.publisherIdVungleAndroid, AppConfigs.publisherIdVungleiOS, int age, VungleGender gender ); }
void OnGUI() { beginColumn(); if (GUILayout.Button("Start")) { Vungle.init("com.prime31.Vungle", "vungleTest"); //Vungle.init( "ANDROID_APP_ID", "IOS_APP_ID" ); } if (GUILayout.Button("Is Ad Available")) { Debug.Log("is ad available: " + Vungle.isAdvertAvailable()); } if (GUILayout.Button("Display Ad")) { Vungle.displayAdvert(true); } if (GUILayout.Button("Display Insentivized Ad")) { Vungle.displayIncentivizedAdvert(true, "user-tag"); } endColumn(); }
void Start() { Debug.Log("vungle init"); //广告实例化,一次即可。 Vungle.init(appId); initializeEventHandlers(); }
internal void Hide() { isShowing = false; #if EM_VUNGLE Vungle.closeBanner(Id.Id); #endif }
public void PlayAd() { DebugText.text = "THE BUTTON WAS CLICKED PLAY AD"; Vungle.playAdWithOptions(options); RequestAd(); }
private void Init(string AppId) { Vungle.init(AppId, null, null); VungleBtn.GetComponent <Button>().enabled = false; Disable.SetActive(true); RequestAd(); }
public bool IsVideoAdAvailable() { if (Vungle.isAdvertAvailable() || isUnityAdReady()) { return(true); } return(false); }
public void ShowRewardedVideo() { if (Vungle.isAdvertAvailable()) { Vungle.playAd(); consoleText.text += "Playing Rewarded Video Ad\n"; } }
public VungleAd(Text consoleText) { Vungle.init("577947f3bc8623f86800006c", "", ""); Vungle.adPlayableEvent += (adPlayable) => { consoleText.text += "Ad's playable state has been changed! Now: " + adPlayable + "\n"; }; }
/// <summary> /// Check if Vungle rewarded video is available /// </summary> /// <returns>true if a rewarded video is available</returns> public bool IsRewardVideoAvailable() { if (!initComplete) { return(false); } return(Vungle.isAdvertAvailable(rewardedPlacementId)); }
/// <summary> /// Show Vungle interstitial /// </summary> /// <param name="InterstitialClosed">callback called when user closes interstitial</param> public void ShowInterstitial(UnityAction InterstitialClosed) { if (IsInterstitialAvailable()) { OnInterstitialClosed = InterstitialClosed; Vungle.playAd(interstitialPlacementID); } }
void Update() { if (isAd) { studyButton.interactable = Vungle.isAdvertAvailable(); studyText.text = Vungle.isAdvertAvailable() ? "Check" : "Loading"; } }
//显示激励广告 public void ShowRewardAd(string adUnitId) { //Vungle.isAdvertAvailable(adUnitId)判断对应ID广告是否可显示。 if (Vungle.isAdvertAvailable(adUnitId)) { Vungle.playAd(adUnitId); } }
/// <summary> /// Show Vungle rewarded video /// </summary> /// <param name="CompleteMethod">callback called when user closes the rewarded video -> if true video was not skipped</param> public void ShowRewardVideo(UnityAction <bool, string> CompleteMethod) { if (IsRewardVideoAvailable()) { OnCompleteMethodWithAdvertiser = CompleteMethod; Vungle.playAd(rewardedPlacementId); } }
/// <summary> /// Show Vungle rewarded video /// </summary> /// <param name="CompleteMethod">callback called when user closes the rewarded video -> if true video was not skipped</param> public void ShowRewardVideo(UnityAction <bool> CompleteMethod) { if (IsRewardVideoAvailable()) { OnCompleteMethod = CompleteMethod; Vungle.playAd(rewardedPlacementId); } }
/// <summary> /// Check if Vungle interstitial is available /// </summary> /// <returns>true if an interstitial is available</returns> public bool IsInterstitialAvailable() { if (!initComplete) { return(false); } return(Vungle.isAdvertAvailable(interstitialPlacementID)); }
internal bool IsReady() { #if EM_VUNGLE return(Vungle.isAdvertAvailable(Id.Id)); #else return(false); #endif }
/// <summary> /// Show Vungle interstitial /// </summary> /// <param name="InterstitialClosed">callback called when user closes interstitial</param> public void ShowInterstitial(UnityAction <string> InterstitialClosed) { if (IsInterstitialAvailable()) { OnInterstitialClosedWithAdvertiser = InterstitialClosed; Vungle.playAd(interstitialPlacementID); } }
public bool Play(System.Action <AdFinishedEventArgs> adFinishedCallback) { Debug.Log("Play ad request: Vungle."); m_currentAdFinishedCallback = adFinishedCallback; Vungle.onAdFinishedEvent += Vungle_onAdFinishedEvent; Vungle.playAdWithOptions(new System.Collections.Generic.Dictionary <string, object>()); return(true); }
public override void ShowReward() { base.ShowReward(); #if UNITY_IPHONE Vungle.playAd(AdsMaster.config.VungleIOSDefaultPlacementId); #else Vungle.playAd(AdsMaster.config.VungleAndroidDefaultPlacementId); #endif }
public void Load() { #if EM_VUNGLE if (Vungle.isAdvertAvailable(Id.Id)) { return; } Vungle.loadAd(Id.Id); #endif }
public void BannerLoadedShowIfRequired() { if (!isShowing) { return; } #if EM_VUNGLE Vungle.showBanner(Id.Id); #endif }
public override void init(string platformId, string unitId, AdDelegate adDelegate = null) { #if UNITY_ANDROID Vungle.init(platformId, ""); #elif UNITY_IOS Vungle.init("", platformId); #else #endif AdManager.OnEnableVungle(); }