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 ); }
/** * 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); }
public EndPointSelector(IEndPoint[] endPointInstances = null, EndPointsGetRequestHeaderDelegate requestHeader = null, HttpResponseHandlingDelegate httpResponseHandlingDelegate = null) { this.endPointDict = new Dictionary <Type, IEndPoint>(); if (endPointInstances != null && 0 < endPointInstances.Length) { foreach (var endPointInstance in endPointInstances) { endPointDict[endPointInstance.GetType()] = endPointInstance; } #if UNITY_EDITOR // in editor, check if the EndPointSelecter is initialized with all of classes which implemented ISelectiveEndPoint. var targetType = typeof(IEndPoint); var collectedTypes = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(s => s.GetTypes()) .Where(p => targetType.IsAssignableFrom(p) && targetType != p); foreach (var collectedType in collectedTypes) { if (!endPointDict.ContainsKey(collectedType)) { Debug.LogError("EndPointSelector should be initialize with all types which impletents IEndPoint. required:" + collectedType); Debug.Break(); } } #endif } if (requestHeader != null) { this.endPointGetRequestHeaderDelegate = requestHeader; } else { this.endPointGetRequestHeaderDelegate = BasicRequestHeaderDelegate; } if (httpResponseHandlingDelegate != null) { this.httpResponseHandlingDelegate = httpResponseHandlingDelegate; } else { this.httpResponseHandlingDelegate = BasicResponseHandlingDelegate; } }
/** * 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); }
public AssetBundlePreloader(PreloadListGetRequestHeaderDelegate requestHeader = null, HttpResponseHandlingDelegate httpResponseHandlingDelegate = null) { if (requestHeader != null) { this.preloadListGetRequestHeaderDelegate = requestHeader; } else { this.preloadListGetRequestHeaderDelegate = BasicRequestHeaderDelegate; } if (httpResponseHandlingDelegate != null) { this.httpResponseHandlingDelegate = httpResponseHandlingDelegate; } else { this.httpResponseHandlingDelegate = BasicResponseHandlingDelegate; } }
/// <summary> /// Initializes a new instance of the <see cref="T:AutoyaFramework.AssetBundles.AssetBundleLoader"/> class. /// </summary> /// <param name="basePath">Base path.</param> /// <param name="list">List.</param> /// <param name="requestHeader">Request header.</param> /// <param name="httpResponseHandlingDelegate">Http response handling delegate.</param> public AssetBundleLoader(string basePath, AssetBundleList list, AssetBundleGetRequestHeaderDelegate requestHeader = null, HttpResponseHandlingDelegate httpResponseHandlingDelegate = null) { this.assetDownloadBasePath = basePath; this.list = list; if (requestHeader != null) { this.assetBundleGetRequestHeaderDelegate = requestHeader; } else { this.assetBundleGetRequestHeaderDelegate = BasicRequestHeaderDelegate; } if (httpResponseHandlingDelegate != null) { this.httpResponseHandlingDelegate = httpResponseHandlingDelegate; } else { this.httpResponseHandlingDelegate = BasicResponseHandlingDelegate; } /* * 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; } } }
public AssetBundleLoader(Func <string, string> onBundleDownloadUrlRequired, AssetBundleGetRequestHeaderDelegate requestHeader = null, HttpResponseHandlingDelegate httpResponseHandlingDelegate = null) { this.bundleListStorage = new AssetBundleListStorage(onBundleDownloadUrlRequired); this.onMemoryCache = new Dictionary <string, AssetBundle>(); if (requestHeader != null) { this.assetBundleGetRequestHeaderDelegate = requestHeader; } else { this.assetBundleGetRequestHeaderDelegate = BasicRequestHeaderDelegate; } if (httpResponseHandlingDelegate != null) { this.httpResponseHandlingDelegate = httpResponseHandlingDelegate; } else { this.httpResponseHandlingDelegate = BasicResponseHandlingDelegate; } }