Exemple #1
0
    private void Update()
    {
        if (videoAvailable && videoAllow)
        {
            videoAvailable = false;
            videoAllow     = false;

            TapsellShowOptions options = new TapsellShowOptions();
            options.backDisabled  = false;
            options.immersiveMode = false;
            options.rotationMode  = TapsellShowOptions.ROTATION_LOCKED_LANDSCAPE;
            options.showDialog    = true;
            Tapsell.showAd(Videoad, options);
            StartCoroutine(ReqAgain(videoZoneId));
        }
        else if (bannerAvailable && bannerAllow)
        {
            bannerAvailable = false;
            bannerAllow     = false;
            TapsellShowOptions options = new TapsellShowOptions();
            options.backDisabled  = false;
            options.immersiveMode = false;
            options.rotationMode  = TapsellShowOptions.ROTATION_LOCKED_LANDSCAPE;
            options.showDialog    = true;
            Tapsell.showAd(Bannerad, options);
            StartCoroutine(ReqAgain(bannerZoneId));
        }
    }
Exemple #2
0
        public ErrorPromise <ShowVideoFailed> ShowVideo(string zone, bool skipable)
        {
            Initialize();
            ErrorDeferred <ShowVideoFailed> deferred = new ErrorDeferred <ShowVideoFailed>();

            if (_deferred != null)
            {
                deferred.Reject(ShowVideoFailed.AlreadyShowingVideo);
                return(deferred.Promise());
            }
            _deferred   = deferred;
            _isSkipable = skipable;
            Tapsell.requestAd(zone, false,
                              result =>
            {
                Debug.Log("On ad exists");
                // onAdAvailable
                TapsellShowOptions showOptions = new TapsellShowOptions();
                showOptions.backDisabled       = false;
                showOptions.immersiveMode      = false;
                showOptions.rotationMode       = TapsellShowOptions.ROTATION_UNLOCKED;
                showOptions.showDialog         = true;
                Tapsell.showAd(result.adId, showOptions);
            },

                              zoneId =>
            {
                Debug.Log("On no ad available");
                // onNoAdAvailable
                FailedDefered(ShowVideoFailed.NoVideoAvilable);
            },

                              error =>
            {
                Debug.Log("On Error");
                // onError
                FailedDefered(ShowVideoFailed.ProviderError);
            },

                              zoneId =>
            {
                Debug.Log("On no network");
                // onNoNetwork
                FailedDefered(ShowVideoFailed.ProviderError);
            },

                              result =>
            {
                Debug.Log("On Expire");
                // onExpiring
                FailedDefered(ShowVideoFailed.ProviderError);
                // this ad is expired, you must download a new ad for this zone
            });
            return(deferred.Promise());
        }
Exemple #3
0
    public void ShowAdVideo()
    {
        TapsellShowOptions showOptions = new TapsellShowOptions();

        showOptions.backDisabled  = true;
        showOptions.immersiveMode = false;
        showOptions.rotationMode  = TapsellShowOptions.ROTATION_UNLOCKED;
        showOptions.showDialog    = true;

        Tapsell.showAd(_ad, showOptions);
    }
Exemple #4
0
    public void ShowInterstitial()
    {
        RequestInterstitial();
        available = false;
        TapsellShowOptions options = new TapsellShowOptions();

        options.backDisabled  = false;
        options.immersiveMode = false;
        options.rotationMode  = TapsellShowOptions.ROTATION_LOCKED_LANDSCAPE;
        options.showDialog    = true;
        Tapsell.showAd(ad, options);
    }
 void Update()
 {
     if (available)
     {
         available = false;
         TapsellShowOptions options = new TapsellShowOptions();
         options.backDisabled  = false;
         options.immersiveMode = false;
         options.rotationMode  = TapsellShowOptions.ROTATION_LOCKED_LANDSCAPE;
         options.showDialog    = true;
         Tapsell.showAd(ad, options);
     }
 }
