public void Dispose() { resName = null; bundleName = null; scenceName = null; nextNode = null; luaFunc.Dispose(); }
public void Dispose() { this.resName = null; this.bundleName = null; this.sceneName = null; this.luaFunction.Dispose(); this.nextNode = null; }
public LuaCallBackNode(string resName, string bundleName, string sceneName, LuaFunction function, bool isSingle, LuaCallBackNode backNode) { this.resName = resName; this.bundleName = bundleName; this.sceneName = sceneName; this.isSingle = isSingle; this.luaFunction = function; this.nextNode = backNode; }
public LuaFunction luaFunc; //记录资源加载完成后要回调的方法 public LuaCallBackNode(string _scenceName, string _bundleName, string _resName, bool _isSingle, LuaFunction _luaFunc, LuaCallBackNode _nextNode) { resName = _resName; bundleName = _bundleName; scenceName = _scenceName; isSingle = _isSingle; nextNode = _nextNode; luaFunc = _luaFunc; }
public void GetResources(string sceneName, string bundleName, string res, bool isSingle, LuaFunction luaFunction) { // 没有加载 if (!ILoaderManager.Instance.IsLoadedAssetBundle(sceneName, bundleName)) { Debug.Log("开始加载"); ILoaderManager.Instance.LoadAsset(sceneName, bundleName, LoaderProgress); string bundleFullName = ILoaderManager.Instance.GetBundleRelativeName(sceneName, bundleName); if (bundleFullName != null) { LuaCallBackNode node = new LuaCallBackNode(res, bundleName, sceneName, luaFunction, isSingle, null); luaCallManager.AddBundleCallBack(bundleFullName, node); Debug.Log("Get Resource==" + bundleFullName); } else { Debug.LogWarning("Bundle名为空:" + bundleName); } } //表示已经加载完成 else if (ILoaderManager.Instance.IsLoadingBundleFinish(sceneName, bundleName)) { if (isSingle) { Debug.Log("加载完成"); UnityEngine.Object obj = ILoaderManager.Instance.GetSingleResource(sceneName, bundleName, res); luaFunction.Call(sceneName, bundleName, res, obj); //ResBackMsg.Changer(backid, obj); //SendMsg(ResBackMsg); } else { UnityEngine.Object[] objs = ILoaderManager.Instance.GetResources(sceneName, bundleName, res); luaFunction.Call(sceneName, bundleName, res, objs); //ResBackMsg.Changer(backid, objs); //SendMsg(ResBackMsg); } } //已经加载但是没有加载完把命令存起来 else { Debug.Log("加载中"); string bundleFullName = ILoaderManager.Instance.GetBundleRelativeName(sceneName, bundleName); if (bundleFullName != null) { LuaCallBackNode node = new LuaCallBackNode(res, bundleName, sceneName, luaFunction, isSingle, null); luaCallManager.AddBundleCallBack(bundleFullName, node); } else { Debug.LogWarning("Bundle名为空:" + bundleName); } } }
public void LoadAsset(string scenceName, string bundleName, string resName, bool isSingle, LuaFunction luaFunc) { //当前未加载过 bundle if (!ABLoadManager.Instance.IsLoadedBundle(scenceName, bundleName)) { ABLoadManager.Instance.LoadAssetBundle(scenceName, bundleName, LoadProgress); string fullName = ABLoadManager.Instance.GetRelateBundleName(scenceName, bundleName); // 判断当前是否有该 Bundle if (fullName != null) { LuaCallBackNode node = new LuaCallBackNode(scenceName, bundleName, resName, isSingle, luaFunc, null); nodeManager.AddNode(fullName, node); } else { Debug.Log("The Scence Bundle Txt Don't have bundle bundleName =" + bundleName); } } else { bool isLoadFinish = ABLoadManager.Instance.IsLoadingFinish(scenceName, bundleName); // 资源正在加载中 if (!isLoadFinish) { string fullName = ABLoadManager.Instance.GetRelateBundleName(scenceName, bundleName); // 判断当前是否有该 Bundle if (fullName != null) { LuaCallBackNode node = new LuaCallBackNode(scenceName, bundleName, resName, isSingle, luaFunc, null); nodeManager.AddNode(fullName, node); } else { Debug.Log("The Scence Bundle Txt Don't have bundle bundleName =" + bundleName); } } //资源已经加载过 处于缓存中 else { if (isSingle) { Object obj = ABLoadManager.Instance.LoadSingleRes(scenceName, bundleName, resName); luaFunc.Call(scenceName, bundleName, resName, obj); } else { Object[] objs = ABLoadManager.Instance.LoadMultRes(scenceName, bundleName, resName); luaFunc.Call(scenceName, bundleName, resName, objs); } } } }
public void Dispose(string bundle) { if (manager.ContainsKey(bundle)) { LuaCallBackNode topNode = manager[bundle]; while (topNode.nextNode != null) { LuaCallBackNode curNode = topNode; topNode = topNode.nextNode; curNode.Dispose(); } topNode.Dispose(); manager.Remove(bundle); } }
/// <param name="bundleName"></param> public void RemoveBundleNode(string bundleName) { if (nodeDir.ContainsKey(bundleName)) { LuaCallBackNode currNode = nodeDir[bundleName]; while (currNode.nextNode != null) { LuaCallBackNode tmpNode = currNode.nextNode; currNode = currNode.nextNode; tmpNode.Dispose(); } currNode.Dispose(); nodeDir.Remove(bundleName); } }
public void AddBundleCallBack(string bundle, LuaCallBackNode node) { if (manager.ContainsKey(bundle)) { LuaCallBackNode topNode = manager[bundle]; while (topNode.nextNode != null) { topNode = topNode.nextNode; } topNode.nextNode = node; } else { manager.Add(bundle, node); } }
public void AddNode(string bundleName, LuaCallBackNode node) { if (nodeDir.ContainsKey(bundleName)) { LuaCallBackNode tmpNode = nodeDir[bundleName]; while (tmpNode.nextNode != null) { tmpNode = tmpNode.nextNode; } tmpNode.nextNode = node; } else { nodeDir.Add(bundleName, node); } }
public void CallBackLua(string bundle) { if (manager.ContainsKey(bundle)) { LuaCallBackNode topNpode = manager[bundle]; do { if (topNpode.isSingle) { UnityEngine.Object tempObj = ILoaderManager.Instance.GetSingleResource(topNpode.sceneName, topNpode.bundleName, topNpode.resName); topNpode.luaFunction.Call(topNpode.sceneName, topNpode.bundleName, topNpode.resName, tempObj); } else { UnityEngine.Object[] tempObjs = ILoaderManager.Instance.GetResources(topNpode.sceneName, topNpode.bundleName, topNpode.resName); topNpode.luaFunction.Call(topNpode.sceneName, topNpode.bundleName, topNpode.resName, tempObjs); } topNpode = topNpode.nextNode; } while (topNpode != null); } }
public void BundleNodeCallBack(string bundleName) { if (nodeDir.ContainsKey(bundleName)) { LuaCallBackNode tmpNode = nodeDir[bundleName]; do { if (tmpNode.isSingle) { Object tmpObj = ABLoadManager.Instance.LoadSingleRes(tmpNode.scenceName, tmpNode.bundleName, tmpNode.resName); tmpNode.luaFunc.Call(tmpNode.scenceName, tmpNode.bundleName, tmpNode.resName, tmpObj); } else { Object[] tmpObjs = ABLoadManager.Instance.LoadMultRes(tmpNode.scenceName, tmpNode.bundleName, tmpNode.resName); tmpNode.luaFunc.Call(tmpNode.scenceName, tmpNode.bundleName, tmpNode.resName, tmpObjs); } tmpNode = tmpNode.nextNode; } while (tmpNode != null); } }