コード例 #1
0
        private void Authenticate(bool isFirstBoot, Action internalOnAuthenticated)
        {
            this.httpRequestHeaderDelegate    = OnHttpRequest;
            this.httpResponseHandlingDelegate = HttpResponseHandling;

            this.assetBundleListGetRequestHeaderDelegate        = OnAssetBundleListGetRequest;
            this.assetBundlePreloadListGetRequestHeaderDelegate = OnAssetBundlePreloadListGetRequest;
            this.assetBundleGetRequestHeaderDelegate            = OnAssetBundleGetRequest;

            Action onAuthSucceeded = () =>
            {
                internalOnAuthenticated();
                onAuthenticated();
            };
            Action <int, string> onBootAuthenticationRetryFailed = (code, reason) =>
            {
                onBootAuthFailed(code, reason);
            };
            Action <int, string> onRefreshAuthenticationRetryFailed = (code, reason) =>
            {
                onRefreshAuthFailed(code, reason);
            };

            _autoyaAuthRouter = new AuthRouter(
                this.mainthreadDispatcher,

                onAuthSucceeded,
                onBootAuthenticationRetryFailed,

                onAuthSucceeded,
                onRefreshAuthenticationRetryFailed,

                isFirstBoot
                );
        }
コード例 #2
0
        private void Authenticate(bool isFirstBoot, Action internalOnAuthenticated)
        {
            // setup request headers handling.
            this.httpRequestHeaderDelegate = OnHttpRequest;

            Action onAuthSucceeded = () =>
            {
                internalOnAuthenticated();
                onAuthenticated();
            };
            Action <int, string> onBootAuthenticationRetryFailed = (code, reason) =>
            {
                onBootAuthFailed(code, reason);
            };
            Action <int, string> onRefreshAuthenticationRetryFailed = (code, reason) =>
            {
                onRefreshAuthFailed(code, reason);
            };

            _autoyaAuthRouter = new AuthRouter(
                this.mainthreadDispatcher,

                onAuthSucceeded,
                onBootAuthenticationRetryFailed,

                onAuthSucceeded,
                onRefreshAuthenticationRetryFailed,

                isFirstBoot
                );
        }
コード例 #3
0
ファイル: PurchaseRouter.cs プロジェクト: Casanova1986/Autoya
        /**
         *              constructor.
         *
         *              Func<string, Dictionary<string, string>> requestHeader func is used to get request header from outside of this feature.
         *              by default it returns empty headers.
         *
         *              also you can modify http error handling via httpResponseHandlingDelegate.
         *              by default, http response code 200 ~ 299 is treated as success, and other codes are treated as network error.
         */
        public PurchaseRouter(
            Action <IEnumerator> executor,
            Func <string, ProductInfo[]> onLoadProducts,
            Func <string, string> onTicketRequest,
            Func <string, string> onTicketResponse,
            Action onPurchaseReady,
            Action <PurchaseReadyError, int, string> onPurchaseReadyFailed,
            Action <string> onPurchaseCompletedInBackground           = null,
            HttpRequestHeaderDelegate httpGetRequestHeaderDeletage    = null,
            HttpResponseHandlingDelegate httpResponseHandlingDelegate = null
            )
        {
            this.storeId = Guid.NewGuid().ToString();

            this.enumExecutor = executor;

            /*
             *                  set store kind by platform.
             */
#if Update_PurchaseLib
            this.storeKind = "dummy";
#elif UNITY_EDITOR
            this.storeKind = AppleAppStore.Name;
#elif UNITY_IOS
            this.storeKind = AppleAppStore.Name;
#elif UNITY_ANDROID
            this.storeKind = GooglePlay.Name;
#endif

            if (httpGetRequestHeaderDeletage != null)
            {
                this.httpRequestHeaderDelegate = httpGetRequestHeaderDeletage;
            }
            else
            {
                this.httpRequestHeaderDelegate = BasicRequestHeaderDelegate;
            }

            this.http = new HTTPConnection();

            if (httpResponseHandlingDelegate != null)
            {
                this.httpResponseHandlingDelegate = httpResponseHandlingDelegate;
            }
            else
            {
                this.httpResponseHandlingDelegate = BasicResponseHandlingDelegate;
            }

            this.onTicketRequest  = onTicketRequest;
            this.onTicketResponse = onTicketResponse;
            this.onPurchaseCompletedInBackground = onPurchaseCompletedInBackground;


            var cor = _Ready(onLoadProducts, onPurchaseReady, onPurchaseReadyFailed);
            enumExecutor(cor);
        }
コード例 #4
0
ファイル: PurchaseRouter.cs プロジェクト: sassembla/ScheduRPG
        /**
         *      constructor.
         *
         *      Func<string, Dictionary<string, string>> requestHeader func is used to get request header from outside of this feature.
         *      by default it returns empty headers.
         *
         *      also you can modify http error handling via httpResponseHandlingDelegate.
         *      by default, http response code 200 ~ 299 is treated as success, and other codes are treated as network error.
         */
        public PurchaseRouter(
            Action <IEnumerator> executor,
            Func <string, ProductInfo[]> onLoadProducts,
            Func <string, string> onTicketResponse,
            Action onPurchaseReady,
            Action <PurchaseReadyError, int, string> onPurchaseReadyFailed,
            HttpRequestHeaderDelegate httpGetRequestHeaderDeletage    = null,
            HttpResponseHandlingDelegate httpResponseHandlingDelegate = null
            )
        {
            // this.storeId = Guid.NewGuid().ToString();

            // this.enumExecutor = executor;

            // /*
            //  set store kind by platform.
            // */
            // #if UNITY_EDITOR
            //  this.storeKind = AppleAppStore.Name;
            // #elif UNITY_IOS
            //  this.storeKind = AppleAppStore.Name;
            // #elif UNITY_ANDROID
            //  this.storeKind = GooglePlay.Name;
            // #endif

            // if (httpGetRequestHeaderDeletage != null) {
            //  this.httpRequestHeaderDelegate = httpGetRequestHeaderDeletage;
            // } else {
            //  this.httpRequestHeaderDelegate = BasicRequestHeaderDelegate;
            // }

            // this.http = new HTTPConnection();

            // if (httpResponseHandlingDelegate != null) {
            //  this.httpResponseHandlingDelegate = httpResponseHandlingDelegate;
            // } else {
            //  this.httpResponseHandlingDelegate = BasicResponseHandlingDelegate;
            // }

            // this.onTicketResponse = onTicketResponse;

            // var cor = _Ready(onLoadProducts, onPurchaseReady, onPurchaseReadyFailed);
            // enumExecutor(cor);
        }