Exemple #6
0
    public void ShowRewardedVideo()
    {
        RequestRewardedVideo();
        Debug.Log("ShowRewardedVideo");
        available = false;
        TapsellShowOptions options = new TapsellShowOptions();

        options.backDisabled  = false;
        options.immersiveMode = false;
        options.rotationMode  = TapsellShowOptions.ROTATION_LOCKED_LANDSCAPE;
        options.showDialog    = true;
        Tapsell.showAd(ad, options);
    }
Exemple #7
0
 private void Update()
 {
     if (available && isShow)
     {
         available = false;
         TapsellShowOptions options = new TapsellShowOptions();
         options.backDisabled  = false;
         options.immersiveMode = false;
         options.rotationMode  = TapsellShowOptions.ROTATION_LOCKED_PORTRAIT;
         options.showDialog    = true;
         Tapsell.showAd(ad, options);
         isShow = false;
         allow  = false;
     }
 }
Exemple #8
0
 public void ShowAd()
 {
     if (adID != null)
     {
         TapsellShowOptions options = new TapsellShowOptions();
         options.backDisabled  = this.EnableBack;
         options.immersiveMode = this.ImmersiveMode;
         options.showDialog    = true;
         options.rotationMode  = TapsellShowOptions.ROTATION_UNLOCKED;
         Tapsell.ShowAd(adID, options);
     }
     else
     {
         RequestAd();
     }
 }
Exemple #9
0
    public void SHowAd()
    {
        Time.timeScale = 0;
        TapsellShowOptions showOptions = new TapsellShowOptions();

        showOptions.backDisabled  = true;
        showOptions.immersiveMode = false;
        showOptions.rotationMode  = TapsellShowOptions.ROTATION_LOCKED_LANDSCAPE;
        showOptions.showDialog    = true;
        if (GamePlayManager.Instance)
        {
            GameManager.Instance.seeAd = true;
        }
        Tapsell.setRewardListener((TapsellAdFinishedResult result) =>
        {
            switch (kind)
            {
            case rewardKind.gem:
                GameManager.Instance.ChangeGem(amount);
                break;

            case rewardKind.coin:
                script.calmThree();
                break;

            case rewardKind.restart:
                FinishCounter.Instance.ReStartGame();
                break;

            case rewardKind.spinWheel:
                spin.startSpin();
                break;
            }
            Time.timeScale = 1;
            MissionController.Instance.AddToMission(Alpha.MissionSystem.Mission.Type.WatchVideo, 1);
            if (MainMenuManger.instance)
            {
                MainMenuManger.instance.loadMissions();
            }
            HaveAd = false;
            findAd();
        }
                                  );
        Tapsell.showAd(AdID, showOptions);
    }
Exemple #10
0
 /// <summary>
 /// Shows your Requested Ad.
 /// </summary>
 public void ShowAd()
 {
     if (Achieve == AchievementMode.ResumeGame)
     {
         loading.SetTrigger("Load");
     }
     if (adID != null)
     {
         TapsellShowOptions options = new TapsellShowOptions();
         options.backDisabled  = this.EnableBack;
         options.immersiveMode = this.ImmersiveMode;
         options.showDialog    = true;
         options.rotationMode  = TapsellShowOptions.ROTATION_UNLOCKED;
         Tapsell.ShowAd(adID, options);
     }
     else
     {
         RequestAd();
     }
 }
Exemple #11
0
    // ******************

    void Start()
    {
        #region _showOptions

        _showOptions = new TapsellShowOptions();
        _showOptions.backDisabled  = false;
        _showOptions.immersiveMode = false;
        _showOptions.rotationMode  = TapsellShowOptions.ROTATION_UNLOCKED;
        _showOptions.showDialog    = true;

        #endregion

        Tapsell.setRewardListener((TapsellAdFinishedResult result) =>
        {
            _endShow      = true;
            _completWatch = result.completed;
            RequestAd();
        }
                                  );

        RequestAd();
    }
