private void OnComplete(MultiResourceLoader loader) { m_resLoader.Clear(); m_resLoader = null; m_arrParseTypes = null; if (null != m_finishAction) { Action action = m_finishAction; m_finishAction = null; action(); } }
public void Load(List <string> files, Type[] arrParseTypes, Action OnFinish = null) { if (files.Count == 0) { if (OnFinish != null) { OnFinish(); } return; } m_arrParseTypes = arrParseTypes; m_finishAction = OnFinish; //如果是播放模式 if (Application.isPlaying) { //下载对应的资源 m_resLoader = new MultiResourceLoader(ResourceSys.Instance); m_resLoader.LoadList(files, OnComplete, OnProgress, ResourceType.Bytes); } else { for (int i = 0; i < files.Count; i++) { var textAsset = UnityEditor.AssetDatabase.LoadAssetAtPath <TextAsset>(files[i]); if (textAsset != null) { ParseData(files[i], textAsset.bytes); } } if (null != m_finishAction) { Action action = m_finishAction; m_finishAction = null; action(); } } }