/// <summary> /// ローカルファイルを開く /// </summary> protected virtual ILoadProcess CreateLocalFileOpenJob(IRuntimeBundleData data) { if (JobEngine.HasRequest(data.Identifier)) { // リクエスト済みのモノは完了まで待つ return(WaitLoadProcess.Wait(data, (d) => d.IsOnMemory)); } var location = StorageDatabase.GetSaveLocation(data); if (!File.Exists(location.FullPath)) { OnError(ChipstarResult.ClientError($"Open File is Not Found. == {data.Identifier} for {location.ToString()}")); return(SkipLoadProcess.Create(data)); } var job = JobCreator.OpenLocalBundle(JobEngine, data.Identifier, location, data.Hash, data.Crc); return(new LoadProcess <AssetBundle>( AddJob(job), onCompleted: (content) => { data.OnMemory(content); }, onError: code => OnError(code) )); }
protected override ResultCode DoError(AssetBundleCreateRequest source) { if (source == null) { return(ChipstarResult.ClientError($"Can't Create AssetBundle Open Request : {Identifier} :: {Location?.FullPath ?? string.Empty}")); } return(ChipstarResult.ClientError($"Local Asset Bundle Load Error : {Identifier} :: {Location?.FullPath ?? string.Empty}")); }
/// <summary> /// /// </summary> public void Create(IAssetManager manager, RuntimePlatform platform, IVersionManifest manifest, AssetBundleConfig config) { if (!(manifest?.IsValid ?? false)) { ChipstarLog.Log_Database_NotFound(); CreateResult = ChipstarResult.ClientError("BuildMap Get Error"); return; } CreateResult = CreateImpl(manager, platform, manifest, config); }
/// <summary> /// ロード処理 /// </summary> public ILoadProcess LoadFile(string identifier) { var data = LoadDatabase.GetBundleData(identifier); if (data == null) { OnError(ChipstarResult.ClientError($"Target Bundle Data is Not Found. == {identifier}")); return(SkipLoadProcess.Create(identifier)); } if (data.IsOnMemory) { // ロードしてあるならしない ChipstarLog.Log_Skip_OnMemory(data.Identifier); return(SkipLoadProcess.Create(identifier)); } // ローカルファイルを開く return(CreateLocalFileOpenJob(data)); }
/// <summary> /// エラー情報を返す /// </summary> protected override ResultCode DoError(UnityWebRequest source) { if (source == null) { return(ChipstarResult.ClientError($"Create Network Request Error:{Location?.FullPath ?? string.Empty}")); } if (source.isNetworkError) { return(ChipstarResult.NetworkError(Location, source.responseCode, source.error)); } if (source.isHttpError) { return(ChipstarResult.HttpError(Location, source.responseCode, source.error)); } if (m_option.IsError) { return(m_option.GetResultCode(this)); } return(ChipstarResult.ClientError(source.error)); }
/// <summary> /// ダウンロード処理 /// </summary> public ILoadProcess CacheOrDownload(string identifier) { var data = LoadDatabase.GetBundleData(identifier); if (data == null) { OnError(ChipstarResult.ClientError($"Target Bundle Data is Not Found. == {identifier}")); return(SkipLoadProcess.Create(identifier)); } if (data.IsOnMemory) { // ロード済みは無視 ChipstarLog.Log_Skip_OnMemory(data.Identifier); return(SkipLoadProcess.Create(data.Identifier)); } if (StorageDatabase.HasStorage(data)) { // キャッシュ済は無視 ChipstarLog.Log_Cached(data); return(SkipLoadProcess.Create(data.Identifier)); } return(CreateDowloadJob(data.Url, data)); }
private ResultCode CreateImpl(IAssetManager manager, RuntimePlatform platform, IVersionManifest manifest, AssetBundleConfig config) { var table = m_parser.Parse(manifest.RawData); ChipstarLog.Log_GetBuildMap <TTable, TBundle, TAsset>(table); if (table == null) { return(ChipstarResult.ClientError("Json Parse Error")); } // アセットの一覧 foreach (var asset in table.AssetList) { var d = new AssetData(asset); m_assetsTable.Add(d.Path, d); } // バンドルの一覧 foreach (var bundle in table.BundleList) { var runtime = m_bundleDataCreater.Create(manager, bundle, platform, config); m_bundleTable.Add(bundle.Identifier, runtime); } // 依存関係とアセットデータを接続 foreach (var bundle in table.BundleList) { var runtime = m_bundleTable[bundle.Identifier]; var dependencies = CreateDependencies(bundle); var assets = CreateAssets(bundle); foreach (var asset in assets) { asset.Connect(runtime); } runtime.Set(dependencies); } return(ChipstarResult.Success); }