예제 #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
 internal static void Log_Unload_Bundle(IRuntimeBundleData bundleData)
 {
     if (!EnableLogDetail)
     {
         return;
     }
     Log($"{bundleData?.Identifier ?? string.Empty} Unload");
 }
예제 #3
0
 /// <summary>
 /// ライフサイクル接続
 /// </summary>
 public void AddLifeCycle(IPreloadOperation operation, ILifeCycle cycle, IRuntimeBundleData data)
 {
     operation.OnCompleted += () =>
     {
         cycle.Begin(null, data);
     };
     m_runList.Add(cycle);
 }
예제 #4
0
 internal static void Log_Cached(IRuntimeBundleData data)
 {
     if (!EnableLogDetail)
     {
         return;
     }
     Log($"Cached : {data.Identifier}");
 }
예제 #5
0
        /// <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);
        }
예제 #6
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)
                       ));
        }
예제 #7
0
        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());
        }
예제 #8
0
 public IPreloadOperation AddLifeCycle(IRuntimeBundleData data, ILifeCycle cycle)
 {
     return(new PreloadOperation(SkipLoadProcess.Create(data)));
 }
예제 #9
0
 public IAccessLocation GetSaveLocation(IRuntimeBundleData d)
 {
     return(null);
 }
예제 #10
0
 public IAccessLocation GetSaveLocation(IRuntimeBundleData data)
 {
     return(LocalDir.ToLocation(data.Path));
 }
예제 #11
0
 public IPreloadOperation AddLifeCycle(IRuntimeBundleData data, ILifeCycle cycle)
 {
     return(AssetProvider.Preload(SkipLoadProcess.Create(data.Identifier)));
 }
예제 #12
0
 public void Connect(IRuntimeBundleData data)
 {
     BundleData = data;
 }
예제 #13
0
 public void Dispose()
 {
     Path       = string.Empty;
     Guid       = string.Empty;
     BundleData = default;
 }
예제 #14
0
 internal static void Log_Unload_Error(IRuntimeBundleData bundleData)
 {
     Warning(string.Format("Can't Unload. Reference Somewhere : {0},count={1}", bundleData.Identifier, bundleData.RefCount));
 }