Example #1
0
        /// <summary>
        /// 初期化
        /// </summary>
        public IEnumerator Initialize(RuntimePlatform platform, AssetBundleConfig config)
        {
            m_saveDirRoot = config.GetSaveStorage(platform);
            m_versionFile = config.GetSaveFile(platform);
            var path = m_versionFile.FullPath;

            ChipstarLog.Log_InitStorageDB(path);

            var isExist = File.Exists(path);

            if (!isExist)
            {
                //	なければ空データ
                BuildEmpty(m_versionFile);
                yield break;
            }
            try
            {
                // あったら読み込んで変換
                var table = m_builder.Read(path);
                m_runtimeTable = table.List
                                 .ToDictionary(
                    c => c.Identifier,
                    c => new CachedFileData(c, m_saveDirRoot)
                    );
            }
            catch (Exception e)
            {
                // 読み込み失敗したのでとりあえず空でつくりなおし
                ChipstarLog.Assert(e.Message);
                BuildEmpty(m_versionFile);
            }
            yield return(null);
        }
Example #2
0
        public override ILoadDatabase Build(RuntimePlatform platform, AssetBundleConfig config)
        {
            var parser      = m_tableBuilder.GetParser();
            var dataCreater = new RuntimeBundleDataCreater();

            return(new LoadDatabase <BuildMapDataTable, BundleBuildData, AssetBuildData>(parser, dataCreater, platform, config));
        }
Example #3
0
        public override IAssetManager Build(RuntimePlatform platform, AssetBundleConfig config)
        {
            var encode = BuildMapDataTable.Encode;

            var loadDatabase    = new MultiLoadDatabase();
            var saveBuilder     = m_saveBuilder.Build();
            var storageDatabase = new StorageDatabase <StorageFileTable>(builder: saveBuilder);

            storageDatabase.OnSaveVersion = d => true;

            var storageProvider  = m_storageProvider.Build(platform, config, loadDatabase, storageDatabase);
            var downloadProvider = m_downloadProvider.Build(platform, config, loadDatabase, storageDatabase);
            var assetProvider    = m_assetProvider.Build(platform, config, loadDatabase);
            var unloadProvider   = m_unloadProvider.Build(platform, config, loadDatabase);

            var errorHandler = new ErrorHandler();

            // --- コールバック

            //	初期化
            return(new AssetManager(
                       config: config,
                       loadDatabase: loadDatabase,
                       storageDatabase: storageDatabase,
                       downloadProvider: downloadProvider,
                       storageProvider: storageProvider,
                       assetProvider: assetProvider,
                       unloadProvider: unloadProvider,
                       errorHandler: errorHandler
                       ));
        }
Example #4
0
        //=========================================
        //  関数
        //=========================================

        /// <summary>
        /// コンストラクタ
        /// </summary>
        public LoadDatabase(
            IFileParser <TTable> parser,
            IRuntimeBundleDataCreater bundleDataCreater,
            RuntimePlatform platform,
            AssetBundleConfig config
            )
        {
            m_parser            = parser;
            m_bundleDataCreater = bundleDataCreater;
            m_config            = config;
            m_server            = m_config.GetServer(platform);
        }
Example #5
0
        //===============================
        // 関数
        //===============================
        public IDownloadProvider Build(RuntimePlatform platform, AssetBundleConfig config, ILoadDatabase loadDatabase, IStorageDatabase storageDatabase)
        {
            var engine   = new MultiLineJobEngine(m_engineNum);
            var provider = new DownloadProvider
                           (
                loadDatabase: loadDatabase,
                storageDatabase: storageDatabase,
                dlEngine: engine,
                jobCreator: new WRJobCreator()
                           );

            return(provider);
        }
Example #6
0
        //=========================================
        // 関数
        //=========================================

        private void Add(ILoadDatabase db, AssetBundleConfig config)
        {
            var identifier = config.Identifier;

            if (m_table.ContainsKey(identifier))
            {
                // 更新破棄
                m_table[identifier].DisposeIfNotNull();
                m_table[identifier] = db;
                return;
            }
            m_table.Add(identifier, db);
        }
Example #7
0
        public IEnumerator Login(RuntimePlatform platform, IManifestLoader loader, AssetBundleConfig config)
        {
            yield return(null);

            AssetProvider.SetLoginMode(true);
        }
Example #8
0
 /// <summary>
 /// 初期化
 /// </summary>
 public IEnumerator Setup(RuntimePlatform platform, IManifestLoader loader, AssetBundleConfig config)
 {
     //	特にナシ
     yield return(null);
 }
Example #9
0
        //================================
        // 関数
        //================================

        public override IAssetManager Build(RuntimePlatform platform, AssetBundleConfig config)
        {
            var prefex = AssetDatabase.GetAssetPath(m_rootFolder) + "/";

            return(new AssetManagerEditorSimulator(prefex, config.GetSaveStorage(platform)));
        }
Example #10
0
 public override IAssetManager Build(RuntimePlatform platform, AssetBundleConfig config)
 {
     return(new BuiltinAssetManager(new ResourcesDatabase(m_databasePath)));
 }
Example #11
0
        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);
        }
Example #12
0
 /// <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);
 }
Example #13
0
 public abstract ILoadDatabase Build(RuntimePlatform platform, AssetBundleConfig config);
Example #14
0
        //========================================
        //  関数
        //========================================

        public RuntimeBundleData(IAssetManager manager, IBundleBuildData build, RuntimePlatform platform, AssetBundleConfig config)
        {
            m_manager  = manager;
            m_manifest = build;
            Path       = config.GetRelativePath(platform, m_manifest.Path, m_manifest.Hash, config.Extension);
            Url        = config.GetLocation(platform, m_manifest.Path);
        }
Example #15
0
 public IStorageProvider Build(RuntimePlatform platform, AssetBundleConfig config, ILoadDatabase loadDatabase, IStorageDatabase storageDatabase)
 {
     return(new StorageProvider(loadDatabase, storageDatabase));
 }
Example #16
0
 public void Create(IAssetManager manager, RuntimePlatform platform, IVersionManifest manifest, AssetBundleConfig config)
 {
 }
Example #17
0
        public void Create(IAssetManager manager, RuntimePlatform platform, IVersionManifest manifest, AssetBundleConfig config)
        {
            var db = config.BuildDatabase(platform);

            db.Create(manager, platform, manifest, config);
            Add(db, config);

            // 優先度高い方(サーバー側の情報をメインとする)
            m_mainIdentifier = m_table.OrderBy(c => c.Value.Priority).LastOrDefault().Key;
        }
Example #18
0
 public IEnumerator Setup(RuntimePlatform platform, IManifestLoader loader, AssetBundleConfig config)
 {
     yield break;
 }
Example #19
0
		public IAssetUnloadProvider Build(RuntimePlatform platform, AssetBundleConfig config, ILoadDatabase database)
		{
			return new AssetUnloadProvider( database );
		}
Example #20
0
 public virtual IAssetLoadProvider Build(RuntimePlatform platform, AssetBundleConfig config, ILoadDatabase database)
 {
     return(new AssetLoadProvider(Factory(database)));
 }
Example #21
0
 public IRuntimeBundleData Create(IAssetManager manager, IBundleBuildData build, RuntimePlatform platform, AssetBundleConfig config)
 {
     return(new RuntimeBundleData(manager, build, platform, config));
 }