/// <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) )); }
internal static void Log_Unload_Bundle(IRuntimeBundleData bundleData) { if (!EnableLogDetail) { return; } Log($"{bundleData?.Identifier ?? string.Empty} Unload"); }
/// <summary> /// ライフサイクル接続 /// </summary> public void AddLifeCycle(IPreloadOperation operation, ILifeCycle cycle, IRuntimeBundleData data) { operation.OnCompleted += () => { cycle.Begin(null, data); }; m_runList.Add(cycle); }
internal static void Log_Cached(IRuntimeBundleData data) { if (!EnableLogDetail) { return; } Log($"Cached : {data.Identifier}"); }
/// <summary> /// 依存関係データ作成 /// </summary> private IRuntimeBundleData[] CreateDependencies(TBundle bundle) { var dependencies = bundle.Dependencies; var list = new IRuntimeBundleData[dependencies.Length]; for (var i = 0; i < dependencies.Length; i++) { var name = dependencies[i]; list[i] = m_bundleTable[name]; } return(list); }
/// <summary> /// ダウンロード /// </summary> protected virtual ILoadProcess CreateDowloadJob(IAccessLocation location, IRuntimeBundleData data) { if (JobEngine.HasRequest(data.Identifier)) { // リクエスト済みのモノは無視 return(SkipLoadProcess.Create(location)); } var localPath = StorageDatabase.GetSaveLocation(data); var job = JobCreator.FileDL(JobEngine, data.Identifier, location, localPath, data.FileSize); return(new LoadProcess <FileInfo>( AddJob(job), onCompleted: (info) => { // バージョンを保存 StorageDatabase.Save(data); }, onError: code => OnError(code) )); }
public static string ToDetail(this IRuntimeBundleData self) { var builder = new StringBuilder(); builder.AppendLine(self.Identifier); builder.AppendLine(self.Url.ToString()); builder.AppendLine("Hash : " + self.Hash.ToString()); builder.AppendLine("Crc : " + self.Crc.ToString()); builder.AppendLine("Ref : " + self.RefCount.ToString()); builder.AppendLine("OnMemory : " + self.IsOnMemory.ToString()); builder.AppendLine("FileSize : " + self.FileSize.ToString()); builder.AppendLine("[Dependencies]"); foreach (var d in self.Dependencies) { builder.Append(" -").AppendLine(d.Identifier); builder.Append(" -").AppendLine(d.Url.ToString()); } builder.AppendLine("[Label]"); foreach (var l in self.Labels) { builder.Append(" -").AppendLine(l); } return(builder.ToString()); }
public IPreloadOperation AddLifeCycle(IRuntimeBundleData data, ILifeCycle cycle) { return(new PreloadOperation(SkipLoadProcess.Create(data))); }
public IAccessLocation GetSaveLocation(IRuntimeBundleData d) { return(null); }
public IAccessLocation GetSaveLocation(IRuntimeBundleData data) { return(LocalDir.ToLocation(data.Path)); }
public IPreloadOperation AddLifeCycle(IRuntimeBundleData data, ILifeCycle cycle) { return(AssetProvider.Preload(SkipLoadProcess.Create(data.Identifier))); }
public void Connect(IRuntimeBundleData data) { BundleData = data; }
public void Dispose() { Path = string.Empty; Guid = string.Empty; BundleData = default; }
internal static void Log_Unload_Error(IRuntimeBundleData bundleData) { Warning(string.Format("Can't Unload. Reference Somewhere : {0},count={1}", bundleData.Identifier, bundleData.RefCount)); }