diff --git a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs index 5929e1ff..1dadbaea 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs @@ -17,8 +17,11 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; using System.Runtime.InteropServices; using VocaluxeLib.Menu; +using VocaluxeLib.Songs; [assembly: ComVisible(false)] @@ -105,7 +108,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe public List Songs; public int CurrentRoundNr; - public int SingRoundNr; + public int FieldNr; public int[] NumJokerRandom; public int[] NumJokerRetry; @@ -136,7 +139,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe PlayerTeam1 = new List(), PlayerTeam2 = new List(), CurrentRoundNr = 0, - SingRoundNr = 0, + FieldNr = 0, SongSource = ESongSource.TR_ALLSONGS, PlaylistID = 0, CategoryID = 0, @@ -160,10 +163,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe if (CBase.Config.GetTabs() == EOffOn.TR_CONFIG_ON && _ScreenSongOptions.Sorting.SongSorting != ESongSorting.TR_CONFIG_NONE) _ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_ON; - GameData.Songs = new List(); - GameData.Rounds = new List(); - GameData.PlayerTeam1 = new List(); - GameData.PlayerTeam2 = new List(); + GameData.Songs.Clear(); + GameData.Rounds.Clear(); + GameData.PlayerTeam1.Clear(); + GameData.PlayerTeam2.Clear(); return true; } @@ -195,7 +198,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe private void _FadeToScreen() { - if(CBase.Graphics.GetNextScreen() != _GetNextScreen()) + if (CBase.Graphics.GetNextScreen() != _GetNextScreen()) CBase.Graphics.FadeTo(_GetNextScreen()); } @@ -214,16 +217,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe _CreateRounds(); _SetNumJokers(); _PreparePlayerList(0); - _PrepareSongList(); break; case EStage.Main: _Stage = EStage.Singing; - _StartRound(GameData.SingRoundNr); + _StartRound(GameData.FieldNr); break; case EStage.Singing: _Stage = EStage.Main; GameData.Team = GameData.Team == 1 ? 0 : 1; - _UpdateSongList(); _UpdatePlayerList(); break; default: @@ -258,31 +259,22 @@ namespace VocaluxeLib.PartyModes.TicTacToe public override SScreenSongOptions GetScreenSongOptions() { - _ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting(); - _ScreenSongOptions.Sorting.Tabs = CBase.Config.GetTabs(); - _ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles(); - - return _ScreenSongOptions; + throw new ArgumentException("Not required!"); } - // ReSharper disable RedundantAssignment public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) - // ReSharper restore RedundantAssignment { - screenSongOptions = _ScreenSongOptions; + throw new ArgumentException("Not required!"); } - // ReSharper disable RedundantAssignment public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) - // ReSharper restore RedundantAssignment { - screenSongOptions = _ScreenSongOptions; + throw new ArgumentException("Not required!"); } public override void SetSearchString(string searchString, bool visible) { - _ScreenSongOptions.Sorting.SearchString = searchString; - _ScreenSongOptions.Sorting.SearchActive = visible; + throw new ArgumentException("Not required!"); } public override int GetMaxPlayer() @@ -324,25 +316,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe public override void SongSelected(int songID) { - var 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; - } - CBase.Game.AddSong(songID, gm); - - CBase.Graphics.FadeTo(EScreen.Sing); + throw new ArgumentException("Not required!"); } public override void LeavingHighscore() @@ -457,10 +431,23 @@ namespace VocaluxeLib.PartyModes.TicTacToe } } - private void _PrepareSongList() + private static void _Shuffle(IList list) { - var gm = EGameMode.TR_GAMEMODE_NORMAL; + for (int n = list.Count - 1; n >= 1; n--) + { + int k = CBase.Game.GetRandom(n); + T value = list[k]; + list[k] = list[n]; + list[n] = value; + } + } + public void UpdateSongList() + { + if (GameData.Songs.Count > 0) + return; + + EGameMode gm; switch (GameData.GameMode) { case EPartyGameMode.TR_GAMEMODE_NORMAL: @@ -474,61 +461,37 @@ namespace VocaluxeLib.PartyModes.TicTacToe case EPartyGameMode.TR_GAMEMODE_SHORTSONG: gm = EGameMode.TR_GAMEMODE_SHORTSONG; break; + + default: + gm = EGameMode.TR_GAMEMODE_NORMAL; + break; } - while (GameData.Songs.Count < (GameData.NumFields + GameData.NumJokerRandom[0] + GameData.NumJokerRandom[1])) + switch (GameData.SongSource) { - var songs = new List(); - switch (GameData.SongSource) - { - case ESongSource.TR_PLAYLIST: - for (int i = 0; i < CBase.Playlist.GetSongCount(GameData.PlaylistID); i++) - { - int id = CBase.Playlist.GetSong(GameData.PlaylistID, i).SongID; - // ReSharper disable LoopCanBeConvertedToQuery - foreach (EGameMode mode in CBase.Songs.GetSongByID(id).AvailableGameModes) - // ReSharper restore LoopCanBeConvertedToQuery - { - if (mode == gm) - songs.Add(id); - } - } - break; + case ESongSource.TR_PLAYLIST: + 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(gm)) + GameData.Songs.Add(id); + } + break; - case ESongSource.TR_ALLSONGS: - for (int i = 0; i < CBase.Songs.GetNumSongs(); i++) - { - // ReSharper disable LoopCanBeConvertedToQuery - foreach (EGameMode mode in CBase.Songs.GetSongByID(i).AvailableGameModes) - // ReSharper restore LoopCanBeConvertedToQuery - { - if (mode == gm) - songs.Add(i); - } - } - break; + case ESongSource.TR_ALLSONGS: + ReadOnlyCollection avSongs = CBase.Songs.GetSongs(); + GameData.Songs.AddRange(avSongs.Where(song => song.AvailableGameModes.Contains(gm)).Select(song => song.ID)); + break; - case ESongSource.TR_CATEGORY: - CBase.Songs.SetCategory(GameData.CategoryID); - for (int i = 0; i < CBase.Songs.GetNumSongsVisible(); i++) - { - // ReSharper disable LoopCanBeConvertedToQuery - foreach (EGameMode mode in CBase.Songs.GetVisibleSong(i).AvailableGameModes) - // ReSharper restore LoopCanBeConvertedToQuery - { - if (mode == gm) - songs.Add(CBase.Songs.GetVisibleSong(i).ID); - } - } - CBase.Songs.SetCategory(-1); - break; - } - while (songs.Count > 0) - { - GameData.Songs.Add(songs[CBase.Game.GetRandom(songs.Count - 1)]); - songs.Remove(GameData.Songs[GameData.Songs.Count - 1]); - } + case ESongSource.TR_CATEGORY: + CBase.Songs.SetCategory(GameData.CategoryID); + avSongs = CBase.Songs.GetVisibleSongs(); + GameData.Songs.AddRange(avSongs.Where(song => song.AvailableGameModes.Contains(gm)).Select(song => song.ID)); + + CBase.Songs.SetCategory(-1); + break; } + _Shuffle(GameData.Songs); } private void _UpdatePlayerList() @@ -539,12 +502,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe _PreparePlayerList(2); } - private void _UpdateSongList() - { - if (GameData.Songs.Count == 0) - _PrepareSongList(); - } - private void _StartRound(int roundNr) { CBase.Game.Reset(); @@ -559,8 +516,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe if (players.Length < 2) return; - CRound r = GameData.Rounds[roundNr]; - bool isDuet = CBase.Songs.GetSongByID(r.SongID).IsDuet; + CRound round = GameData.Rounds[roundNr]; + bool isDuet = CBase.Songs.GetSongByID(round.SongID).IsDuet; for (int i = 0; i < 2; i++) { @@ -569,18 +526,31 @@ namespace VocaluxeLib.PartyModes.TicTacToe } //try to fill with the right data - if (r != null) + 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; + + var gm = EGameMode.TR_GAMEMODE_NORMAL; + + switch (GameData.GameMode) { - players[0].ProfileID = GameData.ProfileIDsTeam1[r.SingerTeam1]; - if (isDuet) - players[0].VoiceNr = 0; + case EPartyGameMode.TR_GAMEMODE_NORMAL: + gm = EGameMode.TR_GAMEMODE_NORMAL; + break; - players[1].ProfileID = GameData.ProfileIDsTeam2[r.SingerTeam2]; - if (isDuet) - players[1].VoiceNr = 1; + case EPartyGameMode.TR_GAMEMODE_DUET: + gm = EGameMode.TR_GAMEMODE_DUET; + break; - SongSelected(r.SongID); + case EPartyGameMode.TR_GAMEMODE_SHORTSONG: + gm = EGameMode.TR_GAMEMODE_SHORTSONG; + break; } + CBase.Game.AddSong(round.SongID, gm); } private void _SetNumJokers() @@ -612,7 +582,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe private void _UpdateScores() { - if (!GameData.Rounds[GameData.SingRoundNr].Finished) + if (!GameData.Rounds[GameData.FieldNr].Finished) GameData.CurrentRoundNr++; SPlayer[] results = CBase.Game.GetPlayers(); @@ -622,16 +592,16 @@ namespace VocaluxeLib.PartyModes.TicTacToe if (results.Length < 2) return; - GameData.Rounds[GameData.SingRoundNr].PointsTeam1 = (int)Math.Round(results[0].Points); - GameData.Rounds[GameData.SingRoundNr].PointsTeam2 = (int)Math.Round(results[1].Points); - GameData.Rounds[GameData.SingRoundNr].Finished = true; - if (GameData.Rounds[GameData.SingRoundNr].PointsTeam1 < GameData.Rounds[GameData.SingRoundNr].PointsTeam2) - GameData.Rounds[GameData.SingRoundNr].Winner = 2; - else if (GameData.Rounds[GameData.SingRoundNr].PointsTeam1 > GameData.Rounds[GameData.SingRoundNr].PointsTeam2) - GameData.Rounds[GameData.SingRoundNr].Winner = 1; + GameData.Rounds[GameData.FieldNr].PointsTeam1 = (int)Math.Round(results[0].Points); + GameData.Rounds[GameData.FieldNr].PointsTeam2 = (int)Math.Round(results[1].Points); + GameData.Rounds[GameData.FieldNr].Finished = true; + if (GameData.Rounds[GameData.FieldNr].PointsTeam1 < GameData.Rounds[GameData.FieldNr].PointsTeam2) + GameData.Rounds[GameData.FieldNr].Winner = 2; + else if (GameData.Rounds[GameData.FieldNr].PointsTeam1 > GameData.Rounds[GameData.FieldNr].PointsTeam2) + GameData.Rounds[GameData.FieldNr].Winner = 1; else { - GameData.Rounds[GameData.SingRoundNr].Finished = false; + GameData.Rounds[GameData.FieldNr].Finished = false; GameData.CurrentRoundNr--; } } diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs index fe1ccfd7..1ffe157b 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs @@ -23,12 +23,6 @@ using VocaluxeLib.Songs; namespace VocaluxeLib.PartyModes.TicTacToe { - public class CField - { - public CRound Content; - public CButton Button; - } - public enum EStatus { FieldChoosing, @@ -73,14 +67,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe private bool _ExitPopupVisible; - private List _Fields; + private List _Fields = new List(); private float _FieldFirstX = 25; private float _FieldFirstY = 25; private const int _FieldSpace = 10; private float _FieldSize = 100; private int _PreviewStream = -1; - private int _SelectedField = -1; private int _OldSelectedField = -1; private int[,] _Possibilities; @@ -98,8 +91,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe _ButtonJokerRetryT2 }; _ThemeStatics = new string[] {_StaticPopupBG, _StaticAvatarT1, _StaticAvatarT2}; - - _Fields = new List(); } public override void LoadTheme(string xmlPath) @@ -150,17 +141,17 @@ namespace VocaluxeLib.PartyModes.TicTacToe switch (_Status) { case EStatus.FieldChoosing: - if (_Fields[i].Button.Selected) + if (_Fields[i].Selected) { - _SelectedField = i; + _PartyMode.GameData.FieldNr = i; _FieldSelected(); } break; case EStatus.JokerRetry: - if (_Fields[i].Button.Selected) + if (_Fields[i].Selected) { - _SelectedField = i; + _PartyMode.GameData.FieldNr = i; _FieldSelectedAgain(); } break; @@ -215,17 +206,17 @@ namespace VocaluxeLib.PartyModes.TicTacToe switch (_Status) { case EStatus.FieldChoosing: - if (_Fields[i].Button.Selected) + if (_Fields[i].Selected) { - _SelectedField = i; + _PartyMode.GameData.FieldNr = i; _FieldSelected(); } break; case EStatus.JokerRetry: - if (_Fields[i].Button.Selected) + if (_Fields[i].Selected) { - _SelectedField = i; + _PartyMode.GameData.FieldNr = i; _FieldSelectedAgain(); } break; @@ -281,7 +272,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe if (_PartyMode.GameData.CurrentRoundNr == 1) { _BuildWinnerPossibilities(); - _SelectedField = -1; + _PartyMode.GameData.FieldNr = -1; _Buttons[_ButtonBack].Visible = true; _Buttons[_ButtonExit].Visible = false; _SelectElement(_Buttons[_ButtonBack]); @@ -354,10 +345,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe { for (int i = 0; i < 25; i++) { - var f = new CField {Button = GetNewButton(_Buttons[_ButtonField])}; - f.Button.Visible = false; - f.Content = new CRound(); - _AddButton(f.Button); + CButton f = GetNewButton(_Buttons[_ButtonField]); + f.Visible = false; + _AddButton(f); _Fields.Add(f); } } @@ -378,12 +368,12 @@ namespace VocaluxeLib.PartyModes.TicTacToe { if (i < _PartyMode.GameData.NumFields) { - _Fields[i].Button.W = _FieldSize; - _Fields[i].Button.H = _FieldSize; - _Fields[i].Button.X = x; - _Fields[i].Button.Y = y; - _Fields[i].Button.Visible = true; - _Fields[i].Button.Selectable = true; + _Fields[i].W = _FieldSize; + _Fields[i].H = _FieldSize; + _Fields[i].X = x; + _Fields[i].Y = y; + _Fields[i].Visible = true; + _Fields[i].Selectable = true; column++; if ((i + 1) >= numOneRow * (row + 1)) { @@ -397,8 +387,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe } else { - _Fields[i].Button.Visible = false; - _Fields[i].Button.Selectable = false; + _Fields[i].Visible = false; + _Fields[i].Selectable = false; } } } @@ -407,34 +397,33 @@ namespace VocaluxeLib.PartyModes.TicTacToe { for (int i = 0; i < _PartyMode.GameData.Rounds.Count; i++) { - _Fields[i].Button.Selectable = true; - _Fields[i].Button.Texture = _Buttons[_ButtonField].Texture; - _Fields[i].Button.Color = _Buttons[_ButtonField].Color; - _Fields[i].Button.SelColor = _Buttons[_ButtonField].SelColor; - _Fields[i].Content = _PartyMode.GameData.Rounds[i]; - if (_Fields[i].Content.Finished) + _Fields[i].Selectable = true; + _Fields[i].Texture = _Buttons[_ButtonField].Texture; + _Fields[i].Color = _Buttons[_ButtonField].Color; + _Fields[i].SelColor = _Buttons[_ButtonField].SelColor; + if (_PartyMode.GameData.Rounds[i].Finished) { - _Fields[i].Button.Selectable = false; - _Fields[i].Button.Texture = CBase.Songs.GetSongByID(_Fields[i].Content.SongID).CoverTextureBig; - _Fields[i].Button.Color = CBase.Themes.GetPlayerColor(_Fields[i].Content.Winner); - _Fields[i].Button.SelColor = CBase.Themes.GetPlayerColor(_Fields[i].Content.Winner); + _Fields[i].Selectable = false; + _Fields[i].Texture = CBase.Songs.GetSongByID(_PartyMode.GameData.Rounds[i].SongID).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 && _SelectedField == i) + if (_Status == EStatus.FieldSelected && _PartyMode.GameData.FieldNr == i) { - _Fields[i].Button.Texture = CBase.Songs.GetSongByID(_Fields[i].Content.SongID).CoverTextureBig; - _Fields[i].Button.Color = new SColorF(1, 1, 1, 1); - _Fields[i].Button.SelColor = new SColorF(1, 1, 1, 1); - _Fields[i].Button.Selectable = false; + _Fields[i].Texture = CBase.Songs.GetSongByID(_PartyMode.GameData.Rounds[i].SongID).CoverTextureBig; + _Fields[i].Color = new SColorF(1, 1, 1, 1); + _Fields[i].SelColor = new SColorF(1, 1, 1, 1); + _Fields[i].Selectable = false; } - if (_Status == EStatus.JokerRetry && _Fields[i].Content.Finished) + if (_Status == EStatus.JokerRetry && _PartyMode.GameData.Rounds[i].Finished) { - _Fields[i].Button.SelColor = CBase.Themes.GetPlayerColor(_PartyMode.GameData.Team + 1); - _Fields[i].Button.Selectable = true; + _Fields[i].SelColor = CBase.Themes.GetPlayerColor(_PartyMode.GameData.Team + 1); + _Fields[i].Selectable = true; } - if (_Status == EStatus.JokerRetry && !_Fields[i].Content.Finished) - _Fields[i].Button.Selectable = false; + if (_Status == EStatus.JokerRetry && !_PartyMode.GameData.Rounds[i].Finished) + _Fields[i].Selectable = false; if (_Status == EStatus.FieldSelected) - _Fields[i].Button.Selectable = false; + _Fields[i].Selectable = false; } } @@ -456,22 +445,18 @@ namespace VocaluxeLib.PartyModes.TicTacToe singerTeam2 = _PartyMode.GameData.PlayerTeam2[0]; _PartyMode.GameData.PlayerTeam2.RemoveAt(0); } - _PartyMode.GameData.Rounds[_SelectedField].SingerTeam1 = singerTeam1; - _PartyMode.GameData.Rounds[_SelectedField].SingerTeam2 = singerTeam2; + _PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam1 = singerTeam1; + _PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam2 = singerTeam2; _UpdatePlayerInformation(); } - int songID = 0; - if (_PartyMode.GameData.Songs.Count > 0) - { - songID = _PartyMode.GameData.Songs[0]; - _PartyMode.GameData.Songs.RemoveAt(0); - } + _PartyMode.UpdateSongList(); + int songID = _PartyMode.GameData.Songs[0]; + _PartyMode.GameData.Songs.RemoveAt(0); _StartPreview(songID); _Status = EStatus.FieldSelected; - _Fields[_SelectedField].Content.SongID = songID; - _PartyMode.GameData.Rounds[_SelectedField].SongID = songID; + _PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SongID = songID; _UpdateFieldContents(); _UpdateJokerButtons(); @@ -484,13 +469,12 @@ namespace VocaluxeLib.PartyModes.TicTacToe private void _FieldSelectedAgain() { - int songID = _Fields[_SelectedField].Content.SongID; + int songID = _PartyMode.GameData.Rounds[_OldSelectedField].SongID; _StartPreview(songID); _Status = EStatus.FieldSelected; - _Fields[_SelectedField].Content.SongID = songID; - _PartyMode.GameData.Rounds[_SelectedField].SongID = songID; - _PartyMode.GameData.Rounds[_SelectedField].SingerTeam1 = _PartyMode.GameData.Rounds[_OldSelectedField].SingerTeam1; - _PartyMode.GameData.Rounds[_SelectedField].SingerTeam2 = _PartyMode.GameData.Rounds[_OldSelectedField].SingerTeam2; + _PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SongID = songID; + _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(); _UpdatePlayerInformation(); @@ -522,12 +506,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe _Texts[_TextNextPlayerT2].Visible = true; _Texts[_TextNextPlayerNameT1].Visible = true; _Texts[_TextNextPlayerNameT2].Visible = true; - _Texts[_TextNextPlayerNameT1].Text = CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDsTeam1[_PartyMode.GameData.Rounds[_SelectedField].SingerTeam1]); - _Texts[_TextNextPlayerNameT2].Text = CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDsTeam2[_PartyMode.GameData.Rounds[_SelectedField].SingerTeam2]); + _Texts[_TextNextPlayerNameT1].Text = + CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDsTeam1[_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam1]); + _Texts[_TextNextPlayerNameT2].Text = + CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDsTeam2[_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam2]); _Statics[_StaticAvatarT1].Visible = true; _Statics[_StaticAvatarT2].Visible = true; - _Statics[_StaticAvatarT1].Texture = CBase.Profiles.GetAvatar(_PartyMode.GameData.ProfileIDsTeam1[_PartyMode.GameData.Rounds[_SelectedField].SingerTeam1]); - _Statics[_StaticAvatarT2].Texture = CBase.Profiles.GetAvatar(_PartyMode.GameData.ProfileIDsTeam2[_PartyMode.GameData.Rounds[_SelectedField].SingerTeam2]); + _Statics[_StaticAvatarT1].Texture = CBase.Profiles.GetAvatar(_PartyMode.GameData.ProfileIDsTeam1[_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam1]); + _Statics[_StaticAvatarT2].Texture = CBase.Profiles.GetAvatar(_PartyMode.GameData.ProfileIDsTeam2[_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam2]); } private void _UseJoker(int teamNr, int jokerNum) @@ -554,8 +540,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe if (!CBase.Sound.IsFinished(_PreviewStream)) CBase.Sound.Fade(_PreviewStream, 0, 1, EStreamAction.Close); _Status = EStatus.JokerRetry; - _OldSelectedField = _SelectedField; - _SelectedField = -1; + _OldSelectedField = _PartyMode.GameData.FieldNr; + _PartyMode.GameData.FieldNr = -1; _UpdateFieldContents(); _Buttons[_ButtonNextRound].Visible = false; } @@ -587,8 +573,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe _Buttons[_ButtonJokerRetryT2].Visible = true; _Buttons[_ButtonJokerRetryT1].Text.Text = _PartyMode.GameData.NumJokerRetry[0].ToString(); _Buttons[_ButtonJokerRetryT2].Text.Text = _PartyMode.GameData.NumJokerRetry[1].ToString(); - _Buttons[_ButtonJokerRetryT1].Selectable = _PartyMode.GameData.NumJokerRetry[0] > 0; - _Buttons[_ButtonJokerRetryT2].Selectable = _PartyMode.GameData.NumJokerRetry[1] > 0; + _Buttons[_ButtonJokerRetryT1].Selectable = _PartyMode.GameData.NumJokerRetry[0] > 0 && _PartyMode.GameData.CurrentRoundNr > 1; + _Buttons[_ButtonJokerRetryT2].Selectable = _PartyMode.GameData.NumJokerRetry[1] > 0 && _PartyMode.GameData.CurrentRoundNr > 1; } private void _NextRound() @@ -658,8 +644,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe var check = new List(); for (int j = 0; j < _Possibilities.GetLength(1); j++) { - if (_Fields[_Possibilities[i, j]].Content.Winner > 0) - check.Add(_Fields[_Possibilities[i, j]].Content.Winner); + if (_PartyMode.GameData.Rounds[_Possibilities[i, j]].Winner > 0) + check.Add(_PartyMode.GameData.Rounds[_Possibilities[i, j]].Winner); } if (check.Count != _Possibilities.GetLength(1)) continue; diff --git a/Vocaluxe/Lib/Draw/CTextureProvider.cs b/Vocaluxe/Lib/Draw/CTextureProvider.cs index e5d61f65..52fb5226 100644 --- a/Vocaluxe/Lib/Draw/CTextureProvider.cs +++ b/Vocaluxe/Lib/Draw/CTextureProvider.cs @@ -357,7 +357,7 @@ namespace Vocaluxe.Lib.Draw /// protected CTextureRef _GetTextureReference(Size origSize, TTextureType texture) { - Debug.Assert(origSize.Width > 0 && origSize.Height > 0); + Debug.Assert(origSize.Width > 0 && origSize.Height > 0 || origSize.Width == -1 && origSize.Height == -1); Debug.Assert(texture != null); int id; lock (_MutexID) diff --git a/Vocaluxe/Screens/CScreenCredits.cs b/Vocaluxe/Screens/CScreenCredits.cs index 7b9eb5cd..e65d33c8 100644 --- a/Vocaluxe/Screens/CScreenCredits.cs +++ b/Vocaluxe/Screens/CScreenCredits.cs @@ -251,6 +251,7 @@ namespace Vocaluxe.Screens } CBackground bg = new CBackground(_BGTheme, -1); + bg.LoadSkin(); _AddBackground(bg); //Vocaluxe-Logo diff --git a/VocaluxeLib/IBasic.cs b/VocaluxeLib/IBasic.cs index d4e367fc..5262668b 100644 --- a/VocaluxeLib/IBasic.cs +++ b/VocaluxeLib/IBasic.cs @@ -238,6 +238,7 @@ namespace VocaluxeLib CSong GetVisibleSong(int visibleIndex); CSong GetSongByID(int songID); + ReadOnlyCollection GetSongs(); ReadOnlyCollection GetVisibleSongs(); CCategory GetCategory(int index); diff --git a/VocaluxeLib/Menu/CBackground.cs b/VocaluxeLib/Menu/CBackground.cs index c6892bf6..548d10fa 100644 --- a/VocaluxeLib/Menu/CBackground.cs +++ b/VocaluxeLib/Menu/CBackground.cs @@ -84,8 +84,6 @@ namespace VocaluxeLib.Menu _PartyModeID = partyModeID; ThemeLoaded = true; - - LoadSkin(); } #endregion Constructors diff --git a/VocaluxeLib/Menu/CMenuPartyNameSelection.cs b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs index 698c5a99..6e3d1090 100644 --- a/VocaluxeLib/Menu/CMenuPartyNameSelection.cs +++ b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs @@ -667,6 +667,7 @@ namespace VocaluxeLib.Menu _CurrentTeam = _SelectSlides[_SelectSlideTeams].Selection; _UpdatePlayerSlide(); + _UpdateButtonState(); } private void _UpdatePlayerSlide()