private void Awake() { GameObject timeProvidersGo = new GameObject("-TimeProvider"); SimpleTimeProvider mainCoroutineTimeProvider = timeProvidersGo.AddComponent <SimpleTimeProvider>(); coroutineManager = new CoroutineManager(); coroutineManager.TimeProvider = mainCoroutineTimeProvider; resourceStorage = new ResourceStorage(100); //Loader for load any file from www WebRequestLoader webLoader = new WebRequestLoader(coroutineManager); //Creator for cast loaded by www byte[] to string webLoader.RegisterResourceCreator(new StringDataCreator()); //Loader to load bundle from disk LocalFolderBundlesLoader bundlesLoader = new LocalFolderBundlesLoader(bundlesFolderPath, coroutineManager); //Loader to load bundle from server static folder //WebRequestBundlesLoader bundlesLoader = new WebRequestBundlesLoader(bundlesFolderPath, coroutineManager); resourceStorage.RegisterResourceLoader(webLoader); resourceStorage.RegisterResourceLoader(bundlesLoader); coroutineManager.StartCoroutine(this, WorkProcess()); }
private void Awake() { discCacheFolderPath = Application.dataPath + discCacheFolderPath; GameObject timeProvidersGo = new GameObject("-TimeProvider"); SimpleTimeProvider mainCoroutineTimeProvider = timeProvidersGo.AddComponent <SimpleTimeProvider>(); coroutineManager = new CoroutineManager(); coroutineManager.TimeProvider = mainCoroutineTimeProvider; #if UNITY_EDITOR foreach (var findAsset in AssetDatabase.FindAssets(manifestName)) { if (AssetDatabase.GUIDToAssetPath(findAsset).Contains(".json") && AssetDatabase.GUIDToAssetPath(findAsset).Contains("/Sources/")) { serverUrl = Application.dataPath.Replace("/Assets", "/") + AssetDatabase.GUIDToAssetPath(findAsset).Replace(manifestName + ".json", ""); break; } } discCacheFolderPath = serverUrl.Replace("/Sources/", "/FileCacheForExample"); foreach (var findAsset in AssetDatabase.FindAssets(manifestName)) { if (AssetDatabase.GUIDToAssetPath(findAsset).Contains(".json")) { manifestPath = AssetDatabase.GUIDToAssetPath(findAsset); break; } } #endif resourceStorage = new ResourceStorage(100); var textureCreator = new TextureDataCreator(); var versionedResourceLoader = new VersionedDiskCachedResourceLoader(discCacheFolderPath, "file://" + serverUrl, coroutineManager); versionedResourceLoader.RegisterResourceCreator(textureCreator); resourceStorage.RegisterResourceLoader(versionedResourceLoader); loaderPrefix = versionedResourceLoader.SupportsMask; TextAsset manifest = null; #if UNITY_EDITOR manifest = AssetDatabase.LoadAssetAtPath <TextAsset>(manifestPath); #endif var jsonSerializer = new JsonSerializer(new JsonSerializerSettings { Formatting = Formatting.Indented }, Encoding.UTF8); var manifestAsJson = jsonSerializer.DeserializeString <AssetFilesManifest>(manifest.text); versionedResourceLoader.Manifest.AddManifestPart(manifestAsJson); _loadImageVersion1.onClick.AddListener(() => { coroutineManager.StartCoroutine(this, LoadImageVer1Process()); }); _loadImageVersion2.onClick.AddListener(() => { coroutineManager.StartCoroutine(this, LoadImageVer2Process()); }); }
private void Awake() { GameObject timeProvidersGo = new GameObject("-TimeProvider"); SimpleTimeProvider mainCoroutineTimeProvider = timeProvidersGo.AddComponent <SimpleTimeProvider>(); coroutineManager = new CoroutineManager(); coroutineManager.TimeProvider = mainCoroutineTimeProvider; coroutineManager.StartCoroutine(this, WorkProcess()); }
private void Awake() { GameObject timeProvidersGo = new GameObject("-TimeProvider"); SimpleTimeProvider mainCoroutineTimeProvider = timeProvidersGo.AddComponent <SimpleTimeProvider>(); CoroutineManager coroutineManager = new CoroutineManager(); coroutineManager.TimeProvider = mainCoroutineTimeProvider; resourceStorage = new ResourceStorage(100); WebRequestLoader webLoader = new WebRequestLoader(coroutineManager); webLoader.RegisterResourceCreator(new TextureDataCreator()); webLoader.RegisterResourceCreator(new StringDataCreator()); resourceStorage.RegisterResourceLoader(webLoader); }