Пример #1
0
        public static void Init(OnInitFinished finishedCallback)
        {
#if LOADER_BUNDLE
            string            assetFilePath     = AssetConst.GetAssetDetailConfigFullPathForBundle();
            AssetDetailConfig assetDetailConfig = JSONReader.ReadFromFile <AssetDetailConfig>(assetFilePath);
            assetDetailConfig.InitConfig();

            string             bundleFilePath     = AssetConst.GetBundleDetailConfigFullPath();
            BundleDetailConfig bundleDetailConfig = JSONReader.ReadFromFile <BundleDetailConfig>(bundleFilePath);
            bundleDetailConfig.InitConfig();

            loader = new BundleLoader();
            loader.DoInitialize(assetDetailConfig, (result) =>
            {
                Debug.Log("LoaderUtill::Init->init finished result = " + result);
                finishedCallback?.Invoke(result);
            }, AssetConst.GetRootFullDirForBundle(), bundleDetailConfig);
#elif LOADER_RESOURCE
#else
            string            assetFilePath     = AssetConst.GetAssetDetailConfigFullPathForDatabase();
            AssetDetailConfig assetDetailConfig = JSONReader.ReadFromFile <AssetDetailConfig>(assetFilePath);
            assetDetailConfig.InitConfig();

            loader = new DatabaseLoader();
            loader.DoInitialize(assetDetailConfig, (result) =>
            {
                Debug.Log("LoaderUtill::Init->init finished result = " + result);
                finishedCallback?.Invoke(result);
            });
#endif
            loaderBehaviour = PersistentUObjectHelper.CreateComponent <LoaderBehaviour>();
            loaderBehaviour.SetLoader(loader);
        }
Пример #2
0
 public static void DestroyLoader()
 {
     if (loader != null)
     {
         loader.DoDestroy();
         loader = null;
     }
     if (loaderBehaviour != null)
     {
         GameObject.Destroy(loaderBehaviour.gameObject);
         loaderBehaviour = null;
     }
 }