void PlayAd(AdColony.InterstitialAd _ad)
 {
     if (_ad != null)
     {
         AdColony.Ads.ShowAd(_ad);
     }
 }
Example #2
0
 public bool IsReady()
 {
     if (this._ad == null || this._ad.Expired)
     {
         this._ad = null;
         RequestRewardAds();
         return(false);
     }
     return(this._ad != null);
 }
 /// <summary>
 ///  Request ads if previous request failed
 /// </summary>
 /// <param name="ad">Failed ad</param>
 void RequestAd(AdColony.InterstitialAd ad)
 {
     #if (UNITY_ANDROID || UNITY_IOS)
     if (AdsReady)
     {
         AdColony.Ads.RequestInterstitialAd(ad.ZoneId, null);
     }
     #else
     Debug.LogWarning("Ads not supported on this platform");
     #endif
 }
Example #4
0
        public bool ShowRewardVideoAd(OnFinishRewardVideo onFinish)
        {
            if (this._ad == null || this._ad.Expired)
            {
                this._ad = null;
                // 見せれるadがない場合はrequestをする
                RequestRewardAds();
                return(false);
            }
            this.onFinish = onFinish;

            AdColony.Ads.ShowAd(this._ad);
            return(true);
        }
Example #5
0
    private void intEvenetHandler()
    {
        AdColony.Ads.OnConfigurationCompleted += (List <AdColony.Zone> zone_) =>
        {
            DebugText.text = "Ads Request Has Been Complete " + zone_.ToString();
        };

        AdColony.Ads.OnRequestInterstitial += (AdColony.InterstitialAd ad_) => {
            DebugText.text = "Ads Request Has Requested Interstiler Ad " + ad_.ToString();

            Ad = ad_;
        };

        AdColony.Ads.OnRequestInterstitialFailed += () =>
        {
            DebugText.text = "Ads Request Has Failed";
            ConfigureAds();
        };

        AdColony.Ads.OnOpened += (AdColony.InterstitialAd ad_) => {
            DebugText.text = "Ad Has Been Open " + ad_.ToString();
            RequestAd();
        };

        AdColony.Ads.OnClosed += (AdColony.InterstitialAd ad_) => {
            DebugText.text = "Ad Has Been Closed " + ad_.ToString();
        };

        AdColony.Ads.OnExpiring += (AdColony.InterstitialAd ad_) => {
            DebugText.text = "Ad Is Expiring " + ad_.ToString();
        };

        AdColony.Ads.OnIAPOpportunity += (AdColony.InterstitialAd ad_, string iapProductId_, AdColony.AdsIAPEngagementType engagement_) =>
        {
            DebugText.text = "AdColony.Ads.OnIAPOpportunity called";
        };

        AdColony.Ads.OnRewardGranted += (string zoneId, bool success, string name, int amount) =>
        {
            DebugText.text = string.Format("AdColony.Ads.OnRewardGranted ", zoneId, success, name, amount);
        };

        AdColony.Ads.OnCustomMessageReceived += (string type, string message) =>
        {
            DebugText.text = string.Format("AdColony.Ads.OnCustomMessageReceived ", type, message);
        };
    }
Example #6
0
    public void PlayAd(AdColony.InterstitialAd ad = null)
    {
        if (ad != null && ad.Expired == false)
        {
            CustomGameManager manager = GameFramework.GameStructure.GameManager.Instance as CustomGameManager;
            manager.MuteSound();

            AdColony.Ads.ShowAd(ad);
        }
        else
        {
            if (this.callback != null)
            {
                this.callback(null, 0, false);
            }
        }
    }
Example #7
0
    public void RequestAd(string zoneId = null)
    {
        if (zoneId == null)
        {
            zoneId = Constants.AdColonyInterstitialZoneID;
        }

        AdColony.InterstitialAd _ad = AdForZoneId(zoneId);

        if (_ad != null && _ad.Expired == false)     // we have an active ad for this zone, do not ask for another
        {
            return;
        }

        // Request an ad.
        MyDebug.Log("Request Ad zone: " + zoneId);

        AdColony.AdOptions adOptions = new AdColony.AdOptions();
        adOptions.ShowPrePopup  = false;
        adOptions.ShowPostPopup = false;

        AdColony.Ads.RequestInterstitialAd(zoneId, adOptions);
    }
