public AssetBundlePreloader(string urlBase, Autoya.HttpResponseHandlingDelegate httpResponseHandlingDelegate =null)
        {
            this.urlBase = urlBase;

            if (httpResponseHandlingDelegate == null) {
                this.httpResponseHandlingDelegate = BasicResponseHandlingDelegate;
            } else {
                this.httpResponseHandlingDelegate = httpResponseHandlingDelegate;
            }
        }
        public AssetBundleListDownloader(string basePath, Autoya.HttpResponseHandlingDelegate httpResponseHandlingDelegate = null)
        {
            this.basePath = basePath;

            if (httpResponseHandlingDelegate == null)
            {
                this.httpResponseHandlingDelegate = BasicResponseHandlingDelegate;
            }
            else
            {
                this.httpResponseHandlingDelegate = httpResponseHandlingDelegate;
            }
        }
Example #3
0
        /**
         *      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 <PurchaseError, string, AutoyaStatus> onPurchaseReadyFailed,
            Autoya.HttpRequestHeaderDelegate httpGetRequestHeaderDeletage    = null,
            Autoya.HttpResponseHandlingDelegate httpResponseHandlingDelegate = null
            )
        {
            this.storeId = Guid.NewGuid().ToString();
            // Debug.LogError("start storeId:" + storeId);
            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.requestHeader = httpGetRequestHeaderDeletage;
            }
            else
            {
                this.requestHeader = 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);
        }
Example #4
0
        public AssetBundleLoader(string basePath, AssetBundleList list, Autoya.AssetBundleGetRequestHeaderDelegate requestHeader = null, Autoya.HttpResponseHandlingDelegate httpResponseHandlingDelegate = null)
        {
            this.assetDownloadBasePath = basePath;
            this.list = list;

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

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

            /*
             *      construct assetName - AssetBundleName dictionary for fast loading.
             */
            assetNamesAndAssetBundleNamesDict.Clear();

            foreach (var assetBundle in list.assetBundles)
            {
                var bundleName = assetBundle.bundleName;
                foreach (var assetName in assetBundle.assetNames)
                {
                    assetNamesAndAssetBundleNamesDict[assetName] = bundleName;
                }
            }
        }