Exemple #12
0
    public void ShowTapsellVideoAd(string zoneID)
    {
        Tapsell.requestAd(zoneID, false,
                          (TapsellAd result) => //onAdAvailable
        {
            Debug.Log("Action: onAdAvailable");
            TapsellAd ad = result;     // store this to show the ad later

            TapsellShowOptions showOptions = new TapsellShowOptions();
            showOptions.backDisabled       = false;
            showOptions.immersiveMode      = false;
            showOptions.rotationMode       = TapsellShowOptions.ROTATION_UNLOCKED;
            showOptions.showDialog         = true;
            Tapsell.showAd(ad, showOptions);

            loadingPopup.SetActive(true);

            Tapsell.setRewardListener((TapsellAdFinishedResult rewardResult) =>
            {
                if (rewardResult.completed && rewardResult.rewarded)
                {
                    //todo: give the reward
                    inGameManager.ChangeHeartAmount(1);
                    inGameManager.ShowCurrencyPopup(1, 1);
                    loadingPopup.SetActive(false);
                }
                else
                {
                    //todo: error popup
                    inGameManager.ShowMessageBox("متاسفانه خطایی در نمایش تبلیغ پیش آمد.");
                    loadingPopup.SetActive(false);
                }
            });
        },
                          (string zoneId) => //onNoAdAvailable
        {
            Debug.Log("No Ad Available");

            //todo: error popup
            inGameManager.ShowMessageBox("متاسفانه خطایی در نمایش تبلیغ پیش آمد.");
            loadingPopup.SetActive(false);
        },
                          (TapsellError error) => //onError
        {
            Debug.Log(error.error);
            //todo: error popup
            inGameManager.ShowMessageBox("متاسفانه خطایی در نمایش تبلیغ پیش آمد.");
            loadingPopup.SetActive(false);
        },
                          (string zoneId) => //onNoNetwork
        {
            Debug.Log("No Network");
            //todo: error popup
            inGameManager.ShowMessageBox("متاسفانه خطایی در نمایش تبلیغ پیش آمد.");
            loadingPopup.SetActive(false);
        },
                          (TapsellAd result) => //onExpiring
        {
            Debug.Log("Expiring");
            // this ad is expired, you must download a new ad for this zone
            inGameManager.ShowMessageBox("متاسفانه خطایی در نمایش تبلیغ پیش آمد.");
            loadingPopup.SetActive(false);
        });
    }
    void OnGUI()
    {
        if (Test.available)
        {
            if (GUI.Button(new Rect(250, 50, 200, 100), "Show Ad"))
            {
                Test.available = false;
                TapsellShowOptions options = new TapsellShowOptions();
                options.backDisabled  = false;
                options.immersiveMode = false;
                options.rotationMode  = TapsellShowOptions.ROTATION_LOCKED_LANDSCAPE;
                options.showDialog    = true;
                Tapsell.showAd(ad, options);
            }
        }
        if (GUI.Button(new Rect(50, 50, 200, 100), "Request Video Ad"))
        {
            requestAd("5873510bbc5c28f9d90ce98d", false);
        }

        if (GUI.Button(new Rect(50, 250, 200, 100), "Request Interstitial Ad"))
        {
            requestAd("598eadad468465085986d07e", false);
        }

        if (GUI.Button(new Rect(50, 350, 200, 100), "Toggle Banner Visibility"))
        {
            if (bannerIsHidden)
            {
                Tapsell.showBannerAd(bannerZoneId);
            }
            else
            {
                Tapsell.hideBannerAd(bannerZoneId);
            }
            bannerIsHidden = !bannerIsHidden;
        }


                #if UNITY_ANDROID && !UNITY_EDITOR
        if (Test.nativeAd == null)
        {
            if (GUI.Button(new Rect(50, 150, 200, 100), "Request Banner Ad"))
            {
                requestNativeBannerAd("59b6903e468465281bde0d25");
            }
        }
        if (Test.nativeAd != null)
        {
            GUIStyle titleStyle = new GUIStyle();
            titleStyle.alignment = TextAnchor.UpperRight;
            GUI.Label(new Rect(50, 250, 450, 30), ArabicFixer.Fix(Test.nativeAd.getTitle(), true), titleStyle);

            GUIStyle descriptionStyle = new GUIStyle();
            descriptionStyle.richText  = true;
            descriptionStyle.alignment = TextAnchor.MiddleRight;
            GUI.Label(new Rect(50, 280, 450, 20), ArabicFixer.Fix(Test.nativeAd.getDescription(), true), descriptionStyle);
            GUI.DrawTexture(new Rect(500, 250, 50, 50), Test.nativeAd.getIcon());
            Rect callToActionRect;
            if (Test.nativeAd.getLandscapeBannerImage() != null)
            {
                GUI.DrawTexture(new Rect(50, 300, 500, 280), Test.nativeAd.getLandscapeBannerImage());
                callToActionRect = new Rect(50, 580, 500, 50);
            }
            else if (Test.nativeAd.getPortraitBannerImage() != null)
            {
                GUI.DrawTexture(new Rect(50, 300, 500, 280), Test.nativeAd.getPortraitBannerImage());
                callToActionRect = new Rect(50, 580, 500, 50);
            }
            else
            {
                callToActionRect = new Rect(50, 300, 500, 50);
            }
            Test.nativeAd.onShown();
            if (GUI.Button(callToActionRect, ArabicFixer.Fix(Test.nativeAd.getCallToAction(), true)))
            {
                Test.nativeAd.onClicked();
            }
        }
                #endif
    }
