private void DrawTrackList(TrackList trackList, bool withSpecial) { if (trackList.IsFilled) { string removeKey = ""; foreach (var item in trackList.tracks) { Track track = item.Value; EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("-", GUILayout.Width(20))) { removeKey = item.Key; } EditorGUILayout.LabelField(track.name, GUILayout.Width(120)); EditorGUILayout.LabelField("Volume:", GUILayout.Width(60)); track.Volume = EditorGUILayout.Slider(track.Volume, 0, 1, GUILayout.Width(200)); if (withSpecial) { MusicTrackList _trackList = trackList as MusicTrackList; GUILayout.Space(30); EditorGUILayout.LabelField("Not play in background", GUILayout.Width(150)); bool special = !_trackList.IsBackgroundMusic(track); special = EditorGUILayout.Toggle(special, GUILayout.Width(20)); if (special != !_trackList.IsBackgroundMusic(track)) { if (special) { _trackList.RemoveFromBackgroundMusic(track); } else { _trackList.AddTrackToBackgroundMusic(track); } } } EditorGUILayout.EndHorizontal(); } if (removeKey != "") { if (withSpecial) { MusicTrackList _trackList = trackList as MusicTrackList; _trackList.RemoveFromBackgroundMusic(_trackList.tracks[removeKey]); _trackList.tracks.Remove(removeKey); } else { trackList.tracks.Remove(removeKey); } if (namesList.Contains(removeKey)) { namesList.Remove(removeKey); } } GUILayout.Space(8); } EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Add selected tracks", GUILayout.Width(200))) { foreach (var obj in Selection.objects) { string path = AssetDatabase.GetAssetPath(obj); if (obj == null) { continue; } if (!Directory.Exists(path)) { AddTrack(trackList, path, withSpecial); continue; } string[] files = Directory.GetFiles(path); if (files != null) { for (int i = 0; i < files.Length; i++) { AddTrack(trackList, files [i], withSpecial); } } } } EditorGUILayout.EndHorizontal(); }