/// <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 } }
/// <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); } }
/// <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); } }
/// <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 } }