public static void Next() { if (IsPlayingPreview) { return; } Stop(); //stop last song if any if (_PreviousMusicIndex < _PreviousFiles.Count - 2) { //We are in the previous list and next element exists _PreviousMusicIndex++; _CurrentPlaylistElement = _PreviousFiles[_PreviousMusicIndex]; } else { //We are not in the previous list (anymore) if (_NotPlayedFiles.Count == 0) { if (_PreviousFiles.Count == 0) { return; //No songs to play } _NotPlayedFiles.AddRange(_PreviousFiles); } _CurrentPlaylistElement = _NotPlayedFiles[CGame.Rand.Next(_NotPlayedFiles.Count)]; _NotPlayedFiles.Remove(_CurrentPlaylistElement); _PreviousFiles.Add(_CurrentPlaylistElement); _PreviousMusicIndex = _PreviousFiles.Count - 1; } _StartSong(); }
public static void Stop() { _CurPlayer.Stop(); if (!IsPlayingPreview) { _CurrentPlaylistElement = null; } }
public static void Previous() { if (IsPlayingPreview) { return; } if (_PreviousMusicIndex < 0) { return; } if (_CurrentPlaylistElement == null || (_BGPlayer.Position <= 1.5f && _PreviousMusicIndex > 0)) { Stop(); //stop last song _PreviousMusicIndex--; _CurrentPlaylistElement = _PreviousFiles[_PreviousMusicIndex]; } _StartSong(); }
private static bool _IsBackgroundFile(CPlaylistElement element) { return(_BGMusicFiles.Contains(element)); }