From f610a708e5d7edff2a966af55ca9664998fb7a90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Mon, 31 Dec 2012 11:49:05 +0100 Subject: [PATCH] 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) --- .../TicTacToe/Languages/Deutsch.xml | 3 + .../Screens/PartyScreenTicTacToeConfig.xml | 228 +++++++++++++++++- .../PartyModeTicTacToe/PartyModeTicTacToe.cs | 100 +++++++- .../PartyScreenTicTacToeConfig.cs | 125 +++++++++- 4 files changed, 446 insertions(+), 10 deletions(-) diff --git a/Output/PartyModes/TicTacToe/Languages/Deutsch.xml b/Output/PartyModes/TicTacToe/Languages/Deutsch.xml index 10d4d49a..d17c34fd 100644 --- a/Output/PartyModes/TicTacToe/Languages/Deutsch.xml +++ b/Output/PartyModes/TicTacToe/Languages/Deutsch.xml @@ -17,6 +17,9 @@ Starten Songs Team + Playlist + Kategorie + Alle Songs Tic-Tac-Toe: Einstellungen Anzahl der Spieler in Team 1 diff --git a/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeConfig.xml b/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeConfig.xml index 22fbe30a..d9330b71 100644 --- a/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeConfig.xml +++ b/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeConfig.xml @@ -169,11 +169,40 @@ Outline - TR_SCREENCONFIG_PLAYLIST + TR_SCREENCONFIG_SONGSOURCE + + + 75 + 405 + + 0,00 + + 32 + + + + StaticColor + + + TextSColor + + Left + + Center + + + + Outline + + TR_SCREENCONFIG_GAMEMODE + + + + Button @@ -483,7 +512,7 @@ 3 - + Invisible @@ -546,7 +575,202 @@ Bold + 3 + + + + Invisible + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlide + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlide + + 500 + 340 + 0,00 + 700 + 50 + + 505 + 345 + 0,00 + 40 + 40 + + 1170 + 345 + 0,00 + 40 + 40 + + + SelectSlideColor + + + SelectSlideSColor + + + SelectSlideHColor + + + ArrowColor + + + ArrowSColor + + + TextColor + + + TextSColor + + 32,00 + + 205,33 + + Outline + + Bold + 1 + + + Invisible + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlide + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlide + + 500 + 340 + 0,00 + 700 + 50 + + 505 + 345 + 0,00 + 40 + 40 + + 1170 + 345 + 0,00 + 40 + 40 + + + SelectSlideColor + + + SelectSlideSColor + + + SelectSlideHColor + + + ArrowColor + + + ArrowSColor + + + TextColor + + + TextSColor + + 32,00 + + 205,33 + + Outline + + Bold + + 1 + + + + Invisible + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlide + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlide + + 500 + 400 + 0,00 + 700 + 50 + + 505 + 405 + 0,00 + 40 + 40 + + 1170 + 405 + 0,00 + 40 + 40 + + + SelectSlideColor + + + SelectSlideSColor + + + SelectSlideHColor + + + ArrowColor + + + ArrowSColor + + + TextColor + + + TextSColor + + 32,00 + + 205,33 + + Outline + + Bold + + 1 + diff --git a/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.cs b/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.cs index b7f047eb..6a5639d3 100644 --- a/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.cs +++ b/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.cs @@ -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 ProfileIDsTeam1; public List ProfileIDsTeam2; + public ESongSource SongSource; + public int CategoryID; public int PlaylistID; + public EPartyGameMode GameMode; + public List Rounds; public List Songs; @@ -154,7 +178,10 @@ namespace Vocaluxe.PartyModes GameData.ProfileIDsTeam2 = new List(); 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(); GameData.Songs = new List(); 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 Songs = new List(); - 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); } diff --git a/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeConfig.cs b/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeConfig.cs index d5b86e20..3b47296c 100644 --- a/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeConfig.cs +++ b/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeConfig.cs @@ -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((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((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()