From 4ba69da46edd4f92f30009edfa401f0db27f980d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Thu, 23 May 2013 15:05:47 +0200 Subject: [PATCH] Fixed changed-player-bug when using random-joker in tic-tac-toe. --- .../CPartyScreenTicTacToeMain.cs | 64 ++++++++++--------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs index fbc40e5a..26deb9ea 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs @@ -473,27 +473,46 @@ namespace VocaluxeLib.PartyModes.TicTacToe } } - private void _FieldSelected() + private void _FieldSelected(bool jokerUsed = false) { + if (!jokerUsed) + { + int singerTeam1 = 0; + int singerTeam2 = 0; + + if (_GameData.PlayerTeam1.Count > 0) + { + singerTeam1 = _GameData.PlayerTeam1[0]; + _GameData.PlayerTeam1.RemoveAt(0); + } + + if (_GameData.PlayerTeam2.Count > 0) + { + singerTeam2 = _GameData.PlayerTeam2[0]; + _GameData.PlayerTeam2.RemoveAt(0); + } + _GameData.Rounds[_SelectedField].SingerTeam1 = singerTeam1; + _GameData.Rounds[_SelectedField].SingerTeam2 = singerTeam2; + + _Texts[_TextNextPlayerT1].Visible = true; + _Texts[_TextNextPlayerT2].Visible = true; + _Texts[_TextNextPlayerNameT1].Visible = true; + _Texts[_TextNextPlayerNameT2].Visible = true; + CProfile[] profiles = CBase.Profiles.GetProfiles(); + _Texts[_TextNextPlayerNameT1].Text = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].PlayerName; + _Texts[_TextNextPlayerNameT2].Text = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].PlayerName; + _Statics[_StaticAvatarT1].Visible = true; + _Statics[_StaticAvatarT2].Visible = true; + _Statics[_StaticAvatarT1].Texture = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].Avatar.Texture; + _Statics[_StaticAvatarT2].Texture = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].Avatar.Texture; + + } int songID = 0; - int singerTeam1 = 0; - int singerTeam2 = 0; if (_GameData.Songs.Count > 0) { songID = _GameData.Songs[0]; _GameData.Songs.RemoveAt(0); } - if (_GameData.PlayerTeam1.Count > 0) - { - singerTeam1 = _GameData.PlayerTeam1[0]; - _GameData.PlayerTeam1.RemoveAt(0); - } - - if (_GameData.PlayerTeam2.Count > 0) - { - singerTeam2 = _GameData.PlayerTeam2[0]; - _GameData.PlayerTeam2.RemoveAt(0); - } CSong song = CBase.Songs.GetSongByID(songID); CBase.BackgroundMusic.SetStatus(true); @@ -506,22 +525,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe _Status = EStatus.FieldSelected; _Fields[_SelectedField].Content.SongID = songID; _GameData.Rounds[_SelectedField].SongID = songID; - _GameData.Rounds[_SelectedField].SingerTeam1 = singerTeam1; - _GameData.Rounds[_SelectedField].SingerTeam2 = singerTeam2; _UpdateFieldContents(); - - _Texts[_TextNextPlayerT1].Visible = true; - _Texts[_TextNextPlayerT2].Visible = true; - _Texts[_TextNextPlayerNameT1].Visible = true; - _Texts[_TextNextPlayerNameT2].Visible = true; - CProfile[] profiles = CBase.Profiles.GetProfiles(); - _Texts[_TextNextPlayerNameT1].Text = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].PlayerName; - _Texts[_TextNextPlayerNameT2].Text = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].PlayerName; - _Statics[_StaticAvatarT1].Visible = true; - _Statics[_StaticAvatarT2].Visible = true; - _Statics[_StaticAvatarT1].Texture = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].Avatar.Texture; - _Statics[_StaticAvatarT2].Texture = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].Avatar.Texture; - _UpdateJokerButtons(); _Buttons[_ButtonNextRound].Visible = true; @@ -581,7 +585,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe _GameData.NumJokerRandom[teamNr]--; if (!CBase.Sound.IsFinished(_PreviewStream)) CBase.Sound.FadeAndStop(_PreviewStream, 0, 1); - _FieldSelected(); + _FieldSelected(true); } break;