Added some more config-options: Song-Source (All songs, category (Show tabs must be "on" in game-options!), playlist) and Game-Mode (normal, duet, short-song)

This commit is contained in:
Florian Küpper committed 2012-12-31 11:49:05 +01:00
1 parent f58064d174
commit f610a708e5
4 files changed
+446 -10

No files matched your search

@@ -6,6 +6,20 @@ using Vocaluxe.Menu;
namespace Vocaluxe.PartyModes
{
public enum ESongSource
{
TR_ALLSONGS,
TR_CATEGORY,
TR_PLAYLIST
}
public enum EPartyGameMode
{
TR_GAMEMODE_NORMAL,
TR_GAMEMODE_SHORTSONG,
TR_GAMEMODE_DUET
}
public class Round
{
public int SongID;
@@ -23,7 +37,10 @@ namespace Vocaluxe.PartyModes
public int NumPlayerTeam1;
public int NumPlayerTeam2;
public int NumFields;
public ESongSource SongSource;
public int CategoryID;
public int PlaylistID;
public EPartyGameMode GameMode;
}
public struct DataToScreenNames
@@ -61,7 +78,10 @@ namespace Vocaluxe.PartyModes
public int NumPlayerTeam1;
public int NumPlayerTeam2;
public int NumFields;
public ESongSource SongSource;
public int CategoryID;
public int PlaylistID;
public EPartyGameMode GameMode;
}
public struct FromScreenNames
@@ -109,8 +129,12 @@ namespace Vocaluxe.PartyModes
public List<int> ProfileIDsTeam1;
public List<int> ProfileIDsTeam2;
public ESongSource SongSource;
public int CategoryID;
public int PlaylistID;
public EPartyGameMode GameMode;
public List<Round> Rounds;
public List<int> Songs;
@@ -154,7 +178,10 @@ namespace Vocaluxe.PartyModes
GameData.ProfileIDsTeam2 = new List<int>();
GameData.CurrentRoundNr = 0;
GameData.SingRoundNr = 0;
GameData.SongSource = ESongSource.TR_ALLSONGS;
GameData.PlaylistID = 0;
GameData.CategoryID = 0;
GameData.GameMode = EPartyGameMode.TR_GAMEMODE_NORMAL;
GameData.Rounds = new List<Round>();
GameData.Songs = new List<int>();
GameData.NumJokerRandom = new int[2];
@@ -193,7 +220,10 @@ namespace Vocaluxe.PartyModes
GameData.NumPlayerTeam1 = data.ScreenConfig.NumPlayerTeam1;
GameData.NumPlayerTeam2 = data.ScreenConfig.NumPlayerTeam2;
GameData.NumFields = data.ScreenConfig.NumFields;
GameData.SongSource = data.ScreenConfig.SongSource;
GameData.CategoryID = data.ScreenConfig.CategoryID;
GameData.PlaylistID = data.ScreenConfig.PlaylistID;
GameData.GameMode = data.ScreenConfig.GameMode;
_Stage = EStage.Config;
_Base.Graphics.FadeTo(EScreens.ScreenPartyDummy);
@@ -286,7 +316,10 @@ namespace Vocaluxe.PartyModes
ToScreenConfig.NumPlayerTeam1 = GameData.NumPlayerTeam1;
ToScreenConfig.NumPlayerTeam2 = GameData.NumPlayerTeam2;
ToScreenConfig.NumFields = GameData.NumFields;
ToScreenConfig.SongSource = GameData.SongSource;
ToScreenConfig.CategoryID = GameData.CategoryID;
ToScreenConfig.PlaylistID = GameData.PlaylistID;
ToScreenConfig.GameMode = GameData.GameMode;
Screen.DataToScreen(ToScreenConfig);
}
break;
@@ -426,10 +459,22 @@ namespace Vocaluxe.PartyModes
public override void SongSelected(int SongID)
{
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
switch (GameData.GameMode)
{
case EPartyGameMode.TR_GAMEMODE_NORMAL:
gm = EGameMode.TR_GAMEMODE_NORMAL;
break;
case EPartyGameMode.TR_GAMEMODE_DUET:
gm = EGameMode.TR_GAMEMODE_DUET;
break;
case EPartyGameMode.TR_GAMEMODE_SHORTSONG:
gm = EGameMode.TR_GAMEMODE_SHORTSONG;
break;
}
_Base.Game.AddSong(SongID, gm);
_Base.Songs.AddPartySongSung(SongID);
@@ -482,11 +527,56 @@ namespace Vocaluxe.PartyModes
private void PrepareSongList()
{
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
switch (GameData.GameMode)
{
case EPartyGameMode.TR_GAMEMODE_NORMAL:
gm = EGameMode.TR_GAMEMODE_NORMAL;
break;
case EPartyGameMode.TR_GAMEMODE_DUET:
gm = EGameMode.TR_GAMEMODE_DUET;
break;
case EPartyGameMode.TR_GAMEMODE_SHORTSONG:
gm = EGameMode.TR_GAMEMODE_SHORTSONG;
break;
}
while(GameData.Songs.Count < (GameData.NumFields + GameData.NumJokerRandom[0] + GameData.NumJokerRandom[1])){
List<int> Songs = new List<int>();
for (int i = 0; i < _Base.Playlist.GetPlaylistSongCount(GameData.PlaylistID); i++)
switch (GameData.SongSource)
{
Songs.Add(_Base.Playlist.GetPlaylistSong(GameData.PlaylistID, i).SongID);
case ESongSource.TR_PLAYLIST:
for (int i = 0; i < _Base.Playlist.GetPlaylistSongCount(GameData.PlaylistID); i++)
{
int id = _Base.Playlist.GetPlaylistSong(GameData.PlaylistID, i).SongID;
foreach (EGameMode mode in _Base.Songs.GetSongByID(id).AvailableGameModes)
if (mode == gm)
Songs.Add(id);
}
break;
case ESongSource.TR_ALLSONGS:
for (int i = 0; i < _Base.Songs.GetNumSongs(); i++)
{
foreach (EGameMode mode in _Base.Songs.GetSongByID(i).AvailableGameModes)
if (mode == gm)
Songs.Add(i);
}
break;
case ESongSource.TR_CATEGORY:
_Base.Songs.SetCategory(GameData.CategoryID);
for (int i = 0; i < _Base.Songs.NumSongsInCategory(GameData.CategoryID); i++)
{
foreach(EGameMode mode in _Base.Songs.GetVisibleSong(i).AvailableGameModes)
if(mode == gm)
Songs.Add(_Base.Songs.GetVisibleSong(i).ID);
}
_Base.Songs.SetCategory(-1);
break;
}
while(Songs.Count > 0)
{
@@ -529,12 +619,16 @@ namespace Vocaluxe.PartyModes
player[0].Name = profiles[GameData.ProfileIDsTeam1[r.SingerTeam1]].PlayerName;
player[0].Difficulty = profiles[GameData.ProfileIDsTeam1[r.SingerTeam1]].Difficulty;
player[0].ProfileID = GameData.ProfileIDsTeam1[r.SingerTeam1];
if (GameData.GameMode == EPartyGameMode.TR_GAMEMODE_DUET)
player[0].LineNr = 0;
}
if (GameData.ProfileIDsTeam2[r.SingerTeam2] < profiles.Length)
{
player[1].Name = profiles[GameData.ProfileIDsTeam2[r.SingerTeam2]].PlayerName;
player[1].Difficulty = profiles[GameData.ProfileIDsTeam2[r.SingerTeam2]].Difficulty;
player[1].ProfileID = GameData.ProfileIDsTeam2[r.SingerTeam2];
if (GameData.GameMode == EPartyGameMode.TR_GAMEMODE_DUET)
player[1].LineNr = 1;
}
SongSelected(r.SongID);
}
@@ -15,7 +15,10 @@ namespace Vocaluxe.PartyModes
const string SelectSlideNumPlayerTeam1 = "SelectSlideNumPlayerTeam1";
const string SelectSlideNumPlayerTeam2 = "SelectSlideNumPlayerTeam2";
const string SelectSlideNumFields = "SelectSlideNumFields";
const string SelectSlideSongSource = "SelectSlideSongSource";
const string SelectSlidePlaylist = "SelectSlidePlaylist";
const string SelectSlideCategory = "SelectSlideCategory";
const string SelectSlideGameMode = "SelectSlideGameMode";
const string ButtonNext = "ButtonNext";
const string ButtonBack = "ButtonBack";
@@ -32,7 +35,7 @@ namespace Vocaluxe.PartyModes
base.Init();
_ThemeName = "PartyScreenTicTacToeConfig";
_ThemeSelectSlides = new string[] { SelectSlideNumPlayerTeam1, SelectSlideNumPlayerTeam2, SelectSlideNumFields, SelectSlidePlaylist };
_ThemeSelectSlides = new string[] { SelectSlideNumPlayerTeam1, SelectSlideNumPlayerTeam2, SelectSlideNumFields, SelectSlideSongSource, SelectSlidePlaylist, SelectSlideCategory, SelectSlideGameMode };
_ThemeButtons = new string[] { ButtonNext, ButtonBack };
_ScreenVersion = ScreenVersion;
@@ -42,6 +45,9 @@ namespace Vocaluxe.PartyModes
config.NumFields = 9;
config.NumPlayerTeam1 = 2;
config.NumPlayerTeam2 = 2;
config.GameMode = EPartyGameMode.TR_GAMEMODE_NORMAL;
config.CategoryID = 0;
config.SongSource = ESongSource.TR_ALLSONGS;
Data.ScreenConfig = config;
}
@@ -61,6 +67,9 @@ namespace Vocaluxe.PartyModes
Data.ScreenConfig.NumPlayerTeam1 = config.NumPlayerTeam1;
Data.ScreenConfig.NumPlayerTeam2 = config.NumPlayerTeam2;
Data.ScreenConfig.PlaylistID = config.PlaylistID;
Data.ScreenConfig.CategoryID = config.CategoryID;
Data.ScreenConfig.SongSource = config.SongSource;
Data.ScreenConfig.GameMode = config.GameMode;
}
catch (Exception e)
{
@@ -186,6 +195,9 @@ namespace Vocaluxe.PartyModes
else if (Data.ScreenConfig.NumFields == 25)
SelectSlides[htSelectSlides(SelectSlideNumFields)].Selection = 2;
SelectSlides[htSelectSlides(SelectSlideSongSource)].Clear();
SelectSlides[htSelectSlides(SelectSlideSongSource)].SetValues<ESongSource>((int)Data.ScreenConfig.SongSource);
string[] _Playlists = _Base.Playlist.GetPlaylistNames();
SelectSlides[htSelectSlides(SelectSlidePlaylist)].Clear();
for (int i = 0; i < _Playlists.Length; i++)
@@ -194,7 +206,24 @@ namespace Vocaluxe.PartyModes
SelectSlides[htSelectSlides(SelectSlidePlaylist)].AddValue(value);
}
SelectSlides[htSelectSlides(SelectSlidePlaylist)].Selection = Data.ScreenConfig.PlaylistID;
SelectSlides[htSelectSlides(SelectSlidePlaylist)].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST;
string[] _Categories = new string[_Base.Songs.GetNumCategories()];
for (int i = 0; i < _Base.Songs.GetNumCategories(); i++ )
{
_Categories[i] = _Base.Songs.GetCategory(i).Name;
}
SelectSlides[htSelectSlides(SelectSlideCategory)].Clear();
for (int i = 0; i < _Categories.Length; i++)
{
string value = _Categories[i] + " (" + _Base.Songs.NumSongsInCategory(i) + " " + _Base.Language.Translate("TR_SONGS", _PartyModeID) + ")";
SelectSlides[htSelectSlides(SelectSlideCategory)].AddValue(value);
}
SelectSlides[htSelectSlides(SelectSlideCategory)].Selection = Data.ScreenConfig.CategoryID;
SelectSlides[htSelectSlides(SelectSlideCategory)].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY;
SelectSlides[htSelectSlides(SelectSlideGameMode)].Visible = true;
SelectSlides[htSelectSlides(SelectSlideGameMode)].SetValues<EPartyGameMode>((int)Data.ScreenConfig.GameMode);
}
private void UpdateSlides()
@@ -209,12 +238,98 @@ namespace Vocaluxe.PartyModes
else if (SelectSlides[htSelectSlides(SelectSlideNumFields)].Selection == 2)
Data.ScreenConfig.NumFields = 25;
Data.ScreenConfig.SongSource = (ESongSource)SelectSlides[htSelectSlides(SelectSlideSongSource)].Selection;
Data.ScreenConfig.PlaylistID = SelectSlides[htSelectSlides(SelectSlidePlaylist)].Selection;
Data.ScreenConfig.CategoryID = SelectSlides[htSelectSlides(SelectSlideCategory)].Selection;
Data.ScreenConfig.GameMode = (EPartyGameMode)SelectSlides[htSelectSlides(SelectSlideGameMode)].Selection;
if (_Base.Playlist.GetPlaylistSongCount(Data.ScreenConfig.PlaylistID) <= 0)
ConfigOk = false;
else
ConfigOk = true;
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
switch (Data.ScreenConfig.GameMode)
{
case EPartyGameMode.TR_GAMEMODE_NORMAL:
gm = EGameMode.TR_GAMEMODE_NORMAL;
break;
case EPartyGameMode.TR_GAMEMODE_DUET:
gm = EGameMode.TR_GAMEMODE_DUET;
break;
case EPartyGameMode.TR_GAMEMODE_SHORTSONG:
gm = EGameMode.TR_GAMEMODE_SHORTSONG;
break;
}
if (Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST)
{
if (_Base.Playlist.GetNumPlaylists() > 0)
if (_Base.Playlist.GetPlaylistSongCount(Data.ScreenConfig.PlaylistID) > 0)
{
ConfigOk = false;
for (int i = 0; i < _Base.Playlist.GetPlaylistSongCount(Data.ScreenConfig.PlaylistID); i++)
{
int id = _Base.Playlist.GetPlaylistSong(Data.ScreenConfig.PlaylistID, i).SongID;
foreach (EGameMode mode in _Base.Songs.GetSongByID(id).AvailableGameModes)
if (mode == gm)
{
ConfigOk = true;
break;
}
if (ConfigOk)
break;
}
}
else
ConfigOk = false;
else
ConfigOk = false;
}
if (Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY)
{
if (_Base.Songs.GetNumCategories() > 0)
if (_Base.Songs.NumSongsInCategory(Data.ScreenConfig.CategoryID) > 0)
{
_Base.Songs.SetCategory(Data.ScreenConfig.CategoryID);
ConfigOk = false;
for (int i = 0; i < _Base.Songs.NumSongsInCategory(Data.ScreenConfig.CategoryID); i++)
{
foreach (EGameMode mode in _Base.Songs.GetVisibleSong(i).AvailableGameModes)
if (mode == gm)
{
ConfigOk = true;
break;
}
if (ConfigOk)
break;
}
_Base.Songs.SetCategory(-1);
}
else
ConfigOk = false;
else
ConfigOk = false;
}
if (Data.ScreenConfig.SongSource == ESongSource.TR_ALLSONGS)
{
if (_Base.Songs.GetNumSongs() > 0)
{
for (int i = 0; i < _Base.Songs.GetNumSongs(); i++)
{
foreach (EGameMode mode in _Base.Songs.GetSongByID(i).AvailableGameModes)
if (mode == gm)
{
ConfigOk = true;
break;
}
if (ConfigOk)
break;
}
}
else
ConfigOk = false;
}
SelectSlides[htSelectSlides(SelectSlideCategory)].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY;
SelectSlides[htSelectSlides(SelectSlidePlaylist)].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST;
}
private void Back()