Remove redundant names in playlist functions
Fix handling of playlist IDs
This commit is contained in:
1 parent
10e5312579
commit
75ff5a0291
10 files changed
+249
-272
No files matched your search
@@ -655,9 +655,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
switch (_GameData.SongSource)
|
switch (_GameData.SongSource)
|
||||||
{
|
{
|
||||||
case ESongSource.TR_PLAYLIST:
|
case ESongSource.TR_PLAYLIST:
|
||||||
for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(_GameData.PlaylistID); i++)
|
for (int i = 0; i < CBase.Playlist.GetSongCount(_GameData.PlaylistID); i++)
|
||||||
{
|
{
|
||||||
int id = CBase.Playlist.GetPlaylistSong(_GameData.PlaylistID, i).SongID;
|
int id = CBase.Playlist.GetSong(_GameData.PlaylistID, i).SongID;
|
||||||
// ReSharper disable LoopCanBeConvertedToQuery
|
// ReSharper disable LoopCanBeConvertedToQuery
|
||||||
foreach (EGameMode mode in CBase.Songs.GetSongByID(id).AvailableGameModes)
|
foreach (EGameMode mode in CBase.Songs.GetSongByID(id).AvailableGameModes)
|
||||||
// ReSharper restore LoopCanBeConvertedToQuery
|
// ReSharper restore LoopCanBeConvertedToQuery
|
||||||
|
|||||||
@@ -180,11 +180,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
_SelectSlides[_SelectSlideSongSource].Clear();
|
_SelectSlides[_SelectSlideSongSource].Clear();
|
||||||
_SelectSlides[_SelectSlideSongSource].SetValues<ESongSource>((int)_Data.ScreenConfig.SongSource);
|
_SelectSlides[_SelectSlideSongSource].SetValues<ESongSource>((int)_Data.ScreenConfig.SongSource);
|
||||||
|
|
||||||
List<string> playlists = CBase.Playlist.GetPlaylistNames();
|
List<string> playlists = CBase.Playlist.GetNames();
|
||||||
_SelectSlides[_SelectSlidePlaylist].Clear();
|
_SelectSlides[_SelectSlidePlaylist].Clear();
|
||||||
for (int i = 0; i < playlists.Count; i++)
|
for (int i = 0; i < playlists.Count; i++)
|
||||||
{
|
{
|
||||||
string value = playlists[i] + " (" + CBase.Playlist.GetPlaylistSongCount(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")";
|
string value = playlists[i] + " (" + CBase.Playlist.GetSongCount(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")";
|
||||||
_SelectSlides[_SelectSlidePlaylist].AddValue(value);
|
_SelectSlides[_SelectSlidePlaylist].AddValue(value);
|
||||||
}
|
}
|
||||||
_SelectSlides[_SelectSlidePlaylist].Selection = _Data.ScreenConfig.PlaylistID;
|
_SelectSlides[_SelectSlidePlaylist].Selection = _Data.ScreenConfig.PlaylistID;
|
||||||
@@ -241,12 +241,12 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
{
|
{
|
||||||
if (CBase.Playlist.GetNumPlaylists() > 0)
|
if (CBase.Playlist.GetNumPlaylists() > 0)
|
||||||
{
|
{
|
||||||
if (CBase.Playlist.GetPlaylistSongCount(_Data.ScreenConfig.PlaylistID) > 0)
|
if (CBase.Playlist.GetSongCount(_Data.ScreenConfig.PlaylistID) > 0)
|
||||||
{
|
{
|
||||||
_ConfigOk = false;
|
_ConfigOk = false;
|
||||||
for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(_Data.ScreenConfig.PlaylistID); i++)
|
for (int i = 0; i < CBase.Playlist.GetSongCount(_Data.ScreenConfig.PlaylistID); i++)
|
||||||
{
|
{
|
||||||
int id = CBase.Playlist.GetPlaylistSong(_Data.ScreenConfig.PlaylistID, i).SongID;
|
int id = CBase.Playlist.GetSong(_Data.ScreenConfig.PlaylistID, i).SongID;
|
||||||
_ConfigOk = CBase.Songs.GetSongByID(id).AvailableGameModes.Any(mode => mode == gm);
|
_ConfigOk = CBase.Songs.GetSongByID(id).AvailableGameModes.Any(mode => mode == gm);
|
||||||
if (_ConfigOk)
|
if (_ConfigOk)
|
||||||
break;
|
break;
|
||||||
|
|||||||
+33
-28
@@ -865,29 +865,34 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
class CBplaylist : IPlaylist
|
class CBplaylist : IPlaylist
|
||||||
{
|
{
|
||||||
public void SetPlaylistName(int playlistID, string name)
|
public void SetName(int playlistID, string name)
|
||||||
{
|
{
|
||||||
CPlaylists.SetPlaylistName(playlistID, name);
|
CPlaylists.SetName(playlistID, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<string> GetPlaylistNames()
|
public List<string> GetNames()
|
||||||
{
|
{
|
||||||
return CPlaylists.PlaylistNames;
|
return CPlaylists.Names;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetPlaylistName(int playlistID)
|
public bool Exists(int playlistID)
|
||||||
{
|
{
|
||||||
return CPlaylists.GetPlaylistName(playlistID);
|
return CPlaylists.Get(playlistID) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeletePlaylist(int playlistID)
|
public string GetName(int playlistID)
|
||||||
{
|
{
|
||||||
CPlaylists.DeletePlaylist(playlistID);
|
return CPlaylists.GetName(playlistID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SavePlaylist(int playlistID)
|
public void Delete(int playlistID)
|
||||||
{
|
{
|
||||||
CPlaylists.SavePlaylist(playlistID);
|
CPlaylists.Delete(playlistID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save(int playlistID)
|
||||||
|
{
|
||||||
|
CPlaylists.Save(playlistID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetNumPlaylists()
|
public int GetNumPlaylists()
|
||||||
@@ -895,49 +900,49 @@ namespace Vocaluxe.Base
|
|||||||
return CPlaylists.NumPlaylists;
|
return CPlaylists.NumPlaylists;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddPlaylistSong(int playlistID, int songID)
|
public void AddSong(int playlistID, int songID)
|
||||||
{
|
{
|
||||||
CPlaylists.AddPlaylistSong(playlistID, songID);
|
CPlaylists.AddSong(playlistID, songID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddPlaylistSong(int playlistID, int songID, EGameMode gameMode)
|
public void AddSong(int playlistID, int songID, EGameMode gameMode)
|
||||||
{
|
{
|
||||||
CPlaylists.AddPlaylistSong(playlistID, songID, gameMode);
|
CPlaylists.AddSong(playlistID, songID, gameMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InsertPlaylistSong(int playlistID, int positionIndex, int songID, EGameMode gameMode)
|
public void InsertSong(int playlistID, int positionIndex, int songID, EGameMode gameMode)
|
||||||
{
|
{
|
||||||
CPlaylists.InsertPlaylistSong(playlistID, positionIndex, songID, gameMode);
|
CPlaylists.InsertSong(playlistID, positionIndex, songID, gameMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MovePlaylistSong(int playlistID, int sourceIndex, int destIndex)
|
public void MoveSong(int playlistID, int sourceIndex, int destIndex)
|
||||||
{
|
{
|
||||||
CPlaylists.MovePlaylistSong(playlistID, sourceIndex, destIndex);
|
CPlaylists.MoveSong(playlistID, sourceIndex, destIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MovePlaylistSongDown(int playlistID, int songIndex)
|
public void MoveSongDown(int playlistID, int songIndex)
|
||||||
{
|
{
|
||||||
CPlaylists.MovePlaylistSongDown(playlistID, songIndex);
|
CPlaylists.MovePSongDown(playlistID, songIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MovePlaylistSongUp(int playlistID, int songIndex)
|
public void MoveSongUp(int playlistID, int songIndex)
|
||||||
{
|
{
|
||||||
CPlaylists.MovePlaylistSongUp(playlistID, songIndex);
|
CPlaylists.MoveSongUp(playlistID, songIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeletePlaylistSong(int playlistID, int songIndex)
|
public void DeleteSong(int playlistID, int songIndex)
|
||||||
{
|
{
|
||||||
CPlaylists.DeletePlaylistSong(playlistID, songIndex);
|
CPlaylists.DeleteSong(playlistID, songIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetPlaylistSongCount(int playlistID)
|
public int GetSongCount(int playlistID)
|
||||||
{
|
{
|
||||||
return CPlaylists.GetPlaylistSongCount(playlistID);
|
return CPlaylists.GetSongCount(playlistID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CPlaylistSong GetPlaylistSong(int playlistID, int songIndex)
|
public CPlaylistSong GetSong(int playlistID, int songIndex)
|
||||||
{
|
{
|
||||||
return CPlaylists.GetPlaylistSong(playlistID, songIndex);
|
return CPlaylists.GetSong(playlistID, songIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+80
-93
@@ -31,13 +31,14 @@ namespace Vocaluxe.Base
|
|||||||
static class CPlaylists
|
static class CPlaylists
|
||||||
{
|
{
|
||||||
private static List<CPlaylistFile> _Playlists;
|
private static List<CPlaylistFile> _Playlists;
|
||||||
|
private static int _NextID;
|
||||||
|
|
||||||
public static CPlaylistFile[] Playlists
|
public static IEnumerable<CPlaylistFile> Playlists
|
||||||
{
|
{
|
||||||
get { return _Playlists.ToArray(); }
|
get { return _Playlists.AsReadOnly(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<string> PlaylistNames
|
public static List<string> Names
|
||||||
{
|
{
|
||||||
get { return _Playlists.Select(t => t.Name).ToList(); }
|
get { return _Playlists.Select(t => t.Name).ToList(); }
|
||||||
}
|
}
|
||||||
@@ -49,10 +50,10 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
LoadPlaylists();
|
Load();
|
||||||
_ConvertUSDXPlaylists();
|
_ConvertUSDXPlaylists();
|
||||||
|
|
||||||
_SortPlaylistsByName();
|
_SortByName();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void _ConvertUSDXPlaylists()
|
private static void _ConvertUSDXPlaylists()
|
||||||
@@ -63,12 +64,12 @@ namespace Vocaluxe.Base
|
|||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
{
|
{
|
||||||
CPlaylistFile playlist = _ConvertUSDXPlaylist(file);
|
CPlaylistFile playlist = _ConvertUSDXPlaylist(file);
|
||||||
playlist.SavePlaylist();
|
playlist.Save();
|
||||||
_Playlists.Add(playlist);
|
_Playlists.Add(playlist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LoadPlaylists()
|
public static void Load()
|
||||||
{
|
{
|
||||||
_Playlists = new List<CPlaylistFile>();
|
_Playlists = new List<CPlaylistFile>();
|
||||||
|
|
||||||
@@ -77,148 +78,141 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
{
|
{
|
||||||
CPlaylistFile playlist = new CPlaylistFile(file, files.IndexOf(file));
|
CPlaylistFile playlist = new CPlaylistFile(files.IndexOf(file), file);
|
||||||
_Playlists.Add(playlist);
|
_Playlists.Add(playlist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetPlaylistName(int playlistID)
|
public static CPlaylistFile Get(int playlistID)
|
||||||
{
|
{
|
||||||
if (playlistID >= _Playlists.Count || playlistID < 0)
|
return _Playlists.FirstOrDefault(pl => pl.Id == playlistID);
|
||||||
return "Error: Can't find Playlist";
|
|
||||||
|
|
||||||
return _Playlists[playlistID].Name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetPlaylistName(int playlistID, string name)
|
public static string GetName(int playlistID)
|
||||||
{
|
{
|
||||||
if (playlistID >= _Playlists.Count || playlistID < 0)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
return;
|
return pl == null ? "Error: Can't find Playlist" : pl.Name;
|
||||||
|
|
||||||
_Playlists[playlistID].Name = name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DeletePlaylist(int playlistID)
|
public static void SetName(int playlistID, string name)
|
||||||
{
|
{
|
||||||
if (playlistID < 0 || playlistID >= _Playlists.Count)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
|
|
||||||
|
if (pl != null)
|
||||||
|
pl.Name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Delete(int playlistID)
|
||||||
|
{
|
||||||
|
CPlaylistFile pl = Get(playlistID);
|
||||||
|
if (pl == null)
|
||||||
return;
|
return;
|
||||||
if (_Playlists[playlistID].File != "")
|
if (pl.File != "" && File.Exists(pl.File))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File.Delete(_Playlists[playlistID].File);
|
File.Delete(pl.File);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
CLog.LogError("Can't delete Playlist File " + _Playlists[playlistID].File + ".xml");
|
CLog.LogError("Can't delete Playlist File " + _Playlists[playlistID].File + ".xml");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_Playlists.RemoveAt(playlistID);
|
_Playlists.Remove(pl);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SavePlaylist(int playlistID)
|
public static void Save(int playlistID)
|
||||||
{
|
{
|
||||||
if (playlistID < 0 || playlistID >= _Playlists.Count)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
return;
|
if (pl != null)
|
||||||
_Playlists[playlistID].SavePlaylist();
|
pl.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int NewPlaylist()
|
public static int NewPlaylist(string name = "New Playlist")
|
||||||
{
|
{
|
||||||
CPlaylistFile pl = new CPlaylistFile {Name = "New Playlist", Id = _Playlists.Count};
|
CPlaylistFile pl = new CPlaylistFile(_NextID++) {Name = name};
|
||||||
_Playlists.Add(pl);
|
_Playlists.Add(pl);
|
||||||
return _Playlists.Count - 1;
|
return pl.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddPlaylistSong(int playlistID, int songID)
|
public static void AddSong(int playlistID, int songID)
|
||||||
{
|
{
|
||||||
if (playlistID >= _Playlists.Count || playlistID < 0)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
return;
|
if (pl != null)
|
||||||
|
pl.AddSong(songID);
|
||||||
_Playlists[playlistID].AddSong(songID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddPlaylistSong(int playlistID, int songID, EGameMode gameMode)
|
public static void AddSong(int playlistID, int songID, EGameMode gameMode)
|
||||||
{
|
{
|
||||||
if (playlistID >= _Playlists.Count || playlistID < 0)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
return;
|
if (pl != null)
|
||||||
|
pl.AddSong(songID, gameMode);
|
||||||
_Playlists[playlistID].AddSong(songID, gameMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void InsertPlaylistSong(int playlistID, int positionIndex, int songID, EGameMode gameMode)
|
public static void InsertSong(int playlistID, int positionIndex, int songID, EGameMode gameMode)
|
||||||
{
|
{
|
||||||
if (playlistID >= _Playlists.Count || playlistID < 0)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
return;
|
if (pl != null)
|
||||||
|
pl.InsertSong(positionIndex, songID, gameMode);
|
||||||
_Playlists[playlistID].SongInsert(positionIndex, songID, gameMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void MovePlaylistSong(int playlistID, int sourceIndex, int destIndex)
|
public static void MoveSong(int playlistID, int sourceIndex, int destIndex)
|
||||||
{
|
{
|
||||||
if (playlistID >= _Playlists.Count || playlistID < 0)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
return;
|
if (pl != null)
|
||||||
|
pl.MoveSong(sourceIndex, destIndex);
|
||||||
_Playlists[playlistID].SongMove(sourceIndex, destIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void MovePlaylistSongDown(int playlistID, int songIndex)
|
public static void MovePSongDown(int playlistID, int songIndex)
|
||||||
{
|
{
|
||||||
if (playlistID >= _Playlists.Count || playlistID < 0)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
return;
|
if (pl != null)
|
||||||
|
pl.MoveSongDown(songIndex);
|
||||||
_Playlists[playlistID].SongDown(songIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void MovePlaylistSongUp(int playlistID, int songIndex)
|
public static void MoveSongUp(int playlistID, int songIndex)
|
||||||
{
|
{
|
||||||
if (playlistID >= _Playlists.Count || playlistID < 0)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
return;
|
if (pl != null)
|
||||||
|
pl.MoveSongUp(songIndex);
|
||||||
_Playlists[playlistID].SongUp(songIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DeletePlaylistSong(int playlistID, int songIndex)
|
public static void DeleteSong(int playlistID, int songIndex)
|
||||||
{
|
{
|
||||||
if (playlistID >= _Playlists.Count || playlistID < 0)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
return;
|
if (pl != null)
|
||||||
|
pl.DeleteSong(songIndex);
|
||||||
_Playlists[playlistID].DeleteSong(songIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetPlaylistSongCount(int playlistID)
|
public static int GetSongCount(int playlistID)
|
||||||
{
|
{
|
||||||
if (playlistID >= _Playlists.Count || playlistID < 0)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
return 0;
|
return pl != null ? pl.Songs.Count : -1;
|
||||||
|
|
||||||
return _Playlists[playlistID].Songs.Count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CPlaylistSong GetPlaylistSong(int playlistID, int songIndex)
|
public static CPlaylistSong GetSong(int playlistID, int songIndex)
|
||||||
{
|
{
|
||||||
if (playlistID >= _Playlists.Count || playlistID < 0)
|
CPlaylistFile pl = Get(playlistID);
|
||||||
|
if (pl == null || songIndex >= pl.Songs.Count)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (songIndex >= _Playlists[playlistID].Songs.Count)
|
return pl.Songs[songIndex];
|
||||||
return null;
|
|
||||||
|
|
||||||
return _Playlists[playlistID].Songs[songIndex];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region private methods
|
#region private methods
|
||||||
private static void _SortPlaylistsByName()
|
private static void _SortByName()
|
||||||
{
|
{
|
||||||
_Playlists.Sort(_CompareByPlaylistName);
|
_Playlists.Sort(_CompareByName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int _CompareByPlaylistName(CPlaylistFile a, CPlaylistFile b)
|
private static int _CompareByName(CPlaylistFile a, CPlaylistFile b)
|
||||||
{
|
{
|
||||||
return String.CompareOrdinal(a.Name, b.Name);
|
return String.CompareOrdinal(a.Name, b.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CPlaylistFile _ConvertUSDXPlaylist(string file)
|
private static CPlaylistFile _ConvertUSDXPlaylist(string file)
|
||||||
{
|
{
|
||||||
var pl = new CPlaylistFile();
|
var pl = new CPlaylistFile(_NextID++);
|
||||||
ReadOnlyCollection<CSong> allSongs = CSongs.AllSongs;
|
ReadOnlyCollection<CSong> allSongs = CSongs.AllSongs;
|
||||||
|
|
||||||
if (!File.Exists(file))
|
if (!File.Exists(file))
|
||||||
@@ -234,30 +228,23 @@ namespace Vocaluxe.Base
|
|||||||
int pos = line.IndexOf(":", StringComparison.Ordinal);
|
int pos = line.IndexOf(":", StringComparison.Ordinal);
|
||||||
if (pos <= 0)
|
if (pos <= 0)
|
||||||
continue;
|
continue;
|
||||||
//Name or comment
|
|
||||||
if (line[0] == '#')
|
if (line[0] == '#')
|
||||||
{
|
{
|
||||||
|
//Name or comment
|
||||||
string identifier = line.Substring(1, pos - 1).Trim();
|
string identifier = line.Substring(1, pos - 1).Trim();
|
||||||
string value = line.Substring(pos + 1, line.Length - pos - 1).Trim();
|
string value = line.Substring(pos + 1, line.Length - pos - 1).Trim();
|
||||||
if (identifier.ToUpper() == "NAME")
|
if (identifier.ToUpper() == "NAME")
|
||||||
pl.Name = value;
|
pl.Name = value;
|
||||||
}
|
}
|
||||||
//Song
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//Song
|
||||||
string artist = line.Substring(0, pos - 1).Trim();
|
string artist = line.Substring(0, pos - 1).Trim();
|
||||||
string title = line.Substring(pos + 1, line.Length - pos - 1).Trim();
|
string title = line.Substring(pos + 1, line.Length - pos - 1).Trim();
|
||||||
bool found = false;
|
CSong plSong = allSongs.FirstOrDefault(song => song.Artist == artist && song.Title == title);
|
||||||
foreach (CSong song in allSongs)
|
if (plSong != null)
|
||||||
{
|
pl.AddSong(plSong.ID);
|
||||||
if (song.Artist == artist && song.Title == title)
|
else
|
||||||
{
|
|
||||||
pl.AddSong(song.ID);
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!found)
|
|
||||||
CLog.LogError("Can't find song '" + title + "' from '" + artist + "' in playlist file: " + file);
|
CLog.LogError("Can't find song '" + title + "' from '" + artist + "' in playlist file: " + file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -461,20 +461,20 @@ namespace Vocaluxe.Base.Server
|
|||||||
|
|
||||||
private static SPlaylistInfo _GetPlaylist(int playlistId)
|
private static SPlaylistInfo _GetPlaylist(int playlistId)
|
||||||
{
|
{
|
||||||
if (CPlaylists.Playlists.Length <= playlistId || playlistId < 0)
|
if (CPlaylists.Get(playlistId) == null)
|
||||||
throw new ArgumentException("invalid playlistId");
|
throw new ArgumentException("invalid playlistId");
|
||||||
return _GetPlaylistInfo(CPlaylists.Playlists[playlistId]);
|
return _GetPlaylistInfo(CPlaylists.Get(playlistId));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void _AddSongToPlaylist(int songId, int playlistId, bool allowDuplicates)
|
private static void _AddSongToPlaylist(int songId, int playlistId, bool allowDuplicates)
|
||||||
{
|
{
|
||||||
if (CPlaylists.Playlists.Length <= playlistId || playlistId < 0)
|
if (CPlaylists.Get(playlistId) == null)
|
||||||
throw new ArgumentException("invalid playlistId");
|
throw new ArgumentException("invalid playlistId");
|
||||||
|
|
||||||
if (allowDuplicates || !_PlaylistContainsSong(songId, playlistId))
|
if (allowDuplicates || !_PlaylistContainsSong(songId, playlistId))
|
||||||
{
|
{
|
||||||
CPlaylists.AddPlaylistSong(playlistId, songId);
|
CPlaylists.AddSong(playlistId, songId);
|
||||||
CPlaylists.SavePlaylist(playlistId);
|
CPlaylists.Save(playlistId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw new ArgumentException("song exists in this playlist");
|
throw new ArgumentException("song exists in this playlist");
|
||||||
@@ -482,45 +482,49 @@ namespace Vocaluxe.Base.Server
|
|||||||
|
|
||||||
private static void _RemoveSongFromPlaylist(int position, int playlistId, int songId)
|
private static void _RemoveSongFromPlaylist(int position, int playlistId, int songId)
|
||||||
{
|
{
|
||||||
if (CPlaylists.Playlists.Length <= playlistId || playlistId < 0)
|
CPlaylistFile pl = CPlaylists.Get(playlistId);
|
||||||
|
if (pl == null)
|
||||||
throw new ArgumentException("invalid playlistId");
|
throw new ArgumentException("invalid playlistId");
|
||||||
if (!_PlaylistContainsSong(songId, playlistId))
|
if (!_PlaylistContainsSong(songId, playlistId))
|
||||||
throw new ArgumentException("invalid songId");
|
throw new ArgumentException("invalid songId");
|
||||||
if (position < 0 || CPlaylists.Playlists[playlistId].Songs.Count <= position
|
if (position < 0 || pl.Songs.Count <= position
|
||||||
|| CPlaylists.Playlists[playlistId].Songs[position].SongID != songId)
|
|| pl.Songs[position].SongID != songId)
|
||||||
throw new ArgumentException("invalid position");
|
throw new ArgumentException("invalid position");
|
||||||
CPlaylists.Playlists[playlistId].DeleteSong(position);
|
pl.DeleteSong(position);
|
||||||
CPlaylists.SavePlaylist(playlistId);
|
pl.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void _MoveSongInPlaylist(int newPosition, int playlistId, int songId)
|
private static void _MoveSongInPlaylist(int newPosition, int playlistId, int songId)
|
||||||
{
|
{
|
||||||
if (CPlaylists.Playlists.Length <= playlistId || playlistId < 0)
|
CPlaylistFile pl = CPlaylists.Get(playlistId);
|
||||||
|
if (pl == null)
|
||||||
throw new ArgumentException("invalid playlistId");
|
throw new ArgumentException("invalid playlistId");
|
||||||
if (!_PlaylistContainsSong(songId, playlistId))
|
if (!_PlaylistContainsSong(songId, playlistId))
|
||||||
throw new ArgumentException("invalid songId");
|
throw new ArgumentException("invalid songId");
|
||||||
|
|
||||||
if (CPlaylists.Playlists[playlistId].Songs.Count < newPosition)
|
if (pl.Songs.Count < newPosition)
|
||||||
throw new ArgumentException("invalid newPosition");
|
throw new ArgumentException("invalid newPosition");
|
||||||
|
|
||||||
int oldPosition = CPlaylists.Playlists[playlistId].Songs.FindIndex(s => s.SongID == songId);
|
int oldPosition = pl.Songs.FindIndex(s => s.SongID == songId);
|
||||||
CPlaylists.MovePlaylistSong(playlistId, oldPosition, newPosition);
|
pl.MoveSong(oldPosition, newPosition);
|
||||||
CPlaylists.SavePlaylist(playlistId);
|
pl.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool _PlaylistContainsSong(int songId, int playlistId)
|
private static bool _PlaylistContainsSong(int songId, int playlistId)
|
||||||
{
|
{
|
||||||
if (CPlaylists.Playlists.Length <= playlistId || playlistId < 0)
|
CPlaylistFile pl = CPlaylists.Get(playlistId);
|
||||||
|
if (pl == null)
|
||||||
throw new ArgumentException("invalid playlistId");
|
throw new ArgumentException("invalid playlistId");
|
||||||
return CPlaylists.Playlists[playlistId].Songs.Any(s => s.SongID == songId);
|
return pl.Songs.Any(s => s.SongID == songId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SPlaylistSongInfo[] _GetPlaylistSongs(int playlistId)
|
private static SPlaylistSongInfo[] _GetPlaylistSongs(int playlistId)
|
||||||
{
|
{
|
||||||
if (CPlaylists.Playlists.Length <= playlistId || playlistId < 0)
|
CPlaylistFile pl = CPlaylists.Get(playlistId);
|
||||||
|
if (pl == null)
|
||||||
throw new ArgumentException("invalid playlistId");
|
throw new ArgumentException("invalid playlistId");
|
||||||
|
|
||||||
return _GetPlaylistSongInfos(CPlaylists.Playlists[playlistId]);
|
return _GetPlaylistSongInfos(pl);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SPlaylistSongInfo _GetPlaylistSongInfo(CPlaylistSong playlistSong, int playlistId, int playlistPos)
|
private static SPlaylistSongInfo _GetPlaylistSongInfo(CPlaylistSong playlistSong, int playlistId, int playlistPos)
|
||||||
@@ -557,16 +561,15 @@ namespace Vocaluxe.Base.Server
|
|||||||
|
|
||||||
private static void _RemovePlaylist(int playlistId)
|
private static void _RemovePlaylist(int playlistId)
|
||||||
{
|
{
|
||||||
if (CPlaylists.Playlists.Length <= playlistId || playlistId < 0)
|
if (CPlaylists.Get(playlistId) == null)
|
||||||
throw new ArgumentException("invalid playlistId");
|
throw new ArgumentException("invalid playlistId");
|
||||||
CPlaylists.DeletePlaylist(playlistId);
|
CPlaylists.Delete(playlistId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int _AddPlaylist(string playlistName)
|
private static int _AddPlaylist(string playlistName)
|
||||||
{
|
{
|
||||||
int newPlaylistId = CPlaylists.NewPlaylist();
|
int newPlaylistId = CPlaylists.NewPlaylist(playlistName);
|
||||||
CPlaylists.Playlists[newPlaylistId].Name = playlistName;
|
CPlaylists.Save(newPlaylistId);
|
||||||
CPlaylists.SavePlaylist(newPlaylistId);
|
|
||||||
|
|
||||||
return newPlaylistId;
|
return newPlaylistId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Vocaluxe.Base;
|
using Vocaluxe.Base;
|
||||||
using VocaluxeLib;
|
using VocaluxeLib;
|
||||||
@@ -28,25 +29,20 @@ namespace Vocaluxe.Lib.Playlist
|
|||||||
{
|
{
|
||||||
public class CPlaylistFile
|
public class CPlaylistFile
|
||||||
{
|
{
|
||||||
public string Name;
|
public string Name = "";
|
||||||
public string File;
|
public string File;
|
||||||
public int Id = -1;
|
public readonly int Id = -1;
|
||||||
public List<CPlaylistSong> Songs = new List<CPlaylistSong>();
|
public List<CPlaylistSong> Songs = new List<CPlaylistSong>();
|
||||||
|
|
||||||
public CPlaylistFile()
|
public CPlaylistFile(int id, string file = "")
|
||||||
{
|
|
||||||
Name = string.Empty;
|
|
||||||
File = string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CPlaylistFile(string file, int id)
|
|
||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
File = file;
|
File = file;
|
||||||
_LoadPlaylist();
|
if (File != "")
|
||||||
|
_Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SavePlaylist()
|
public void Save()
|
||||||
{
|
{
|
||||||
if (File == "")
|
if (File == "")
|
||||||
{
|
{
|
||||||
@@ -113,43 +109,34 @@ namespace Vocaluxe.Lib.Playlist
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _LoadPlaylist()
|
private void _Load()
|
||||||
{
|
{
|
||||||
CXMLReader xmlReader = CXMLReader.OpenFile(File);
|
CXMLReader xmlReader = CXMLReader.OpenFile(File);
|
||||||
if (xmlReader == null)
|
if (xmlReader == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string value = String.Empty;
|
string value;
|
||||||
if (xmlReader.GetValue("//root/Info/PlaylistName", out value, value))
|
if (xmlReader.GetValue("//root/Info/PlaylistName", out value, ""))
|
||||||
{
|
{
|
||||||
Name = value;
|
Name = value;
|
||||||
|
|
||||||
Songs = new List<CPlaylistSong>();
|
Songs = new List<CPlaylistSong>();
|
||||||
|
|
||||||
List<string> songs = xmlReader.GetValues("Songs");
|
List<string> songs = xmlReader.GetValues("Songs");
|
||||||
var gm = EGameMode.TR_GAMEMODE_NORMAL;
|
|
||||||
|
|
||||||
foreach (string song in songs)
|
foreach (string songEntry in songs)
|
||||||
{
|
{
|
||||||
string artist;
|
string artist;
|
||||||
string title;
|
string title;
|
||||||
xmlReader.GetValue("//root/Songs/" + song + "/Artist", out artist, String.Empty);
|
xmlReader.GetValue("//root/Songs/" + songEntry + "/Artist", out artist, String.Empty);
|
||||||
xmlReader.GetValue("//root/Songs/" + song + "/Title", out title, String.Empty);
|
xmlReader.GetValue("//root/Songs/" + songEntry + "/Title", out title, String.Empty);
|
||||||
xmlReader.TryGetEnumValue("//root/Songs/" + song + "/GameMode", ref gm);
|
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||||
|
xmlReader.TryGetEnumValue("//root/Songs/" + songEntry + "/GameMode", ref gm);
|
||||||
|
|
||||||
var playlistSong = new CPlaylistSong {SongID = -1};
|
CSong plSong = CSongs.AllSongs.FirstOrDefault(song => song.Artist == artist && song.Title == title);
|
||||||
|
if (plSong != null)
|
||||||
foreach (CSong curSong in CSongs.AllSongs)
|
|
||||||
{
|
{
|
||||||
if (curSong.Artist != artist || curSong.Title != title)
|
var playlistSong = new CPlaylistSong(plSong.ID, gm);
|
||||||
continue;
|
|
||||||
playlistSong.SongID = curSong.ID;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (playlistSong.SongID != -1)
|
|
||||||
{
|
|
||||||
playlistSong.GameMode = gm;
|
|
||||||
Songs.Add(playlistSong);
|
Songs.Add(playlistSong);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -173,7 +160,7 @@ namespace Vocaluxe.Lib.Playlist
|
|||||||
|
|
||||||
public void AddSong(int songID, EGameMode gm)
|
public void AddSong(int songID, EGameMode gm)
|
||||||
{
|
{
|
||||||
var song = new CPlaylistSong {SongID = songID, GameMode = gm};
|
var song = new CPlaylistSong(songID, gm);
|
||||||
|
|
||||||
Songs.Add(song);
|
Songs.Add(song);
|
||||||
}
|
}
|
||||||
@@ -183,31 +170,31 @@ namespace Vocaluxe.Lib.Playlist
|
|||||||
Songs.RemoveAt(songNr);
|
Songs.RemoveAt(songNr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SongUp(int songNr)
|
public void MoveSongUp(int songNr)
|
||||||
{
|
{
|
||||||
if (songNr < Songs.Count - 1 && songNr > 0)
|
if (songNr < Songs.Count && songNr > 0)
|
||||||
Songs.Reverse(songNr - 1, 2);
|
Songs.Reverse(songNr - 1, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SongDown(int songNr)
|
public void MoveSongDown(int songNr)
|
||||||
{
|
{
|
||||||
if (songNr < Songs.Count - 1 && songNr >= 0)
|
if (songNr < Songs.Count - 1 && songNr >= 0)
|
||||||
Songs.Reverse(songNr, 2);
|
Songs.Reverse(songNr, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SongMove(int sourceNr, int destNr)
|
public void MoveSong(int sourceNr, int destNr)
|
||||||
{
|
{
|
||||||
if (sourceNr < 0 || destNr < 0 || sourceNr == destNr || sourceNr > Songs.Count - 1 || destNr > Songs.Count - 1)
|
if (sourceNr < 0 || destNr < 0 || sourceNr == destNr || sourceNr >= Songs.Count || destNr >= Songs.Count)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var ps = new CPlaylistSong(Songs[sourceNr]);
|
CPlaylistSong song = Songs[sourceNr];
|
||||||
Songs.RemoveAt(sourceNr);
|
Songs.RemoveAt(sourceNr);
|
||||||
Songs.Insert(destNr, ps);
|
Songs.Insert(destNr, song);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SongInsert(int destNr, int songID, EGameMode gm)
|
public void InsertSong(int destNr, int songID, EGameMode gm)
|
||||||
{
|
{
|
||||||
if (destNr < 0 || destNr > Songs.Count - 1)
|
if (destNr < 0 || destNr >= Songs.Count)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CPlaylistSong ps = new CPlaylistSong(songID, gm);
|
CPlaylistSong ps = new CPlaylistSong(songID, gm);
|
||||||
|
|||||||
@@ -1265,9 +1265,8 @@ namespace Vocaluxe.Screens
|
|||||||
|
|
||||||
private void _OpenPlaylist(int playlistID)
|
private void _OpenPlaylist(int playlistID)
|
||||||
{
|
{
|
||||||
if (CPlaylists.Playlists.Length > playlistID && playlistID >= 0)
|
if (_Playlist.LoadPlaylist(playlistID))
|
||||||
{
|
{
|
||||||
_Playlist.LoadPlaylist(playlistID);
|
|
||||||
_SongMenu.SmallView = true;
|
_SongMenu.SmallView = true;
|
||||||
_Playlist.Visible = true;
|
_Playlist.Visible = true;
|
||||||
}
|
}
|
||||||
@@ -1289,17 +1288,17 @@ namespace Vocaluxe.Screens
|
|||||||
{
|
{
|
||||||
_SelectSlides[_SelectSlideOptionsPlaylistAdd].Clear();
|
_SelectSlides[_SelectSlideOptionsPlaylistAdd].Clear();
|
||||||
_SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValue("TR_SCREENSONG_NEWPLAYLIST");
|
_SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValue("TR_SCREENSONG_NEWPLAYLIST");
|
||||||
_SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValues(CPlaylists.PlaylistNames);
|
_SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValues(CPlaylists.Names);
|
||||||
_SelectSlides[_SelectSlideOptionsPlaylistOpen].Clear();
|
_SelectSlides[_SelectSlideOptionsPlaylistOpen].Clear();
|
||||||
_SelectSlides[_SelectSlideOptionsPlaylistOpen].AddValues(CPlaylists.PlaylistNames);
|
_SelectSlides[_SelectSlideOptionsPlaylistOpen].AddValues(CPlaylists.Names);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _OpenAndAddPlaylistAction()
|
private void _OpenAndAddPlaylistAction()
|
||||||
{
|
{
|
||||||
//Open an existing playlist and add song
|
|
||||||
if (_Playlist.ActivePlaylistID != (_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) &&
|
if (_Playlist.ActivePlaylistID != (_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) &&
|
||||||
(_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) != -1)
|
(_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) != -1)
|
||||||
{
|
{
|
||||||
|
//Open an existing playlist and add song
|
||||||
//Check selected game-mode
|
//Check selected game-mode
|
||||||
EGameMode gm;
|
EGameMode gm;
|
||||||
if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection)
|
if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection)
|
||||||
@@ -1315,7 +1314,7 @@ namespace Vocaluxe.Screens
|
|||||||
_Playlist.ActivePlaylistID = _SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1;
|
_Playlist.ActivePlaylistID = _SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1;
|
||||||
|
|
||||||
//Add song to playlist
|
//Add song to playlist
|
||||||
CPlaylists.Playlists[_Playlist.ActivePlaylistID].AddSong(CSongs.VisibleSongs[_SongMenu.GetPreviewSongNr()].ID, gm);
|
CPlaylists.AddSong(_Playlist.ActivePlaylistID, CSongs.VisibleSongs[_SongMenu.GetPreviewSongNr()].ID, gm);
|
||||||
|
|
||||||
//Open playlist
|
//Open playlist
|
||||||
_OpenPlaylist(_Playlist.ActivePlaylistID);
|
_OpenPlaylist(_Playlist.ActivePlaylistID);
|
||||||
@@ -1323,9 +1322,9 @@ namespace Vocaluxe.Screens
|
|||||||
_Playlist.ScrollToBottom();
|
_Playlist.ScrollToBottom();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Create a new playlist and add song
|
|
||||||
else if ((_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) == -1)
|
else if ((_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) == -1)
|
||||||
{
|
{
|
||||||
|
//Create a new playlist and add song
|
||||||
//Check selected game-mode
|
//Check selected game-mode
|
||||||
EGameMode gm;
|
EGameMode gm;
|
||||||
if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection)
|
if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection)
|
||||||
@@ -1339,18 +1338,18 @@ namespace Vocaluxe.Screens
|
|||||||
_Playlist.ActivePlaylistID = CPlaylists.NewPlaylist();
|
_Playlist.ActivePlaylistID = CPlaylists.NewPlaylist();
|
||||||
|
|
||||||
//Add song to playlist
|
//Add song to playlist
|
||||||
CPlaylists.Playlists[_Playlist.ActivePlaylistID].AddSong(CSongs.VisibleSongs[_SongMenu.GetPreviewSongNr()].ID, gm);
|
CPlaylists.AddSong(_Playlist.ActivePlaylistID, CSongs.VisibleSongs[_SongMenu.GetPreviewSongNr()].ID, gm);
|
||||||
|
|
||||||
//Open playlist
|
//Open playlist
|
||||||
_OpenPlaylist(_Playlist.ActivePlaylistID);
|
_OpenPlaylist(_Playlist.ActivePlaylistID);
|
||||||
|
|
||||||
//Add new playlist to select-slide
|
//Add new playlist to select-slide
|
||||||
_SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValue(CPlaylists.Playlists[_Playlist.ActivePlaylistID].Name);
|
_SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValue(CPlaylists.GetName(_Playlist.ActivePlaylistID));
|
||||||
_SelectSlides[_SelectSlideOptionsPlaylistOpen].AddValue(CPlaylists.Playlists[_Playlist.ActivePlaylistID].Name);
|
_SelectSlides[_SelectSlideOptionsPlaylistOpen].AddValue(CPlaylists.GetName(_Playlist.ActivePlaylistID));
|
||||||
}
|
}
|
||||||
//Add song to loaded playlist
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//Add song to loaded playlist
|
||||||
//Check selected game-mode
|
//Check selected game-mode
|
||||||
EGameMode gm;
|
EGameMode gm;
|
||||||
if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection)
|
if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection)
|
||||||
@@ -1359,7 +1358,7 @@ namespace Vocaluxe.Screens
|
|||||||
gm = EGameMode.TR_GAMEMODE_DUET;
|
gm = EGameMode.TR_GAMEMODE_DUET;
|
||||||
else
|
else
|
||||||
gm = EGameMode.TR_GAMEMODE_NORMAL;
|
gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||||
CPlaylists.Playlists[_Playlist.ActivePlaylistID].AddSong(CSongs.VisibleSongs[_SongMenu.GetPreviewSongNr()].ID, gm);
|
CPlaylists.AddSong(_Playlist.ActivePlaylistID, CSongs.VisibleSongs[_SongMenu.GetPreviewSongNr()].ID, gm);
|
||||||
_Playlist.UpdatePlaylist();
|
_Playlist.UpdatePlaylist();
|
||||||
_Playlist.ScrollToBottom();
|
_Playlist.ScrollToBottom();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,10 +62,7 @@ namespace VocaluxeLib
|
|||||||
{
|
{
|
||||||
string val;
|
string val;
|
||||||
if (GetValue(cast, out val, Enum.GetName(typeof(T), value)))
|
if (GetValue(cast, out val, Enum.GetName(typeof(T), value)))
|
||||||
{
|
return CHelper.TryParse(val, out value, true);
|
||||||
CHelper.TryParse(val, out value, true);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-14
@@ -290,24 +290,25 @@ namespace VocaluxeLib
|
|||||||
|
|
||||||
public interface IPlaylist
|
public interface IPlaylist
|
||||||
{
|
{
|
||||||
string GetPlaylistName(int playlistID);
|
bool Exists(int playlistID);
|
||||||
List<string> GetPlaylistNames();
|
string GetName(int playlistID);
|
||||||
|
List<string> GetNames();
|
||||||
|
|
||||||
void SetPlaylistName(int playlistID, string name);
|
void SetName(int playlistID, string name);
|
||||||
void DeletePlaylist(int playlistID);
|
void Delete(int playlistID);
|
||||||
void SavePlaylist(int playlistID);
|
void Save(int playlistID);
|
||||||
int GetNumPlaylists();
|
int GetNumPlaylists();
|
||||||
|
|
||||||
void AddPlaylistSong(int playlistID, int songID);
|
void AddSong(int playlistID, int songID);
|
||||||
void AddPlaylistSong(int playlistID, int songID, EGameMode gameMode);
|
void AddSong(int playlistID, int songID, EGameMode gameMode);
|
||||||
void InsertPlaylistSong(int playlistID, int positionIndex, int songID, EGameMode gameMode);
|
void InsertSong(int playlistID, int positionIndex, int songID, EGameMode gameMode);
|
||||||
|
|
||||||
void MovePlaylistSong(int playlistID, int sourceIndex, int destIndex);
|
void MoveSong(int playlistID, int sourceIndex, int destIndex);
|
||||||
void MovePlaylistSongDown(int playlistID, int songIndex);
|
void MoveSongDown(int playlistID, int songIndex);
|
||||||
void MovePlaylistSongUp(int playlistID, int songIndex);
|
void MoveSongUp(int playlistID, int songIndex);
|
||||||
void DeletePlaylistSong(int playlistID, int songIndex);
|
void DeleteSong(int playlistID, int songIndex);
|
||||||
|
|
||||||
int GetPlaylistSongCount(int playlistID);
|
int GetSongCount(int playlistID);
|
||||||
CPlaylistSong GetPlaylistSong(int playlistID, int songIndex);
|
CPlaylistSong GetSong(int playlistID, int songIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,7 +176,7 @@ namespace VocaluxeLib.Menu
|
|||||||
{
|
{
|
||||||
if (EditMode == EEditMode.ChangeOrder && _ChangeOrderSource != -1 && _PlaylistElements.Count > _ChangeOrderSource)
|
if (EditMode == EEditMode.ChangeOrder && _ChangeOrderSource != -1 && _PlaylistElements.Count > _ChangeOrderSource)
|
||||||
{
|
{
|
||||||
CBase.Playlist.DeletePlaylistSong(ActivePlaylistID, _PlaylistElements[_ChangeOrderSource].Content);
|
CBase.Playlist.DeleteSong(ActivePlaylistID, _PlaylistElements[_ChangeOrderSource].Content);
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
}
|
}
|
||||||
_ChangeOrderSource = -1;
|
_ChangeOrderSource = -1;
|
||||||
@@ -503,13 +503,13 @@ namespace VocaluxeLib.Menu
|
|||||||
switch (keyEvent.Key)
|
switch (keyEvent.Key)
|
||||||
{
|
{
|
||||||
case Keys.Enter:
|
case Keys.Enter:
|
||||||
CBase.Playlist.SetPlaylistName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text);
|
CBase.Playlist.SetName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text);
|
||||||
CBase.Playlist.SavePlaylist(ActivePlaylistID);
|
CBase.Playlist.Save(ActivePlaylistID);
|
||||||
EditMode = EEditMode.None;
|
EditMode = EEditMode.None;
|
||||||
_Theme.ButtonPlaylistName.EditMode = false;
|
_Theme.ButtonPlaylistName.EditMode = false;
|
||||||
break;
|
break;
|
||||||
case Keys.Escape:
|
case Keys.Escape:
|
||||||
_Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetPlaylistName(ActivePlaylistID);
|
_Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetName(ActivePlaylistID);
|
||||||
EditMode = EEditMode.None;
|
EditMode = EEditMode.None;
|
||||||
_Theme.ButtonPlaylistName.EditMode = false;
|
_Theme.ButtonPlaylistName.EditMode = false;
|
||||||
break;
|
break;
|
||||||
@@ -600,7 +600,7 @@ namespace VocaluxeLib.Menu
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Keys.Delete:
|
case Keys.Delete:
|
||||||
CBase.Playlist.DeletePlaylistSong(ActivePlaylistID, _PlaylistElements[CurrentPlaylistElement].Content);
|
CBase.Playlist.DeleteSong(ActivePlaylistID, _PlaylistElements[CurrentPlaylistElement].Content);
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
|
|
||||||
if (Offset > 0)
|
if (Offset > 0)
|
||||||
@@ -626,7 +626,7 @@ namespace VocaluxeLib.Menu
|
|||||||
case Keys.Add: //move the selected song up
|
case Keys.Add: //move the selected song up
|
||||||
if (_PlaylistElementContents.Count > 1 && (CurrentPlaylistElement > 0 || Offset > 0))
|
if (_PlaylistElementContents.Count > 1 && (CurrentPlaylistElement > 0 || Offset > 0))
|
||||||
{
|
{
|
||||||
CBase.Playlist.MovePlaylistSongUp(ActivePlaylistID, CurrentPlaylistElement + Offset);
|
CBase.Playlist.MoveSongUp(ActivePlaylistID, CurrentPlaylistElement + Offset);
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
|
|
||||||
var key = new SKeyEvent {Key = Keys.Up};
|
var key = new SKeyEvent {Key = Keys.Up};
|
||||||
@@ -655,7 +655,7 @@ namespace VocaluxeLib.Menu
|
|||||||
case Keys.Subtract: //move the selected song down
|
case Keys.Subtract: //move the selected song down
|
||||||
if (_PlaylistElementContents.Count > 1 && CurrentPlaylistElement + Offset < _PlaylistElementContents.Count - 1)
|
if (_PlaylistElementContents.Count > 1 && CurrentPlaylistElement + Offset < _PlaylistElementContents.Count - 1)
|
||||||
{
|
{
|
||||||
CBase.Playlist.MovePlaylistSongDown(ActivePlaylistID, CurrentPlaylistElement + Offset);
|
CBase.Playlist.MoveSongDown(ActivePlaylistID, CurrentPlaylistElement + Offset);
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
|
|
||||||
var key = new SKeyEvent {Key = Keys.Down};
|
var key = new SKeyEvent {Key = Keys.Down};
|
||||||
@@ -724,7 +724,7 @@ namespace VocaluxeLib.Menu
|
|||||||
|
|
||||||
if (CurrentPlaylistElement != -1)
|
if (CurrentPlaylistElement != -1)
|
||||||
{
|
{
|
||||||
CBase.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode =
|
CBase.Playlist.GetSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode =
|
||||||
_PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
_PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
}
|
}
|
||||||
@@ -736,7 +736,7 @@ namespace VocaluxeLib.Menu
|
|||||||
|
|
||||||
if (CurrentPlaylistElement != -1)
|
if (CurrentPlaylistElement != -1)
|
||||||
{
|
{
|
||||||
CBase.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode =
|
CBase.Playlist.GetSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode =
|
||||||
_PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
_PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
}
|
}
|
||||||
@@ -764,10 +764,10 @@ namespace VocaluxeLib.Menu
|
|||||||
else if (_Theme.ButtonPlaylistSing.Selected)
|
else if (_Theme.ButtonPlaylistSing.Selected)
|
||||||
_StartPlaylistSongs();
|
_StartPlaylistSongs();
|
||||||
else if (_Theme.ButtonPlaylistSave.Selected)
|
else if (_Theme.ButtonPlaylistSave.Selected)
|
||||||
CBase.Playlist.SavePlaylist(ActivePlaylistID);
|
CBase.Playlist.Save(ActivePlaylistID);
|
||||||
else if (_Theme.ButtonPlaylistDelete.Selected)
|
else if (_Theme.ButtonPlaylistDelete.Selected)
|
||||||
{
|
{
|
||||||
CBase.Playlist.DeletePlaylist(ActivePlaylistID);
|
CBase.Playlist.Delete(ActivePlaylistID);
|
||||||
ClosePlaylist();
|
ClosePlaylist();
|
||||||
}
|
}
|
||||||
else if (_Theme.ButtonPlaylistName.Selected)
|
else if (_Theme.ButtonPlaylistName.Selected)
|
||||||
@@ -888,7 +888,7 @@ namespace VocaluxeLib.Menu
|
|||||||
//Delete Entry with RB
|
//Delete Entry with RB
|
||||||
if (CHelper.IsInBounds(_PlaylistElements[i].Background.Rect, mouseEvent) && mouseEvent.RB && _PlaylistElements[i].Content != -1)
|
if (CHelper.IsInBounds(_PlaylistElements[i].Background.Rect, mouseEvent) && mouseEvent.RB && _PlaylistElements[i].Content != -1)
|
||||||
{
|
{
|
||||||
CBase.Playlist.DeletePlaylistSong(ActivePlaylistID, _PlaylistElements[i].Content);
|
CBase.Playlist.DeleteSong(ActivePlaylistID, _PlaylistElements[i].Content);
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -906,7 +906,7 @@ namespace VocaluxeLib.Menu
|
|||||||
{
|
{
|
||||||
if (CurrentPlaylistElement != -1)
|
if (CurrentPlaylistElement != -1)
|
||||||
{
|
{
|
||||||
CBase.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode =
|
CBase.Playlist.GetSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode =
|
||||||
_PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
_PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
}
|
}
|
||||||
@@ -922,12 +922,12 @@ namespace VocaluxeLib.Menu
|
|||||||
}
|
}
|
||||||
if (_Theme.ButtonPlaylistSave.Selected)
|
if (_Theme.ButtonPlaylistSave.Selected)
|
||||||
{
|
{
|
||||||
CBase.Playlist.SavePlaylist(ActivePlaylistID);
|
CBase.Playlist.Save(ActivePlaylistID);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (_Theme.ButtonPlaylistDelete.Selected)
|
if (_Theme.ButtonPlaylistDelete.Selected)
|
||||||
{
|
{
|
||||||
CBase.Playlist.DeletePlaylist(ActivePlaylistID);
|
CBase.Playlist.Delete(ActivePlaylistID);
|
||||||
ClosePlaylist();
|
ClosePlaylist();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -981,14 +981,14 @@ namespace VocaluxeLib.Menu
|
|||||||
|
|
||||||
if (CurrentPlaylistElement != -1)
|
if (CurrentPlaylistElement != -1)
|
||||||
{
|
{
|
||||||
CBase.Playlist.InsertPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset, DragAndDropSongID, gm);
|
CBase.Playlist.InsertSong(ActivePlaylistID, CurrentPlaylistElement + Offset, DragAndDropSongID, gm);
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mouseEvent.Y < _PlaylistElements[0].Background.Rect.Y && Offset == 0)
|
if (mouseEvent.Y < _PlaylistElements[0].Background.Rect.Y && Offset == 0)
|
||||||
{
|
{
|
||||||
CBase.Playlist.InsertPlaylistSong(ActivePlaylistID, 0, DragAndDropSongID, gm);
|
CBase.Playlist.InsertSong(ActivePlaylistID, 0, DragAndDropSongID, gm);
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1007,7 +1007,7 @@ namespace VocaluxeLib.Menu
|
|||||||
|
|
||||||
if (mouseEvent.Y > min)
|
if (mouseEvent.Y > min)
|
||||||
{
|
{
|
||||||
CBase.Playlist.AddPlaylistSong(ActivePlaylistID, DragAndDropSongID, gm);
|
CBase.Playlist.AddSong(ActivePlaylistID, DragAndDropSongID, gm);
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
ScrollToBottom();
|
ScrollToBottom();
|
||||||
}
|
}
|
||||||
@@ -1028,8 +1028,8 @@ namespace VocaluxeLib.Menu
|
|||||||
{
|
{
|
||||||
if (_Theme.ButtonPlaylistName.Selected)
|
if (_Theme.ButtonPlaylistName.Selected)
|
||||||
{
|
{
|
||||||
CBase.Playlist.SetPlaylistName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text);
|
CBase.Playlist.SetName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text);
|
||||||
CBase.Playlist.SavePlaylist(ActivePlaylistID);
|
CBase.Playlist.Save(ActivePlaylistID);
|
||||||
EditMode = EEditMode.None;
|
EditMode = EEditMode.None;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1038,7 +1038,7 @@ namespace VocaluxeLib.Menu
|
|||||||
{
|
{
|
||||||
if (_Theme.ButtonPlaylistName.Selected)
|
if (_Theme.ButtonPlaylistName.Selected)
|
||||||
{
|
{
|
||||||
_Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetPlaylistName(ActivePlaylistID);
|
_Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetName(ActivePlaylistID);
|
||||||
EditMode = EEditMode.None;
|
EditMode = EEditMode.None;
|
||||||
_Theme.ButtonPlaylistName.EditMode = false;
|
_Theme.ButtonPlaylistName.EditMode = false;
|
||||||
return true;
|
return true;
|
||||||
@@ -1058,13 +1058,13 @@ namespace VocaluxeLib.Menu
|
|||||||
{
|
{
|
||||||
if (CurrentPlaylistElement != -1 && CurrentPlaylistElement + Offset != _ChangeOrderSource)
|
if (CurrentPlaylistElement != -1 && CurrentPlaylistElement + Offset != _ChangeOrderSource)
|
||||||
{
|
{
|
||||||
CBase.Playlist.MovePlaylistSong(ActivePlaylistID, _ChangeOrderSource, CurrentPlaylistElement + Offset);
|
CBase.Playlist.MoveSong(ActivePlaylistID, _ChangeOrderSource, CurrentPlaylistElement + Offset);
|
||||||
UpdatePlaylist();
|
UpdatePlaylist();
|
||||||
}
|
}
|
||||||
else if (CurrentPlaylistElement == -1)
|
else if (CurrentPlaylistElement == -1)
|
||||||
{
|
{
|
||||||
if (mouseEvent.Y < _PlaylistElements[0].Background.Rect.Y && Offset == 0)
|
if (mouseEvent.Y < _PlaylistElements[0].Background.Rect.Y && Offset == 0)
|
||||||
CBase.Playlist.MovePlaylistSong(ActivePlaylistID, _ChangeOrderSource, 0);
|
CBase.Playlist.MoveSong(ActivePlaylistID, _ChangeOrderSource, 0);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_PlaylistElements.Count + Offset >= _PlaylistElementContents.Count)
|
if (_PlaylistElements.Count + Offset >= _PlaylistElementContents.Count)
|
||||||
@@ -1080,7 +1080,7 @@ namespace VocaluxeLib.Menu
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mouseEvent.Y > min)
|
if (mouseEvent.Y > min)
|
||||||
CBase.Playlist.MovePlaylistSong(ActivePlaylistID, _ChangeOrderSource, _PlaylistElementContents.Count - 1);
|
CBase.Playlist.MoveSong(ActivePlaylistID, _ChangeOrderSource, _PlaylistElementContents.Count - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1134,35 +1134,33 @@ namespace VocaluxeLib.Menu
|
|||||||
|
|
||||||
public bool LoadPlaylist(int playlistID)
|
public bool LoadPlaylist(int playlistID)
|
||||||
{
|
{
|
||||||
if (playlistID > -1 && playlistID < CBase.Playlist.GetNumPlaylists())
|
if (!CBase.Playlist.Exists(playlistID))
|
||||||
|
return false;
|
||||||
|
ActivePlaylistID = playlistID;
|
||||||
|
_Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetName(ActivePlaylistID);
|
||||||
|
_PlaylistElementContents.Clear();
|
||||||
|
for (int i = 0; i < CBase.Playlist.GetSongCount(ActivePlaylistID); i++)
|
||||||
{
|
{
|
||||||
ActivePlaylistID = playlistID;
|
var pec = new CPlaylistElementContent
|
||||||
_Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetPlaylistName(ActivePlaylistID);
|
{
|
||||||
_PlaylistElementContents.Clear();
|
SongID = CBase.Playlist.GetSong(ActivePlaylistID, i).SongID,
|
||||||
for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++)
|
Modes = CBase.Songs.GetSongByID(CBase.Playlist.GetSong(ActivePlaylistID, i).SongID).AvailableGameModes,
|
||||||
{
|
Mode = CBase.Playlist.GetSong(ActivePlaylistID, i).GameMode
|
||||||
var pec = new CPlaylistElementContent
|
};
|
||||||
{
|
_PlaylistElementContents.Add(pec);
|
||||||
SongID = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID,
|
|
||||||
Modes = CBase.Songs.GetSongByID(CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID).AvailableGameModes,
|
|
||||||
Mode = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode
|
|
||||||
};
|
|
||||||
_PlaylistElementContents.Add(pec);
|
|
||||||
}
|
|
||||||
Update();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
Update();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdatePlaylist()
|
public void UpdatePlaylist()
|
||||||
{
|
{
|
||||||
_PlaylistElementContents.Clear();
|
_PlaylistElementContents.Clear();
|
||||||
for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++)
|
for (int i = 0; i < CBase.Playlist.GetSongCount(ActivePlaylistID); i++)
|
||||||
{
|
{
|
||||||
var pec = new CPlaylistElementContent {SongID = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID};
|
var pec = new CPlaylistElementContent {SongID = CBase.Playlist.GetSong(ActivePlaylistID, i).SongID};
|
||||||
pec.Modes = CBase.Songs.GetSongByID(pec.SongID).AvailableGameModes;
|
pec.Modes = CBase.Songs.GetSongByID(pec.SongID).AvailableGameModes;
|
||||||
pec.Mode = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode;
|
pec.Mode = CBase.Playlist.GetSong(ActivePlaylistID, i).GameMode;
|
||||||
_PlaylistElementContents.Add(pec);
|
_PlaylistElementContents.Add(pec);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1181,10 +1179,10 @@ namespace VocaluxeLib.Menu
|
|||||||
CBase.Game.Reset();
|
CBase.Game.Reset();
|
||||||
CBase.Game.ClearSongs();
|
CBase.Game.ClearSongs();
|
||||||
|
|
||||||
if (ActivePlaylistID > -1 && ActivePlaylistID < CBase.Playlist.GetNumPlaylists())
|
if (CBase.Playlist.Exists(ActivePlaylistID))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++)
|
for (int i = 0; i < CBase.Playlist.GetSongCount(ActivePlaylistID); i++)
|
||||||
CBase.Game.AddSong(CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID, CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode);
|
CBase.Game.AddSong(CBase.Playlist.GetSong(ActivePlaylistID, i).SongID, CBase.Playlist.GetSong(ActivePlaylistID, i).GameMode);
|
||||||
if (CBase.Game.GetNumSongs() > 0)
|
if (CBase.Game.GetNumSongs() > 0)
|
||||||
CBase.Graphics.FadeTo(EScreens.ScreenNames); //TODO: What is if someone uses that in PartyMode?
|
CBase.Graphics.FadeTo(EScreens.ScreenNames); //TODO: What is if someone uses that in PartyMode?
|
||||||
}
|
}
|
||||||
@@ -1195,7 +1193,7 @@ namespace VocaluxeLib.Menu
|
|||||||
CBase.Game.Reset();
|
CBase.Game.Reset();
|
||||||
CBase.Game.ClearSongs();
|
CBase.Game.ClearSongs();
|
||||||
|
|
||||||
CBase.Game.AddSong(CBase.Playlist.GetPlaylistSong(ActivePlaylistID, selected).SongID, CBase.Playlist.GetPlaylistSong(ActivePlaylistID, selected).GameMode);
|
CBase.Game.AddSong(CBase.Playlist.GetSong(ActivePlaylistID, selected).SongID, CBase.Playlist.GetSong(ActivePlaylistID, selected).GameMode);
|
||||||
|
|
||||||
if (CBase.Game.GetNumSongs() > 0)
|
if (CBase.Game.GetNumSongs() > 0)
|
||||||
CBase.Graphics.FadeTo(EScreens.ScreenNames);
|
CBase.Graphics.FadeTo(EScreens.ScreenNames);
|
||||||
@@ -1203,7 +1201,7 @@ namespace VocaluxeLib.Menu
|
|||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
if (ActivePlaylistID > -1 && ActivePlaylistID < CBase.Playlist.GetNumPlaylists())
|
if (CBase.Playlist.Exists(ActivePlaylistID))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _PlaylistElements.Count; i++)
|
for (int i = 0; i < _PlaylistElements.Count; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user