diff --git a/Output/PartyModes/TicTacToe.xml b/Output/PartyModes/TicTacToe.xml index 2f25da4e..000e7386 100644 --- a/Output/PartyModes/TicTacToe.xml +++ b/Output/PartyModes/TicTacToe.xml @@ -15,5 +15,6 @@ CPartyScreenTicTacToeMain CPartyScreenTicTacToeConfig CPartyScreenTicTacToeNames + CPartyScreenTicTacToeSongs diff --git a/Output/PartyModes/TicTacToe/Themes/Genius/Screens/PartyScreenTicTacToeSongs.xml b/Output/PartyModes/TicTacToe/Themes/Genius/Screens/PartyScreenTicTacToeSongs.xml new file mode 100644 index 00000000..eb1c1a56 --- /dev/null +++ b/Output/PartyModes/TicTacToe/Themes/Genius/Screens/PartyScreenTicTacToeSongs.xml @@ -0,0 +1,407 @@ + + + + PartyScreenTicTacToeSongs + 1 + + + + Video + + + BG_Default + + + + + + + + + 0 + 40 + 1280 + 45 + 1 + + + + + + 640 + 50 + 0 + 27 + 0 + + + Center + Center + + Outline + TR_SCREENCONFIG_TITLE + + + 75 + 105 + 0 + 27 + 0 + + + Left + Center + + Outline + TR_SCREENCONFIG_SONGSOURCE + + + 75 + 290 + 0 + 27 + 0 + + + Left + Center + + Outline + TR_SCREENCONFIG_GAMEMODE + + + + + + + + + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 500 + 100 + 700 + 50 + 0 + + + 505 + 105 + 40 + 40 + 0 + + + 1155 + 105 + 40 + 40 + 0 + + + + + + + + 27 + 50 + 0 + 205.33 + Outline + Bold + 3 + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 500 + 160 + 700 + 50 + 0 + + + 505 + 165 + 40 + 40 + 0 + + + 1155 + 165 + 40 + 40 + 0 + + + + + + + + 27 + 50 + 0 + 600 + Outline + Bold + 3 + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 500 + 160 + 700 + 50 + 0 + + + 505 + 165 + 40 + 40 + 0 + + + 1155 + 165 + 40 + 40 + 0 + + + + + + + + 27 + 50 + 0 + 600 + Outline + Bold + 3 + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 500 + 220 + 700 + 50 + 0 + + + 505 + 225 + 40 + 40 + 0 + + + 1155 + 225 + 40 + 40 + 0 + + + + + + + + 27 + 50 + 0 + 600 + Outline + Bold + 1 + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 500 + 290 + 700 + 50 + 0 + + + 505 + 295 + 40 + 40 + 0 + + + 1155 + 295 + 40 + 40 + 0 + + + + + + + + 27 + 50 + 0 + 205.33 + Outline + Bold + 2 + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 500 + 360 + 700 + 50 + 0 + + + 505 + 365 + 40 + 40 + 0 + + + 1155 + 365 + 40 + 40 + 0 + + + + + + + + 27 + 50 + 0 + 205.33 + Outline + Bold + 5 + + + + + + + + + \ No newline at end of file diff --git a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs index 636e3cfe..724d26d3 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs @@ -27,18 +27,9 @@ using VocaluxeLib.Songs; namespace VocaluxeLib.PartyModes.TicTacToe { - public enum ESongSource - { - // ReSharper disable InconsistentNaming - TR_ALLSONGS, - TR_CATEGORY, - TR_PLAYLIST - // ReSharper restore InconsistentNaming - } - public class CRound { - public int SongID; + public int[] SongIDs; public int SingerTeam1; public int SingerTeam2; public int PointsTeam1; @@ -101,6 +92,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe private enum EStage { Config, + Songs, Names, Main, Singing @@ -118,10 +110,12 @@ namespace VocaluxeLib.PartyModes.TicTacToe public List PlayerTeam2; public ESongSource SongSource; + public ESongSorting Sorting; public int CategoryIndex; public int PlaylistID; - public int GameMode; + public EGameMode GameMode; + public int NumMedleySongs; public List Rounds; public List Songs; @@ -159,10 +153,12 @@ namespace VocaluxeLib.PartyModes.TicTacToe PlayerTeam2 = new List(), CurrentRoundNr = 0, FieldNr = 0, + Sorting = CBase.Config.GetSongSorting(), SongSource = ESongSource.TR_ALLSONGS, PlaylistID = 0, CategoryIndex = 0, - GameMode = 0, + GameMode = EGameMode.TR_GAMEMODE_NORMAL, + NumMedleySongs = 5, Rounds = new List(), Songs = new List(), NumJokerRandom = new int[2], @@ -212,6 +208,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe { case EStage.Config: return _Screens["CPartyScreenTicTacToeConfig"]; + case EStage.Songs: + return _Screens["CPartyScreenTicTacToeSongs"]; case EStage.Names: return _Screens["CPartyScreenTicTacToeNames"]; case EStage.Main: @@ -234,6 +232,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe switch (_Stage) { case EStage.Config: + _Stage = EStage.Songs; + break; + case EStage.Songs: _Stage = EStage.Names; break; case EStage.Names: @@ -267,9 +268,12 @@ namespace VocaluxeLib.PartyModes.TicTacToe case EStage.Config: CBase.Graphics.FadeTo(EScreen.Party); return; - case EStage.Names: + case EStage.Songs: _Stage = EStage.Config; break; + case EStage.Names: + _Stage = EStage.Songs; + break; case EStage.Main: _Stage = EStage.Names; break; @@ -434,20 +438,21 @@ namespace VocaluxeLib.PartyModes.TicTacToe for (int i = 0; i < CBase.Playlist.GetSongCount(GameData.PlaylistID); i++) { int id = CBase.Playlist.GetSong(GameData.PlaylistID, i).SongID; - if (CBase.Songs.GetSongByID(id).AvailableGameModes.Contains(AvailableGameModes[GameData.GameMode])) + if (CBase.Songs.GetSongByID(id).AvailableGameModes.Contains(GameData.GameMode)) GameData.Songs.Add(id); } break; case ESongSource.TR_ALLSONGS: ReadOnlyCollection avSongs = CBase.Songs.GetSongs(); - GameData.Songs.AddRange(avSongs.Where(song => song.AvailableGameModes.Contains(AvailableGameModes[GameData.GameMode])).Select(song => song.ID)); + GameData.Songs.AddRange(avSongs.Where(song => song.AvailableGameModes.Contains(GameData.GameMode)).Select(song => song.ID)); break; case ESongSource.TR_CATEGORY: + CBase.Songs.SortSongs(GameData.Sorting, EOffOn.TR_CONFIG_ON, CBase.Config.GetIgnoreArticles(), "", EDuetOptions.All, -1); CBase.Songs.SetCategory(GameData.CategoryIndex); avSongs = CBase.Songs.GetVisibleSongs(); - GameData.Songs.AddRange(avSongs.Where(song => song.AvailableGameModes.Contains(AvailableGameModes[GameData.GameMode])).Select(song => song.ID)); + GameData.Songs.AddRange(avSongs.Where(song => song.AvailableGameModes.Contains(GameData.GameMode)).Select(song => song.ID)); CBase.Songs.SetCategory(-1); break; @@ -478,7 +483,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe return; CRound round = GameData.Rounds[roundNr]; - bool isDuet = CBase.Songs.GetSongByID(round.SongID).IsDuet; for (int i = 0; i < 2; i++) { @@ -488,14 +492,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe //try to fill with the right data players[0].ProfileID = GameData.ProfileIDsTeam1[round.SingerTeam1]; - if (isDuet) - players[0].VoiceNr = 0; - players[1].ProfileID = GameData.ProfileIDsTeam2[round.SingerTeam2]; - if (isDuet) - players[1].VoiceNr = 1; - CBase.Game.AddSong(round.SongID, AvailableGameModes[GameData.GameMode]); + foreach(int song in round.SongIDs) + CBase.Game.AddSong(song, GameData.GameMode); } private void _SetNumJokers() diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs index feeda81b..a04e8e16 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs @@ -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((int)_PartyMode.GameData.SongSource); - - List 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; } } } \ No newline at end of file diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs index 35f45351..6f7eab3c 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs @@ -394,13 +394,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe if (_PartyMode.GameData.Rounds[i].Finished) { _Fields[i].Selectable = false; - _Fields[i].Texture = CBase.Songs.GetSongByID(_PartyMode.GameData.Rounds[i].SongID).CoverTextureBig; + _Fields[i].Texture = CBase.Songs.GetSongByID(_PartyMode.GameData.Rounds[i].SongIDs[0]).CoverTextureBig; _Fields[i].Color = CBase.Themes.GetPlayerColor(_PartyMode.GameData.Rounds[i].Winner); _Fields[i].SelColor = CBase.Themes.GetPlayerColor(_PartyMode.GameData.Rounds[i].Winner); } if (_Status == EStatus.FieldSelected && _PartyMode.GameData.FieldNr == i) { - _Fields[i].Texture = CBase.Songs.GetSongByID(_PartyMode.GameData.Rounds[i].SongID).CoverTextureBig; + _Fields[i].Texture = CBase.Songs.GetSongByID(_PartyMode.GameData.Rounds[i].SongIDs[0]).CoverTextureBig; _Fields[i].Color = new SColorF(1, 1, 1, 1); _Fields[i].SelColor = new SColorF(1, 1, 1, 1); _Fields[i].Selectable = false; @@ -441,12 +441,16 @@ namespace VocaluxeLib.PartyModes.TicTacToe _UpdatePlayerInformation(); } _PartyMode.UpdateSongList(); - int songID = _PartyMode.GameData.Songs[0]; - _PartyMode.GameData.Songs.RemoveAt(0); + int[] songIDs = new int[_PartyMode.GameData.GameMode == EGameMode.TR_GAMEMODE_MEDLEY ? _PartyMode.GameData.NumMedleySongs : 1]; + for(int i = 0; i < songIDs.Length; i++) + { + songIDs[i] = _PartyMode.GameData.Songs[0]; + _PartyMode.GameData.Songs.RemoveAt(0); + } - _StartPreview(songID); + _StartPreview(songIDs[0]); _Status = EStatus.FieldSelected; - _PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SongID = songID; + _PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SongIDs = songIDs; _UpdateFieldContents(); _UpdateJokerButtons(); @@ -459,10 +463,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe private void _FieldSelectedAgain() { - int songID = _PartyMode.GameData.Rounds[_OldSelectedField].SongID; - _StartPreview(songID); + int[] songIDs = _PartyMode.GameData.Rounds[_OldSelectedField].SongIDs; + _StartPreview(songIDs[0]); _Status = EStatus.FieldSelected; - _PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SongID = songID; + _PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SongIDs = songIDs; _PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam1 = _PartyMode.GameData.Rounds[_OldSelectedField].SingerTeam1; _PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam2 = _PartyMode.GameData.Rounds[_OldSelectedField].SingerTeam2; _UpdateFieldContents(); diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeSongs.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeSongs.cs new file mode 100644 index 00000000..bf27dd65 --- /dev/null +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeSongs.cs @@ -0,0 +1,77 @@ +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System.Collections.Generic; +using VocaluxeLib.Menu; + +namespace VocaluxeLib.PartyModes.TicTacToe +{ + class CPartyScreenTicTacToeSongs : CMenuPartySongSelection + { + protected override int _ScreenVersion + { + get { return 1; } + } + + private new CPartyModeTicTacToe _PartyMode; + + public override void Init() + { + base.Init(); + _PartyMode = (CPartyModeTicTacToe)base._PartyMode; + } + + public override void OnShow() + { + Source = _PartyMode.GameData.SongSource; + Sorting = _PartyMode.GameData.Sorting; + Category = _PartyMode.GameData.CategoryIndex; + Playlist = _PartyMode.GameData.PlaylistID; + SongMode = _PartyMode.GameData.GameMode; + NumMedleySongs = _PartyMode.GameData.NumMedleySongs; + + base.OnShow(); + } + + public override void Back() + { + _SaveConfig(); + _PartyMode.Back(); + } + + public override void Next() + { + _SaveConfig(); + _PartyMode.Next(); + } + + public override bool UpdateGame() + { + return true; + } + + private void _SaveConfig() + { + _PartyMode.GameData.SongSource = Source; + _PartyMode.GameData.Sorting = Sorting; + _PartyMode.GameData.CategoryIndex = Category; + _PartyMode.GameData.PlaylistID = Playlist; + _PartyMode.GameData.GameMode = SongMode; + _PartyMode.GameData.NumMedleySongs = NumMedleySongs; + } + } +} diff --git a/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.csproj b/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.csproj index 599cfeec..2c6f46d4 100644 --- a/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.csproj +++ b/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.csproj @@ -70,6 +70,7 @@ ManagedMinimumRules.ruleset + @@ -108,4 +109,4 @@ rm -f "$(SolutionDir)Output\PartyModes\$(TargetName)\Code\GlobalSuppressions.cs" --> - + \ No newline at end of file