private bool _onLoad(string asbName, string assetName, T t) { bool ret = mDict.AddObj(asbName, assetName, t); if (null != OnLoadCallbcak) { if (mList.Count > 0) { for (int i = mList.Count - 1; i > -1; --i) { AsbInfo info = mList[i]; if (info.Equals(asbName, assetName)) { OnLoadCallbcak(t, info); mList.Remove(info); ObjPools.Recover(info); } } } if (mQueue.Count > 0) { AsbInfo info = mQueue.Peek(); if (info.Equals(asbName, assetName)) { OnLoadCallbcak(t, info); mQueue.Dequeue(); ObjPools.Recover(info); for (int i = 0; i < mQueue.Count; i++) { AsbInfo head = mQueue.Peek(); T obj = Get(head.asbName, head.assetName); if (null != obj) { OnLoadCallbcak(obj, head); mQueue.Dequeue(); ObjPools.Recover(head); } else { //不是调用序列的第一个直接返回 return(ret); } } } } } return(ret); }
public void LoadScene(string asbName, string sceneName, bool sync, bool add, Action <float> callback = null, LuaFunction luaFunc = null) { ResManager.Instance.LoadScene(asbName, sceneName, sync, add, (float progress) => { if (progress.Equals(0)) { //开始载入场景时,计数+1 mCount.AddObj(curGroup, asbName, mCount.GetObj(asbName, sceneName) + 1); } if (progress.Equals(-1f)) { LogFile.Warn("加载场景失败, sceneName :{0} , asbName :{1}", sceneName, asbName); } if (null != callback) { callback(progress); } }, luaFunc); }
private void _addAsb2Group(string asbName, string groupName, string[] obj) { int count = mGroupsCounter.GetObj(groupName, asbName); mGroupsCounter.AddObj(groupName, asbName, count + 1); Dictionary <string, HashSet <string> > groupDict; if (!mGroupObjs.TryGetValue(groupName, out groupDict)) { groupDict = new Dictionary <string, HashSet <string> >(); } HashSet <string> asbSet; if (!groupDict.TryGetValue(asbName, out asbSet)) { asbSet = new HashSet <string>(); } //并集 asbSet.UnionWith(obj); groupDict[asbName] = asbSet; mGroupObjs[groupName] = groupDict; }