Exemplo n.º 1
0
        /// <summary>
        /// 加载声音资源
        /// </summary>
        /// <param name="url"></param>
        /// <param name="parent"></param>
        /// <param name="callback"></param>
        private void LoadAudio(string url, Transform parent, LoadAssetModel loadModel, System.Action <AudioClip> callback)
        {
            AudioLoader.LoadAudioClip(parent, url, loadModel, (loader) =>
            {
                ResourcesLoadTraceMgr.Instance.RecordTraceResourceInfor(loader);
                #region  加载成功后的处理逻辑
                if (loader == null || (loader.IsCompleted && loader.IsError))
                {
                    Debug.LogError("LoadMaterial   Fail,Not Exit At Path= " + url);
                    if (callback != null)
                    {
                        callback.Invoke(null);
                    }
                    return;
                }  //加载资源出错


                AudioClip clip = loader.ResultObj as AudioClip;

                if (callback != null)
                {
                    callback.Invoke(clip);
                }
                #endregion
            });
        }