Exemple #14
0
    public void ShowAd()
    {
        requestAd("5a1699df45227100012953cb", true);

        if (TapsellTestV3.available)
        {
            //if(GUI.Button(new Rect(250, 50, 200, 100), "Show Ad")){
            //}

            TapsellTestV3.available = false;
            TapsellShowOptions options = new TapsellShowOptions();
            options.backDisabled  = true;
            options.immersiveMode = false;
            options.rotationMode  = TapsellShowOptions.ROTATION_LOCKED_PORTRAIT;
            options.showDialog    = true;
            Tapsell.showAd(ad, options);
        }

        //if(GUI.Button(new Rect(50, 50, 200, 100), "Request Video Ad")){
        //}



                #if UNITY_ANDROID && !UNITY_EDITOR
        if (TapsellTestV3.nativeAd == null)
        {
            if (GUI.Button(new Rect(50, 150, 200, 100), "Request Banner Ad"))
            {
                requestNativeBannerAd("59b6903e468465281bde0d25");
            }
        }
        if (TapsellTestV3.nativeAd != null)
        {
            GUIStyle titleStyle = new GUIStyle();
            titleStyle.alignment = TextAnchor.UpperRight;
            GUI.Label(new Rect(50, 250, 450, 30), ArabicFixer.Fix(TapsellTestV3.nativeAd.getTitle(), true), titleStyle);

            GUIStyle descriptionStyle = new GUIStyle();
            descriptionStyle.richText  = true;
            descriptionStyle.alignment = TextAnchor.MiddleRight;
            GUI.Label(new Rect(50, 280, 450, 20), ArabicFixer.Fix(TapsellTestV3.nativeAd.getDescription(), true), descriptionStyle);
            GUI.DrawTexture(new Rect(500, 250, 50, 50), TapsellTestV3.nativeAd.getIcon());
            Rect callToActionRect;
            if (TapsellTestV3.nativeAd.getLandscapeBannerImage() != null)
            {
                GUI.DrawTexture(new Rect(50, 300, 500, 280), TapsellTestV3.nativeAd.getLandscapeBannerImage());
                callToActionRect = new Rect(50, 580, 500, 50);
            }
            else if (TapsellTestV3.nativeAd.getPortraitBannerImage() != null)
            {
                GUI.DrawTexture(new Rect(50, 300, 500, 280), TapsellTestV3.nativeAd.getPortraitBannerImage());
                callToActionRect = new Rect(50, 580, 500, 50);
            }
            else
            {
                callToActionRect = new Rect(50, 300, 500, 50);
            }
            TapsellTestV3.nativeAd.onShown();
            if (GUI.Button(callToActionRect, ArabicFixer.Fix(TapsellTestV3.nativeAd.getCallToAction(), true)))
            {
                TapsellTestV3.nativeAd.onClicked();
            }
        }
                #endif
    }