Use generic song selection in tic tac toe
This commit is contained in:
1 parent
06657b9346
commit
9d30bd4b5e
7 files changed
+525
-133
No files matched your search
@@ -34,10 +34,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
|
||||
private const string _SelectSlideNumFields = "SelectSlideNumFields";
|
||||
private const string _SelectSlideSongSource = "SelectSlideSongSource";
|
||||
private const string _SelectSlidePlaylist = "SelectSlidePlaylist";
|
||||
private const string _SelectSlideCategory = "SelectSlideCategory";
|
||||
private const string _SelectSlideGameMode = "SelectSlideGameMode";
|
||||
|
||||
private const string _ButtonNext = "ButtonNext";
|
||||
private const string _ButtonBack = "ButtonBack";
|
||||
|
||||
@@ -47,10 +44,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
base.Init();
|
||||
|
||||
_ThemeSelectSlides = new string[]
|
||||
{
|
||||
_SelectSlideNumFields, _SelectSlideSongSource, _SelectSlidePlaylist, _SelectSlideCategory, _SelectSlideGameMode
|
||||
};
|
||||
_ThemeSelectSlides = new string[] { _SelectSlideNumFields };
|
||||
_ThemeButtons = new string[] {_ButtonNext, _ButtonBack};
|
||||
}
|
||||
|
||||
@@ -134,103 +128,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_SelectSlides[_SelectSlideNumFields].AddValue(25);
|
||||
|
||||
_SelectSlides[_SelectSlideNumFields].SelectedTag = _PartyMode.GameData.NumFields;
|
||||
|
||||
_SelectSlides[_SelectSlideSongSource].Clear();
|
||||
_SelectSlides[_SelectSlideSongSource].SetValues<ESongSource>((int)_PartyMode.GameData.SongSource);
|
||||
|
||||
List<string> playlists = CBase.Playlist.GetNames();
|
||||
_SelectSlides[_SelectSlidePlaylist].Clear();
|
||||
for (int i = 0; i < playlists.Count; i++)
|
||||
{
|
||||
string value = playlists[i] + " (" + CBase.Playlist.GetSongCount(i) + " " + CBase.Language.Translate("TR_SONGS", PartyModeID) + ")";
|
||||
_SelectSlides[_SelectSlidePlaylist].AddValue(value);
|
||||
}
|
||||
_SelectSlides[_SelectSlidePlaylist].Selection = _PartyMode.GameData.PlaylistID;
|
||||
_SelectSlides[_SelectSlidePlaylist].Visible = _PartyMode.GameData.SongSource == ESongSource.TR_PLAYLIST;
|
||||
|
||||
_SelectSlides[_SelectSlideCategory].Clear();
|
||||
for (int i = 0; i < CBase.Songs.GetNumCategories(); i++)
|
||||
{
|
||||
CCategory cat = CBase.Songs.GetCategory(i);
|
||||
string value = cat.Name + " (" + cat.GetNumSongsNotSung() + " " + CBase.Language.Translate("TR_SONGS", PartyModeID) + ")";
|
||||
_SelectSlides[_SelectSlideCategory].AddValue(value);
|
||||
}
|
||||
_SelectSlides[_SelectSlideCategory].Selection = _PartyMode.GameData.CategoryIndex;
|
||||
_SelectSlides[_SelectSlideCategory].Visible = _PartyMode.GameData.SongSource == ESongSource.TR_CATEGORY;
|
||||
|
||||
_SelectSlides[_SelectSlideGameMode].Visible = true;
|
||||
_SelectSlides[_SelectSlideGameMode].Clear();
|
||||
_SelectSlides[_SelectSlideGameMode].AddValues(_PartyMode.AvailableGameModes.Select(gm => gm.ToString()));
|
||||
_SelectSlides[_SelectSlideGameMode].Selection = _PartyMode.GameData.GameMode;
|
||||
}
|
||||
|
||||
private void _UpdateSlides()
|
||||
{
|
||||
_PartyMode.GameData.NumFields = _SelectSlides[_SelectSlideNumFields].SelectedTag;
|
||||
|
||||
_PartyMode.GameData.SongSource = (ESongSource)_SelectSlides[_SelectSlideSongSource].Selection;
|
||||
_PartyMode.GameData.PlaylistID = _SelectSlides[_SelectSlidePlaylist].Selection;
|
||||
_PartyMode.GameData.CategoryIndex = _SelectSlides[_SelectSlideCategory].Selection;
|
||||
_PartyMode.GameData.GameMode = _SelectSlides[_SelectSlideGameMode].Selection;
|
||||
|
||||
EGameMode gm = _PartyMode.AvailableGameModes[_PartyMode.GameData.GameMode];
|
||||
|
||||
if (_PartyMode.GameData.SongSource == ESongSource.TR_PLAYLIST)
|
||||
{
|
||||
if (CBase.Playlist.GetNumPlaylists() > 0)
|
||||
{
|
||||
if (CBase.Playlist.GetSongCount(_PartyMode.GameData.PlaylistID) > 0)
|
||||
{
|
||||
_ConfigOk = false;
|
||||
for (int i = 0; i < CBase.Playlist.GetSongCount(_PartyMode.GameData.PlaylistID); i++)
|
||||
{
|
||||
int id = CBase.Playlist.GetSong(_PartyMode.GameData.PlaylistID, i).SongID;
|
||||
_ConfigOk = CBase.Songs.GetSongByID(id).AvailableGameModes.Any(mode => mode == gm);
|
||||
if (_ConfigOk)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
_ConfigOk = false;
|
||||
}
|
||||
else
|
||||
_ConfigOk = false;
|
||||
}
|
||||
if (_PartyMode.GameData.SongSource == ESongSource.TR_CATEGORY)
|
||||
{
|
||||
if (CBase.Songs.GetNumCategories() == 0)
|
||||
_ConfigOk = false;
|
||||
else if (CBase.Songs.GetNumSongsNotSungInCategory(_PartyMode.GameData.CategoryIndex) <= 0)
|
||||
_ConfigOk = false;
|
||||
else
|
||||
{
|
||||
CBase.Songs.SetCategory(_PartyMode.GameData.CategoryIndex);
|
||||
_ConfigOk = false;
|
||||
foreach (CSong song in CBase.Songs.GetVisibleSongs())
|
||||
{
|
||||
_ConfigOk = song.AvailableGameModes.Any(mode => mode == gm);
|
||||
if (_ConfigOk)
|
||||
break;
|
||||
}
|
||||
CBase.Songs.SetCategory(-1);
|
||||
}
|
||||
}
|
||||
if (_PartyMode.GameData.SongSource == ESongSource.TR_ALLSONGS)
|
||||
{
|
||||
if (CBase.Songs.GetNumSongs() > 0)
|
||||
{
|
||||
for (int i = 0; i < CBase.Songs.GetNumSongs(); i++)
|
||||
{
|
||||
_ConfigOk = CBase.Songs.GetSongByID(i).AvailableGameModes.Any(mode => mode == gm);
|
||||
if (_ConfigOk)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
_ConfigOk = false;
|
||||
}
|
||||
_SelectSlides[_SelectSlideCategory].Visible = _PartyMode.GameData.SongSource == ESongSource.TR_CATEGORY;
|
||||
_SelectSlides[_SelectSlidePlaylist].Visible = _PartyMode.GameData.SongSource == ESongSource.TR_PLAYLIST;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user