/// <summary> /// 加载歌曲 /// </summary> public void LoadSong(Song song, LoadSongProgress progressHandler, LoadSongComplete completeHandler) { SongClient client = new SongClient(); client.LoadSongProgress += progressHandler; client.LoadSongComplete += completeHandler; client.LoadSongProgress += OnLoadSongProgressHandler; client.LoadSongComplete += OnLoadSongCompleteHandler; client.LoadSongAsync(song); }
void OnLoadSongCompleteHandler(SongClient client, Song song) { if (m_AudioClipCache.ContainsKey(song.id)) { m_AudioClipCache.Remove(song.id); } m_AudioClipCache.Add(song.id, client.AudioClip); foreach (var track in client.AudioTracks) { if (m_AudioTrackCache.ContainsKey(track.Key)) { m_AudioTrackCache.Remove(track.Key); } m_AudioTrackCache.Add(track.Key, track.Value); } }
void OnLoadSongComplete(SongClient client, Song song) { GuanKaItem item = null; foreach (var gkItem in m_guanKaItemCache) { if (gkItem.guanKa.song.id == song.id) { item = gkItem; break; } } if (item != null) { item.image.color = m_NormalColor; item.image.raycastTarget = true; } }
void OnLoadSongProgress(SongClient client, float progress) { }
void OnLoadSongProgressHandler(SongClient client, float progress) { }