Example #8
0
 void Ads_OnExpiring(AdColony.InterstitialAd obj)
 {
     PrintDebug(string.Format("OnExpired: " + obj.ZoneId));
     this._ad = null;
     RequestRewardAds();
 }
Example #9
0
 void Ads_OnRequestInterstitial(AdColony.InterstitialAd obj)
 {
     PrintDebug(string.Format("OnRequestInterstitial: " + obj.ZoneId));
     this._ad = obj;
 }
Example #10
0
 void Ads_OnClosed(AdColony.InterstitialAd obj)
 {
     PrintDebug(string.Format("OnClosed: " + obj.ZoneId));
 }
 public void CancelAd(InterstitialAd ad)
 {
     _pluginWrapper.CallStatic("cancelAd", ad.Id);
 }
    void Start()
    {
        GameObject configureObj = GameObject.FindGameObjectWithTag(Constants.AsteroidConfigureTag);

        asteroidConfigure = configureObj.GetComponent <Asteroid>();

        GameObject requestObj = GameObject.FindGameObjectWithTag(Constants.AsteroidRequestTag);

        asteroidRequest = requestObj.GetComponent <Asteroid>();

        GameObject playObj = GameObject.FindGameObjectWithTag(Constants.AsteroidPlayTag);

        asteroidPlay = playObj.GetComponent <Asteroid>();

        GameObject adViewRequstObj = GameObject.FindGameObjectWithTag(Constants.AsteroidAdViewRequest);

        asteroidAdViewRequest = adViewRequstObj.GetComponent <Asteroid>();
        GameObject adViewDestroyObj = GameObject.FindGameObjectWithTag(Constants.AsteroidAdViewDestroy);

        asteroidAdViewDestroy = adViewDestroyObj.GetComponent <Asteroid>();

        // Only configure asteroid is available at start.
        asteroidConfigure.Show();
        asteroidRequest.Hide();
        asteroidPlay.Hide();
        asteroidAdViewRequest.Hide();
        asteroidAdViewDestroy.Hide();

        // ----- AdColony Ads -----

        AdColony.Ads.OnConfigurationCompleted += (List <AdColony.Zone> zones_) =>
        {
            Debug.Log("AdColony.Ads.OnConfigurationCompleted called");

            if (zones_ == null || zones_.Count <= 0)
            {
                // Show the configure asteroid again.
                asteroidConfigure.Show();
            }
            else
            {
                // Successfully configured... show the request ad asteroid.
                asteroidRequest.Show();
                asteroidAdViewRequest.Show();
            }
        };

        AdColony.Ads.OnRequestInterstitial += (AdColony.InterstitialAd ad_) =>
        {
            Debug.Log("AdColony.Ads.OnRequestInterstitial called");
            Ad = ad_;

            // Successfully requested ad... show the play ad asteroid.
            asteroidPlay.Show();
        };

        AdColony.Ads.OnRequestInterstitialFailedWithZone += (string zoneId) =>
        {
            Debug.Log("AdColony.Ads.OnRequestInterstitialFailedWithZone called, zone: " + zoneId);

            // Request Ad failed... show the request ad asteroid.
            asteroidRequest.Show();
        };

        AdColony.Ads.OnOpened += (AdColony.InterstitialAd ad_) =>
        {
            Debug.Log("AdColony.Ads.OnOpened called");

            // Ad started playing... show the request ad asteroid for the next ad.
            asteroidRequest.Show();
        };

        AdColony.Ads.OnClosed += (AdColony.InterstitialAd ad_) =>
        {
            Debug.Log("AdColony.Ads.OnClosed called, expired: " + ad_.Expired);
            ad_.DestroyAd();
        };

        AdColony.Ads.OnExpiring += (AdColony.InterstitialAd ad_) =>
        {
            Debug.Log("AdColony.Ads.OnExpiring called");
            Ad = null;

            // Current ad expired... show the request ad asteroid.
            asteroidRequest.Show();
            asteroidPlay.Hide();
        };

        AdColony.Ads.OnIAPOpportunity += (AdColony.InterstitialAd ad_, string iapProductId_, AdColony.AdsIAPEngagementType engagement_) =>
        {
            Debug.Log("AdColony.Ads.OnIAPOpportunity called");
        };

        AdColony.Ads.OnRewardGranted += (string zoneId, bool success, string name, int amount) =>
        {
            Debug.Log(string.Format("AdColony.Ads.OnRewardGranted called\n\tzoneId: {0}\n\tsuccess: {1}\n\tname: {2}\n\tamount: {3}", zoneId, success, name, amount));
        };

        AdColony.Ads.OnCustomMessageReceived += (string type, string message) =>
        {
            Debug.Log(string.Format("AdColony.Ads.OnCustomMessageReceived called\n\ttype: {0}\n\tmessage: {1}", type, message));
        };

        //Banner events.
        AdColony.Ads.OnAdViewOpened += (AdColony.AdColonyAdView ad_) =>
        {
            Debug.Log("AdColony.SampleApps.OnAdViewOpened called");
        };
        AdColony.Ads.OnAdViewLoaded += (AdColony.AdColonyAdView ad_) =>
        {
            Debug.Log("AdColony.SampleApps.OnAdViewLoaded called");
            asteroidAdViewDestroy.Show();
            arrayList.Add(ad_);
            adView = ad_;

            // Show or hide the ad view(this is optional; the banner is shown by default)

            /* Setting 2 timers of 5 and 10 seconds, after 5 sec calling
             * the ad view's hide method that is defined below and after 10 sec calling the ad view's show method that is defined below.*/
            Invoke("HideAdView", 5.0f);
            Invoke("ShowAdView", 10.0f);
        };

        AdColony.Ads.OnAdViewFailedToLoad += (AdColony.AdColonyAdView ad_) =>
        {
            Debug.Log("AdColony.SampleApps.OnAdViewFailedToLoad called with Zone id:" + ad_.ZoneId + " " + ad_.adPosition);
            asteroidAdViewRequest.Show();
        };
        AdColony.Ads.OnAdViewClosed += (AdColony.AdColonyAdView ad_) =>
        {
            Debug.Log("AdColony.SampleApps.OnAdViewClosed called");
        };
        AdColony.Ads.OnAdViewClicked += (AdColony.AdColonyAdView ad_) =>
        {
            Debug.Log("AdColony.SampleApps.OnAdViewClicked called");
        };
        AdColony.Ads.OnAdViewLeftApplication += (AdColony.AdColonyAdView ad_) =>
        {
            Debug.Log("AdColony.SampleApps.OnAdViewLeftApplication called");
        };
    }
