public void ShowAd() { ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleShowResult; ShowAdPlacementContent ad = Monetization.GetPlacementContent(placementld) as ShowAdPlacementContent; ad.Show(options); }
void ShowAd() { ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleShowResult; ShowAdPlacementContent ad = Monetization.GetPlacementContent(placementId) as ShowAdPlacementContent; secLife.GetComponent <Animator>().enabled = false; ad.Show(options); }
public override void ShowAd(string placement) { ShowAdCallbacks options = new ShowAdCallbacks { finishCallback = HandleShowResult }; ShowAdPlacementContent ad = Monetization.GetPlacementContent(placement) as ShowAdPlacementContent; ad.Show(options); }
void ShowAd() { ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleShowResult; ShowAdPlacementContent ad = Monetization.GetPlacementContent(placementId) as ShowAdPlacementContent; ad.Show(options); AnalyticsEvent.AdStart(true); }
//rewardedVideo public void ShowAds() { if (Monetization.IsReady("rewardedVideo")) { Time.timeScale = 0; ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleShowResult; ShowAdPlacementContent ad = Monetization.GetPlacementContent("rewardedVideo") as ShowAdPlacementContent; ad.Show(options); } }
private void ShowAd() { // 广告回调函数 ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleResult; // 广告对象 ShowAdPlacementContent ad = Monetization.GetPlacementContent(placementId) as ShowAdPlacementContent; ad.Show(options); }
// 광고를 실행하는 함수 public void ShowAd() { ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleShowResult; ShowAdPlacementContent ad = Monetization.GetPlacementContent(placementld) as ShowAdPlacementContent; // placementId 는 광고에 대한 설정이 담겨있다. 스킵을 허용하는지 안하는지 ad.Show(options); }
public void ShowMoreBallsReviveAd() { ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleMoreBalls; ShowAdPlacementContent ad = Monetization.GetPlacementContent(moreBallsAd) as ShowAdPlacementContent; ad.Show(options); AnalyticsController.Instance.LogIncentivizedAdWatchedEvent("More Balls AD"); }
public void GoMenu() { GetComponent <AudioSource>().Play(); if (Monetization.IsReady("video")) { ShowAdCallbacks options = new ShowAdCallbacks(); //options.finishCallback = HandleShowResult; ShowAdPlacementContent ad = Monetization.GetPlacementContent("video") as ShowAdPlacementContent; ad.Show(options); } SceneManager.LoadScene("Scenes/SampleScene"); }
IEnumerator ShowVideoForModel() { while (!Monetization.IsReady(StaticPrefabs.placementRewardVidioID)) { //yield return new WaitForSeconds(0.5f); yield return(null); } ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleModelShowResult; ShowAdPlacementContent ad = Monetization.GetPlacementContent(StaticPrefabs.placementRewardVidioID) as ShowAdPlacementContent; ad.Show(options); }
//private void Update() { // if (Application.internetReachability == NetworkReachability.NotReachable) { // hasInternetAccess = false; // } else { // hasInternetAccess = true; // } //} public void ShowMoreHCReviveAd() { ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleMoreHCGiveNastya; ShowAdPlacementContent ad = Monetization.GetPlacementContent(moreHCAd) as ShowAdPlacementContent; ad.Show(options); PlayerController.player.MoreHCReviveCount++; ((Revive)Revive.Instance).UpdateButtsButtonState(); AnalyticsController.Instance.LogIncentivizedAdWatchedEvent("More HC AD"); }
public void ResetGame() { GetComponent <AudioSource>().Play(); if (Monetization.IsReady("video")) { ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleShowResult; ShowAdPlacementContent ad = Monetization.GetPlacementContent("video") as ShowAdPlacementContent; ad.Show(options); } else { ResetScene(); } }
private void InitUnityAds() { if (!Monetization.isSupported) { return; } #if UNITY_IOS _gameId = appleAppStoreGameId; #elif UNITY_ANDROID _gameId = googlePlayStoreGameId; #endif Monetization.Initialize(_gameId, testMode); _showAdCallbacks = new ShowAdCallbacks { startCallback = AdStart, finishCallback = AdFinished }; }
public void ShowPromo() { if (Monetization.IsReady(placementName) == false) { Debug.Log("Placement Not Ready: " + placementName); return; } //Get Content for a placement PlacementContent placementContent = Monetization.GetPlacementContent(placementName); if (placementContent == null) { Debug.LogError("Placement Content Empty for Placement ID: " + placementContent.placementId); return; } //Convert to ShowAdPlacementContent to show the ad //This works for most ad types (Video, Playable, Display, Promo, AR, etc.) //IAP Promo requires that the Purcahsing Adapter is set, otherwise placement will never be Ready ShowAdPlacementContent showAd = (ShowAdPlacementContent)placementContent; if (showAd == null) { Debug.LogError("Show Ad Placement Content Empty for Placement ID: " + showAd.placementId); return; } Debug.Log("Showing Promo - Placement: " + showAd.placementId); //We can check if this is a rewarded placement from the placement content if (showAd.rewarded == true) { ShowAdCallbacks callbacks = new ShowAdCallbacks { finishCallback = HandleReward }; Debug.Log("Showing Rewarded Ad - Placement: " + placementContent.placementId); showAd.Show(callbacks); } else { Debug.Log("Showing Non-rewarded Ad - Placement: " + placementContent.placementId); showAd.Show(); } }
public void ShowAd() { if (DisplayAd) { ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleShowResult; ShowAdPlacementContent ad = Monetization.GetPlacementContent(placementId) as ShowAdPlacementContent; ad.Show(options); } else { if (applyReward != null) { applyReward(false); } } }
public void Show(Action <UM_RewardedAdsResult> callabck) { #if SA_UNITY_ADS_INSTALLED m_showCallback = callabck; ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = FinishCallback; ShowAdPlacementContent ad = Monetization.GetPlacementContent(m_advertisementId) as ShowAdPlacementContent; if (ad != null) { ad.Show(options); } else { m_showCallback.Invoke(UM_RewardedAdsResult.Failed); m_showCallback = null; } #endif }
public void ShowBoxAd() { DateTime dt = PlayerController.player == null || PlayerController.player.adBoxOpenedDate == null || PlayerController.player.adBoxOpenedDate == "" ? DateTime.MinValue : DateTime.Parse(PlayerController.player.adBoxOpenedDate); if (DateTime.Now.Date == dt.Date) { // if Player came logged in after box was supposed to be claiemd // Not exceding limit if (PlayerController.player.adBoxOpenedCount < AdBoxOpenLimit && AdsLoaded) { ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleOpenAdBoxNastya; ShowAdPlacementContent ad = Monetization.GetPlacementContent(boxAd) as ShowAdPlacementContent; ad.Show(options); PlayerController.player.adBoxOpenedCount++; PlayerController.player.adBoxOpenedDate = DateTime.Now.Date.ToString("yyyy-MM-dd"); AnalyticsController.Instance.LogIncentivizedAdWatchedEvent("Box AD"); } else { UIController.Instance.SetEnabledAdBox(false); } } else { PlayerController.player.adBoxOpenedDate = DateTime.Now.Date.ToString("yyyy-MM-dd"); ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleOpenAdBoxNastya; ShowAdPlacementContent ad = Monetization.GetPlacementContent(boxAd) as ShowAdPlacementContent; ad.Show(options); PlayerController.player.adBoxOpenedCount = 1; AnalyticsController.Instance.LogIncentivizedAdWatchedEvent("Box AD"); } // set the dat of ad shown // Add counter to ad shown }
public IEnumerator WaitAndDisplayRewardedAd() { yield return(new WaitUntil(() => Monetization.IsReady(reward_video_ad))); ShowAdPlacementContent adContent = Monetization.GetPlacementContent(reward_video_ad) as ShowAdPlacementContent; adContent.gamerSid = "[CALL BACK SERVER ID HURR]"; ShowAdCallbacks callBackOptions = new ShowAdCallbacks(); callBackOptions.finishCallback += RewardCallback; if (adContent != null) { adContent.Show(callBackOptions); } else { Debug.LogWarning("Placement Content Returned a Null"); } }
IEnumerator ShowWhenReady(string placementId, ShowAdFinishCallback cb) { while (!Monetization.IsReady(placementId)) { yield return(new WaitForSeconds(0.25f)); } ShowAdCallbacks options = new ShowAdCallbacks(); if (cb != null) { options.finishCallback = cb; } ShowAdPlacementContent ad = Monetization.GetPlacementContent(placementId) as ShowAdPlacementContent; if (ad != null) { ad.Show(options); } }
public static void watchSkipLevelRewardVideo() { try { Analytics.CustomEvent(" WatchSkipLevelReward ", new Dictionary<string, object> { { "WatchSkipLevelReward" + Global.currentLevel, Global.currentLevel } }); Global.noOfTries = 0; Global.isSkipActive = false; if (rewardLoaded) { rewardBasedVideo.Show(); hideSkipRewardBtn = false; continueReward = false; GameManager.gameState = GameState.Rewared_Video_Started; } else if (Monetization.IsReady(rewarded_Video)) { hideSkipRewardBtn = false; continueReward = false; ShowAdPlacementContent showAdPlacementContent = null; showAdPlacementContent = (Monetization.GetPlacementContent(rewarded_Video) as ShowAdPlacementContent); if (showAdPlacementContent != null) { ShowAdCallbacks value = default(ShowAdCallbacks); value.finishCallback = HandleShowRewardedVideoResult; showAdPlacementContent.Show(value); } } } catch (Exception) { } }
/** * Monetizationクラスを使って初期化する */ private void InitUnityAds() { // 動画広告をサポートしていないプラットフォームだったらreturn if (Monetization.isSupported == false) { return; } // すでに初期化していたらreturn if (Monetization.isInitialized) { return; } #if UNITY_ANDROID _gameId = googlePlayGameId; #elif UNITY_IOS _gameId = appStoreGameId; #endif // 初期化 Monetization.Initialize(_gameId, testMode); // 広告視聴のコールバックを設定 _callbacks = new ShowAdCallbacks() { startCallback = OnAdStart, finishCallback = OnAdFinished // startCallback = () => { }, // finishCallback = result => { } }; // PlacementContent状態変化時のイベントハンドラを追加 Monetization.onPlacementContentReady += OnPlacementContentReady; Monetization.onPlacementContentStateChange += OnPlacementContentStateChange; }
public void ShowInterstitialVideo(ShowAdCallbacks showAdCallbacks) { // インタースティシャル広告再生 unityAdsInterstitial.ShowAds(showAdCallbacks); }
public void ShowVideoRewardSkin(ShowAdCallbacks showAdCallbacks) { // 動画リワードの再生 unityAdsVideoRewardSkin.ShowAd(showAdCallbacks); Debug.Log("skin"); }
public static void ShowRewardBasedVideo(RewardedVideoType rewardedVideoType, RewardedVideoCallback callback) { if (!IsRewardBasedVideoLoaded(rewardedVideoType)) { callback.Invoke(false); return; } if (instance.rewardedVideoCallback != null) { instance.rewardedVideoCallback = null; } #if UNITY_EDITOR callback.Invoke(true); return; #endif instance.rewardedVideoCallback = callback; switch (rewardedVideoType) { case RewardedVideoType.RewardedVideo_ADMOB: #if MODULE_ADMOB #if UNITY_EDITOR Tween.NextFrame(delegate { callback.Invoke(true); }); #endif instance.rewardBasedVideo.Show(); #endif break; case RewardedVideoType.RewardedVideo_UNITYADS: #if MODULE_UNITYADS ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = (UnityEngine.Monetization.ShowResult result) => { if (result == UnityEngine.Monetization.ShowResult.Finished) { // Reward the player if (instance.rewardedVideoCallback != null) { RewardedVideoCallback videoCallbackTemp = instance.rewardedVideoCallback; Tween.NextFrame(delegate { videoCallbackTemp.Invoke(true); PauseManager.SetPause(false); }); instance.rewardedVideoCallback = null; } } else { if (instance.rewardedVideoCallback != null) { RewardedVideoCallback videoCallbackTemp = instance.rewardedVideoCallback; Tween.NextFrame(delegate { videoCallbackTemp.Invoke(false); PauseManager.SetPause(false); }); instance.rewardedVideoCallback = null; } } }; instance.rewardedBasedVideoUnityAds.Show(options); #endif break; } }
public void ShowVideoRewardTimer(ShowAdCallbacks showAdCallbacks) { // 動画リワードの再生 unityAdsVideoRewardTimer.ShowAd(showAdCallbacks); Debug.Log("timer"); }
public void ShowVideoRewardResult(ShowAdCallbacks showAdCallbacks) { // 動画リワードの再生 unityAdsVideoRewardResult.ShowAd(showAdCallbacks); Debug.Log("result"); }
private void Update() { if (life == 3) { lifes3.color = new Color(1f, 1f, 1f, 1); lifes2.color = new Color(1f, 1f, 1f, 1); } else if (life == 2) { lifes3.color = new Color(1f, 1f, 1f, 0); lifes2.color = new Color(1f, 1f, 1f, 1); } else if (life == 1) { lifes1.color = new Color(1f, 1f, 1f, 1f); lifes2.color = new Color(1f, 1f, 1f, 0); lifes3.color = new Color(1f, 1f, 1f, 0); } else if (life <= 0) { if (Monetization.isInitialized) { PlayerPrefs.SetInt("Die", PlayerPrefs.GetInt("Die") + 1); } if (gameObject.GetComponent <Player>().Mod == 1) { SceneManager.LoadScene("Balance"); if (time1.sec > 40) { if (Monetization.IsReady("video")) { ShowAdPlacementContent ad = Monetization.GetPlacementContent("video") as ShowAdPlacementContent; if (ad != null) { ad.Show(); } } } } if (gameObject.GetComponent <Player>().Mod == 2) { SceneManager.LoadScene("BalanceMod"); if (woodScr.BalanceValueNow > 25) { if (Monetization.IsReady("video")) { ShowAdPlacementContent ad = Monetization.GetPlacementContent("video") as ShowAdPlacementContent; if (ad != null) { ad.Show(); } } } } if (gameObject.GetComponent <Player>().Mod == 3) { SceneManager.LoadScene("GoldMod"); if (t3M.Moneytake > 45) { if (Monetization.IsReady("video")) { ShowAdPlacementContent ad = Monetization.GetPlacementContent("video") as ShowAdPlacementContent; if (ad != null) { ad.Show(); } } } } if (PlayerPrefs.GetInt("Die") >= 10) { if (Monetization.IsReady("video")) { ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleShowResult; ShowAdPlacementContent ad = Monetization.GetPlacementContent("video") as ShowAdPlacementContent; ad.Show(options); } } } }