public void LoadRescoure(string path, CallBack fun, ref int progress) { if (!m_handleDic.ContainsKey(path)) { sAddData data = new sAddData(); data.callBack = fun; data.path = path; m_handleDic.Add(path, data); StartCoroutine(load(path, fun)); } }
void Update() { m_curTime += Time.deltaTime; if (m_curTime < m_deltaTime) { return; } m_curTime = 0.0f; List <string> key = new List <string>(m_handleDic.Keys); for (int i = m_handleDic.Count - 1; i >= 0; --i) { sAddData temp = m_handleDic[key[i]]; if (temp.rescoure != null && temp.rescoure.isDone == true) { temp.callBack(temp.rescoure); temp.rescoure.Dispose(); m_handleDic.Remove(temp.path); } else { //StartCoroutine(load (temp.path,temp.callBack)); sAddData data = m_handleDic[key[i]]; data.rescoure = m_tempData; m_handleDic[key[i]] = data; } } /*foreach(sAddData temp in m_handleDic.Values){ * if(temp.rescoure != null && temp.rescoure.isDone == true){ * temp.callBack(temp.rescoure); * temp.rescoure.Dispose(); * //m_handleDic.Remove(temp); * m_handleDic.Remove(temp.path); * } * else{ * StartCoroutine(load (temp.path,temp.callBack)); * } * }*/ }