public void SynLoadAsset(string prefab, Action <Object> loaded) { ResourceInfo resourceInfo; var flag = m_resourcesDic.TryGetValue(prefab, out resourceInfo); if (!flag) { resourceInfo = new ResourceInfo(); if (m_filesDic.ContainsKey(prefab)) { resourceInfo.Path = m_filesDic[prefab]; resourceInfo.ResType = UtilsEx.GetTypeByExtension(Path.GetExtension(prefab)); } else { LoggerHelper.Error("prefab not exist: " + prefab); if (loaded != null) { loaded(null); } return; } m_resourcesDic.Add(prefab, resourceInfo); } resourceInfo.ReferenceCount++; if (loaded != null) { loaded(resourceInfo.GameObject); } }
public Object SynLoadAsset(string prefab) { if (string.IsNullOrEmpty(prefab)) { LoggerHelper.Error("null prefab name."); return(null); } ResourceInfo resourceInfo; var flag = m_resourcesDic.TryGetValue(prefab, out resourceInfo); if (!flag) { resourceInfo = new ResourceInfo(); if (m_filesDic.ContainsKey(prefab)) { resourceInfo.Path = m_filesDic[prefab]; resourceInfo.ResType = UtilsEx.GetTypeByExtension(Path.GetExtension(prefab)); } else { LoggerHelper.Error("prefab not exist: " + prefab); return(null); } m_resourcesDic.Add(prefab, resourceInfo); } resourceInfo.ReferenceCount++; return(resourceInfo.GameObject); }
public void LoadAsset(string prefab, Action <Object> loaded, Action <float> progress) { if (string.IsNullOrEmpty(prefab)) { LoggerHelper.Error("null prefab name."); if (loaded != null) { loaded(null); } return; } ResourceInfo resourceInfo; var flag = m_resourcesDic.TryGetValue(prefab, out resourceInfo); if (!flag) { resourceInfo = new ResourceInfo(); if (m_filesDic.ContainsKey(prefab)) { resourceInfo.Path = m_filesDic[prefab]; resourceInfo.ResType = UtilsEx.GetTypeByExtension(Path.GetExtension(prefab)); } else { LoggerHelper.Error("prefab not exist: " + prefab); if (loaded != null) { loaded(null); } return; } m_resourcesDic.Add(prefab, resourceInfo); } resourceInfo.ReferenceCount++; //if (loaded != null) // loaded(resourceInfo.GameObject); //if (prefab.EndsWith(".exr")) //{ // if (loaded != null) // loaded(resourceInfo.GameObject); //} //else //{ StartCoroutine(resourceInfo.GetGameObject(loaded)); //} }