예제 #1
0
        /// <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)
                       ));
        }
예제 #2
0
 /// <summary>
 /// 並列
 /// </summary>
 public static ILoadProcess ToParallel(this IReadOnlyList <ILoadProcess> self)
 {
     if (self.Count <= 0)
     {
         return(SkipLoadProcess.Create("Paralell is Null"));
     }
     if (self.Count == 1)
     {
         return(self[0]);
     }
     return(new ParallelLoadProcess(self));
 }
예제 #3
0
        /// <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));
        }
예제 #4
0
        /// <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)
                       ));
        }
예제 #5
0
        /// <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));
        }
예제 #6
0
 public IPreloadOperation DeepOpenFile(string assetPath)
 {
     return(new PreloadOperation(SkipLoadProcess.Create(assetPath)));
 }
예제 #7
0
 public IPreloadOperation AddLifeCycle(IRuntimeBundleData data, ILifeCycle cycle)
 {
     return(new PreloadOperation(SkipLoadProcess.Create(data)));
 }
예제 #8
0
 public IPreloadOperation AddLifeCycle(string assetPath, ILifeCycle cycle)
 {
     return(new PreloadOperation(SkipLoadProcess.Create(assetPath)));
 }
예제 #9
0
 public IPreloadOperation SingleOpenFile(string abName)
 {
     return(new PreloadOperation(SkipLoadProcess.Create(abName)));
 }
예제 #10
0
 public IPreloadOperation AddLifeCycle(IRuntimeBundleData data, ILifeCycle cycle)
 {
     return(AssetProvider.Preload(SkipLoadProcess.Create(data.Identifier)));
 }
예제 #11
0
 public IPreloadOperation SingleOpenFile(string name)
 {
     return(AssetProvider.Preload(SkipLoadProcess.Create(name)));
 }
예제 #12
0
 public IPreloadOperation DeepOpenFile(string path)
 {
     return(AssetProvider.Preload(SkipLoadProcess.Create(path)));
 }