public void LoadBundleFinish(string bundle) { if (manager.ContainsKey(bundle)) { MutiCallBackNode topNode = manager[bundle]; } }
public void Dispose() { nextValue = null; luaFunc.Dispose(); resName = null; bundleName = null; scenceName = null; }
public MutiCallBackNode(string scence, string bundle, LuaFunction tmpLuaFunc, bool single, MutiCallBackNode tmpNode, params string[] res) { this.bundleName = bundle; this.resName = res; this.nextValue = tmpNode; this.luaFunc = tmpLuaFunc; this.isSingle = single; this.scenceName = scence; this.reses = new Object[res.Length][]; }
public void AddBundle(string bundle, MutiCallBackNode tmpNode) { if (manager.ContainsKey(bundle)) { MutiCallBackNode topNode = manager[bundle]; while (topNode.nextValue != null) { topNode = topNode.nextValue; } topNode.nextValue = tmpNode; } else { manager.Add(bundle, tmpNode); } }
public void CallBackLua(string bundle) { if (manager.ContainsKey(bundle)) { MutiCallBackNode topNode = manager[bundle]; do { if (topNode.isSingle) { int tmpCount = topNode.resName.Length; object[] results = new object[tmpCount]; for (int i = 0; i < tmpCount; i++) { results[i] = ILoadManager.Instance.GetSingleResources(topNode.scenceName, topNode.bundleName, topNode.resName[i]); } topNode.luaFunc.Call(topNode.scenceName, topNode.bundleName, topNode.resName, results); } else { object[][] results = new object[topNode.resName.Length][]; for (int i = 0; i < topNode.resName.Length; i++) { results[i] = ILoadManager.Instance.GetMutiResources(topNode.scenceName, topNode.bundleName, topNode.resName[i]); } topNode.luaFunc.Call(topNode.scenceName, topNode.bundleName, topNode.resName, results); } topNode = topNode.nextValue; }while (topNode != null); } else { // Debuger.Log("extern contain bundle =="+bundle); } }
public void Dispose(string bundle) { if (manager.ContainsKey(bundle)) { MutiCallBackNode topNode = manager[bundle]; // 挨个释放 while (topNode.nextValue != null) { MutiCallBackNode curNode = topNode; topNode = topNode.nextValue; curNode.Dispose(); } // 最后一个结点的释放 topNode.Dispose(); manager.Remove(bundle); } }
public void LoadResFinish(MutiCallBackNode node) { }
/// <summary> /// /// </summary> /// <param name="scenceName"> 场景名字</param> /// <param name="bundleName"> bundle</param> /// <param name="res">资源名字</param> /// <param name="single">加载的是一个资源 还是多个</param> /// <param name="luaFunc">lua回调函数</param> public void GetResources(string scenceName, string bundleName, bool single, LuaFunction luaFunc, params string[] res) { ///没有加载过 if (!ILoadManager.Instance.IsLoadingAssetBundle(scenceName, bundleName)) { Debuger.Log("Get Multi Resources==" + bundleName); ILoadManager.Instance.LoadAsset(scenceName, bundleName, LoaderProgrocess); string bundlFullName = ILoadManager.Instance.GetBundleRelateName(scenceName, bundleName); if (bundlFullName != null && luaFunc != null) { MutiCallBackNode tmpNode = new MutiCallBackNode(scenceName, bundleName, luaFunc, single, null, res); CallBack.AddBundle(bundlFullName, tmpNode); } else { Debuger.LogWarning("doest not contain bundle" + bundleName); } } //已经加载完成 else if (ILoadManager.Instance.IsLoadingBundleFinish(scenceName, bundleName)) { if (luaFunc != null) { if (single) { int tmpCount = res.Length; object[] results = new object[tmpCount]; for (int i = 0; i < tmpCount; i++) { results[i] = ILoadManager.Instance.GetSingleResources(scenceName, bundleName, res[i]); } luaFunc.Call(scenceName, bundleName, res, results); } else { object[][] results = new object[res.Length][]; for (int i = 0; i < res.Length; i++) { results[i] = ILoadManager.Instance.GetMutiResources(scenceName, bundleName, res[i]); } luaFunc.Call(scenceName, bundleName, res, results); } luaFunc.Dispose(); } } else { if (luaFunc != null) { string bundlFullName = ILoadManager.Instance.GetBundleRelateName(scenceName, bundleName); MutiCallBackNode tmpNode = new MutiCallBackNode(scenceName, bundleName, luaFunc, single, null, res); CallBack.AddBundle(bundlFullName, tmpNode); } } }