コード例 #1
0
 // Token: 0x060000F2 RID: 242 RVA: 0x00005EBB File Offset: 0x000042BB
 public static Chartboost CreateWithAppId(string appId, string appSignature)
 {
     CBSettings.setAppId(appId, appSignature);
     return(Chartboost.Create());
 }
コード例 #2
0
        public void SetupDelegatesForRewardVideo()
        {
            //CALLBACK 1.

            //If chart boost is initialized successfully then we will start a call for Caching else we will request for initialization.
            Chartboost.didInitialize += b =>
            {
                //If chart boost is initialized .
                if (b)
                {
                    //If autocache is deactivated .
                    //We have to handle the cache functionality .
                    if (!AutoCache)
                    {
                        //Start  for Caching .
                        Chartboost.cacheRewardedVideo(CBLocation.Default);
                    }
                }
                else
                {
                    //create the chart boost .
                    Chartboost.Create();
                    //print charboost is initiated.
                    Print("Creating chart boost");

                    /*
                     *      // Sample to create Chartboost gameobject from code overriding editor AppId and AppSignature
                     *      // Remove the Chartboost gameobject from the sample first
                     #if UNITY_IPHONE
                     *      Chartboost.CreateWithAppId("4f21c409cd1cb2fb7000001b", "92e2de2fd7070327bdeb54c15a5295309c6fcd2d");
                     #elif UNITY_ANDROID
                     *      Chartboost.CreateWithAppId("4f7b433509b6025804000002", "dd2d41b69ac01b80f443f5b6cf06096d457f82bd");
                     #endif
                     */
                }
            };
            //CALL bACK 2

            Chartboost.didFailToLoadRewardedVideo += (CBLocation location, CBImpressionError error) =>
            {
                Print("Failed to load the reward video");
                Print("Location", location);
                Print("Error" + error);
                //if the error is internal we will ignore the error.
                switch (error)
                {
                case CBImpressionError.Internal:
                    Print("ERROR IS INTERNAL UNABLE TO HANDLE THIS");
                    break;

                case CBImpressionError.InternetUnavailable:
                {
                    Print("No INTERNET IS AVAILABLE .");
                    var noInternetIenumerator = WaitForInternetToCome();
                    StartCoroutine(noInternetIenumerator);
                    return;
                }

                case CBImpressionError.TooManyConnections:
                    Print("SO MANY REQUEST RECEIVED WITHIN A SHORT PERION OF TIME");
                    break;

                case CBImpressionError.WrongOrientation:
                    Print("NOT IN PROPER ORIENTATION");
                    break;

                case CBImpressionError.FirstSessionInterstitialsDisabled:
                    Print("FIRST SESSION FOR INTERSTITIAL IN DIABLED");
                    break;

                case CBImpressionError.NetworkFailure:
                {
                    Print("NETWORK FAIlURE");
                    var noInternetIenumerator = WaitForInternetToCome();
                    StartCoroutine(noInternetIenumerator);
                    return;
                }

                case CBImpressionError.NoAdFound:
                    Print("NO AD FOUND FOR YOU");
                    break;

                case CBImpressionError.SessionNotStarted:
                    Print("NOT A VALID SESSION ");
                    break;

                case CBImpressionError.ImpressionAlreadyVisible:
                    Print("YOU ARE WATCHING THE VIDEO");
                    return;

                case CBImpressionError.NoHostActivity:
                    Print("NO HOST ACTIVE");
                    return;

                case CBImpressionError.UserCancellation:
                    Print("F*****G USER CANCELL MY VIDEO");
                    return;

                case CBImpressionError.InvalidLocation:
                    Print("CHECK YOUR LOCATION ");
                    return;

                case CBImpressionError.VideoUnAvailable:
                    Print("VIDEO NOT AVAILABLE IN CACHE SO I AM STARTING CACHING ONE MORE TIME");
                    break;

                case CBImpressionError.VideoIdMissing:
                    Print("VIDEO URL IS NOT PROPER");
                    break;

                case CBImpressionError.ErrorPlayingVideo:
                    Print("ERROR IN PLAYING VIDEO");
                    break;

                case CBImpressionError.InvalidResponse:
                    Print("INVALID RESPONCE");
                    return;

                case CBImpressionError.AssetsDownloadFailure:
                    Print("ASSET MISSING");
                    break;

                case CBImpressionError.ErrorCreatingView:
                    Print("ERROR IN MAKING A VIEW");
                    break;

                case CBImpressionError.ErrorDisplayingView:
                    Print("ERROR IN SHOWING A VIEW");
                    break;

                case CBImpressionError.PrefetchingIncomplete:
                    Print("ERROR IN PREFETCHING");
                    break;

                default:
                    throw new ArgumentOutOfRangeException("error", error, null);
                }

                //Start  for Caching when auto caching is off
                if (!AutoCache)
                {
                    Chartboost.cacheRewardedVideo(CBLocation.Default);
                }
                //Reward video is not avilable.
                _isRewardVideoAvailble = false;
            };
            //CALL bACK 3

            Chartboost.didDismissRewardedVideo += (CBLocation location) =>
            {
                Print("DISSMISS REWARD VIDEO");
                Print("Location Where Video is cancelled" + location);

                //Prompt user
                //You missed 20 Purple Heart .
            };
            //CALL BACK 4

            Chartboost.didCloseRewardedVideo += (CBLocation location) =>
            {
                Print("CLOSED REWARD VIDEO");
                Print("Location Where Video is cancelled" + location);
                //When reward video is cloed give a call for next time to cache video.
                if (!AutoCache)
                {
                    Chartboost.cacheRewardedVideo(CBLocation.Default);
                }
            };
            //CALL BACK 5

            Chartboost.didClickRewardedVideo += (CBLocation location) =>
            {
                Print("CLICKED REWARD VIDEO");
                Print("Location Where Video is cancelled" + location);
                //Prompt user
                //are you want to leave the game.
            };
            //CALL BACK 6

            Chartboost.didCacheRewardedVideo += (CBLocation location) =>
            {
                Print("REWARD VIDEO CACHED");
                Print("Location Whete Video is cancelled" + location);
                _isRewardVideoAvailble = true;
            };
            //CALL BACK 7

            Chartboost.shouldDisplayRewardedVideo += ShouldDisplayRewardedVideo;
            //CALL BACK 8

            Chartboost.didCompleteRewardedVideo += (CBLocation location, int reward) =>
            {
                Print("Give some gift to user");
                Print("GIFT AMOUNT" + reward);
                //provide gift to the user .
            };
            //CALL BACK 9

            Chartboost.willDisplayVideo += (CBLocation location) =>
            {
                Print("REWARD VIDEO WILL BE DISPLAYED ");
                Print("Location Whete Video is cancelled" + location);
            };
        }