Exemplo n.º 1
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="abModel"></param>
        /// <param name="callback"></param>
        static public void Load(string root = "")
        {
            if (root != "")
            {
                resLoader = new AssetBundleMgr(root);
            }
            else
            {
#if UNITY_EDITOR
                resLoader = new DevResourceMgr();
                BDebug.Log("资源加载:AssetDataBase editor only");
#endif
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="abModel"></param>
        /// <param name="callback"></param>
        static public void Load(string root = "", Action onLoaded = null)
        {
            if (root != "")
            {
                ResLoader = new AssetBundleMgr();
                ResLoader.Init(root, onLoaded);
            }
            else
            {
#if UNITY_EDITOR
                ResLoader = new DevResourceMgr();
                ResLoader.Init("", onLoaded);
                BDebug.Log("资源加载:AssetDataBase editor only");
#endif
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="abModel"></param>
        /// <param name="callback"></param>
        static public void Init(AssetLoadPathType loadPathType)
        {
            BDebug.Log("【BResource】加载路径:" + loadPathType.ToString());
            if (loadPathType == AssetLoadPathType.Editor)
            {
#if UNITY_EDITOR //防止编译报错
                ResLoader = new DevResourceMgr();
                ResLoader.Init("");
#endif
            }
            else
            {
                var path = GameConfig.GetLoadPath(loadPathType);
                ResLoader = new AssetBundleMgrV2();
                ResLoader.Init(path);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// 初始化
 /// </summary>
 /// <param name="abModel"></param>
 /// <param name="callback"></param>
 static public void Init(bool isAssetBundle)
 {
     #if UNITY_EDITOR
     if (isAssetBundle)
     {
         resLoader = new AssetBundleMgr();
         BDebug.Log("资源加载:AssetBundle");
     }
     else
     {
         resLoader = new DevResourceMgr();
         BDebug.Log("资源加载:AssetDataBase editor only");
     }
     #else
     resLoader = new AssetBundleMgr();
     #endif
 }
Exemplo n.º 5
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="abModel"></param>
        /// <param name="callback"></param>
        static public void Load(AssetLoadPath loadPath, string customRoot = null)
        {
            if (loadPath == AssetLoadPath.Editor)
            {
#if UNITY_EDITOR  //防止编译报错
                ResLoader = new DevResourceMgr();
                ResLoader.Init("");
                BDebug.Log("资源加载:AssetDataBase editor only");
#endif
            }
            else
            {
                var path = "";
                if (Application.isEditor)
                {
                    if (!string.IsNullOrEmpty(customRoot))
                    {
                        path = customRoot;
                    }
                    else
                    {
                        if (loadPath == AssetLoadPath.Persistent)
                        {
                            path = Application.persistentDataPath;
                        }
                        else if (loadPath == AssetLoadPath.StreamingAsset)
                        {
                            path = Application.streamingAssetsPath;
                        }
                    }
                }
                else
                {
                    //真机环境config在persistent,跟dll和db保持一致
                    path = Application.persistentDataPath;
                }
                //
                ResLoader = new AssetBundleMgrV2();
                ResLoader.Init(path);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="abModel"></param>
        /// <param name="callback"></param>
        static public void Load(string root = "", Action onLoaded = null)
        {
            if (root != "")
            {
                var config = GameObject.Find("BDFrame").GetComponent <Config>();
                if (config != null)
                {
                    var version = config.Data.AssetBundleManagerVersion;
                    switch (version)
                    {
                    case AssetBundleManagerVersion.V1:
                    {
                        ResLoader = new AssetBundleMgr();
                        ResLoader.Init(root, onLoaded);
                    }
                    break;

                    case AssetBundleManagerVersion.V2_experiment:
                    {
                        ResLoader = new AssetBundleMgrV2();
                        ResLoader.Init(root, onLoaded);
                    }
                    break;
                    }
                }
                else
                {
                    ResLoader = new AssetBundleMgr();
                    ResLoader.Init(root, onLoaded);
                }
            }
            else
            {
#if UNITY_EDITOR
                ResLoader = new DevResourceMgr();
                ResLoader.Init("", onLoaded);
                BDebug.Log("资源加载:AssetDataBase editor only");
#endif
            }
        }