Example #13
0
 public void CancelAd(InterstitialAd ad)
 {
     _AdcCancelInterstitialAd(ad.Id);
 }
Example #14
0
 public void ShowAd(InterstitialAd ad)
 {
     _AdcShowInterstitialAd(ad.Id);
 }
Example #15
0
    private void intEvenetHandler()
    {
        AdColony.Ads.OnConfigurationCompleted += (List <AdColony.Zone> zone_) =>
        {
            DebugText.text = "Ads Request Has Been Complete " + zone_.ToString();
        };

        AdColony.Ads.OnRequestInterstitial += (AdColony.InterstitialAd ad_) => {
            DebugText.text = "Ads Request Has Requested Interstiler Ad " + ad_.ToString();

            Ad = ad_;
            Disable.SetActive(false);
            AdcolonyBtn.GetComponent <Button>().enabled = true;
        };

        AdColony.Ads.OnRequestInterstitialFailed += () =>
        {
            DebugText.text = "Ads Request Has Failed";
            AdcolonyBtn.GetComponent <Button>().enabled = false;
            Disable.SetActive(true);
        };

        AdColony.Ads.OnOpened += (AdColony.InterstitialAd ad_) => {
            DebugText.text = "Ad Has Been Open " + ad_.ToString();
            CompleteAd     = false;
        };

        AdColony.Ads.OnClosed += (AdColony.InterstitialAd ad_) => {
            // DebugText.text = "Ad Has Been Closed " + ad_.ToString();
        };

        AdColony.Ads.OnExpiring += (AdColony.InterstitialAd ad_) => {
            DebugText.text = "Ad Is Expiring " + ad_.ToString();
            AdcolonyBtn.GetComponent <Button>().enabled = false;
            Disable.SetActive(true);
        };

        AdColony.Ads.OnIAPOpportunity += (AdColony.InterstitialAd ad_, string iapProductId_, AdColony.AdsIAPEngagementType engagement_) =>
        {
            DebugText.text = "AdColony.Ads.OnIAPOpportunity called";
        };

        AdColony.Ads.OnRewardGranted += (string zoneId, bool success, string name, int amount) =>
        {
            DebugText.text = string.Format("AdColony.Ads.OnRewardGranted ", zoneId, success, name, amount);

            if (CompleteAd == false)
            {
                CompleteAd = true;
                int newcredits = 0;
                int.TryParse(DataManager.Instance.GetUserCredits(), out newcredits);
                int pushcredits = newcredits + 100;
                DataManager.Instance.SetUserCredits(pushcredits.ToString());

                ServerStatusManager.Instance.SendNewDataType(Construct.ONADS);
            }
        };

        AdColony.Ads.OnCustomMessageReceived += (string type, string message) =>
        {
            DebugText.text = string.Format("AdColony.Ads.OnCustomMessageReceived ", type, message);
        };
    }
    void Start()
    {
        GameObject configureObj = GameObject.FindGameObjectWithTag(Constants.AsteroidConfigureTag);

        asteroidConfigure = configureObj.GetComponent <Asteroid>();

        GameObject requestObj = GameObject.FindGameObjectWithTag(Constants.AsteroidRequestTag);

        asteroidRequest = requestObj.GetComponent <Asteroid>();

        GameObject playObj = GameObject.FindGameObjectWithTag(Constants.AsteroidPlayTag);

        asteroidPlay = playObj.GetComponent <Asteroid>();

        // Only configure asteroid is available at start.
        asteroidConfigure.Show();
        asteroidRequest.Hide();
        asteroidPlay.Hide();

        // ----- AdColony Ads -----

        AdColony.Ads.OnConfigurationCompleted += (List <AdColony.Zone> zones_) => {
            Debug.Log("AdColony.Ads.OnConfigurationCompleted called");

            if (zones_ == null || zones_.Count <= 0)
            {
                // Show the configure asteroid again.
                asteroidConfigure.Show();
            }
            else
            {
                // Successfully configured... show the request ad asteroid.
                asteroidRequest.Show();
            }
        };

        AdColony.Ads.OnRequestInterstitial += (AdColony.InterstitialAd ad_) => {
            Debug.Log("AdColony.Ads.OnRequestInterstitial called");
            Ad = ad_;

            // Successfully requested ad... show the play ad asteroid.
            asteroidPlay.Show();
        };

        AdColony.Ads.OnRequestInterstitialFailedWithZone += (string zoneId) => {
            Debug.Log("AdColony.Ads.OnRequestInterstitialFailedWithZone called, zone: " + zoneId);

            // Request Ad failed... show the request ad asteroid.
            asteroidRequest.Show();
        };

        AdColony.Ads.OnOpened += (AdColony.InterstitialAd ad_) => {
            Debug.Log("AdColony.Ads.OnOpened called");

            // Ad started playing... show the request ad asteroid for the next ad.
            asteroidRequest.Show();
        };

        AdColony.Ads.OnClosed += (AdColony.InterstitialAd ad_) => {
            Debug.Log("AdColony.Ads.OnClosed called, expired: " + ad_.Expired);
        };

        AdColony.Ads.OnExpiring += (AdColony.InterstitialAd ad_) => {
            Debug.Log("AdColony.Ads.OnExpiring called");
            Ad = null;

            // Current ad expired... show the request ad asteroid.
            asteroidRequest.Show();
            asteroidPlay.Hide();
        };

        AdColony.Ads.OnIAPOpportunity += (AdColony.InterstitialAd ad_, string iapProductId_, AdColony.AdsIAPEngagementType engagement_) => {
            Debug.Log("AdColony.Ads.OnIAPOpportunity called");
        };

        AdColony.Ads.OnRewardGranted += (string zoneId, bool success, string name, int amount) => {
            Debug.Log(string.Format("AdColony.Ads.OnRewardGranted called\n\tzoneId: {0}\n\tsuccess: {1}\n\tname: {2}\n\tamount: {3}", zoneId, success, name, amount));
        };

        AdColony.Ads.OnCustomMessageReceived += (string type, string message) => {
            Debug.Log(string.Format("AdColony.Ads.OnCustomMessageReceived called\n\ttype: {0}\n\tmessage: {1}", type, message));
        };
    }
 public void ShowAd(InterstitialAd ad)
 {
     _pluginWrapper.CallStatic("showAd", ad.Id);
 }