Fix wrong song played in TicTacToe
This commit is contained in:
1 parent
3402c7b4c4
commit
5f96ac77b5
2 files changed
+65
-77
No files matched your search
@@ -17,6 +17,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
@@ -105,7 +106,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
public List<int> Songs;
|
||||
|
||||
public int CurrentRoundNr;
|
||||
public int SingRoundNr;
|
||||
public int FieldNr;
|
||||
|
||||
public int[] NumJokerRandom;
|
||||
public int[] NumJokerRetry;
|
||||
@@ -136,7 +137,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
PlayerTeam1 = new List<int>(),
|
||||
PlayerTeam2 = new List<int>(),
|
||||
CurrentRoundNr = 0,
|
||||
SingRoundNr = 0,
|
||||
FieldNr = 0,
|
||||
SongSource = ESongSource.TR_ALLSONGS,
|
||||
PlaylistID = 0,
|
||||
CategoryID = 0,
|
||||
@@ -195,7 +196,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
private void _FadeToScreen()
|
||||
{
|
||||
if(CBase.Graphics.GetNextScreen() != _GetNextScreen())
|
||||
if (CBase.Graphics.GetNextScreen() != _GetNextScreen())
|
||||
CBase.Graphics.FadeTo(_GetNextScreen());
|
||||
}
|
||||
|
||||
@@ -218,7 +219,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
break;
|
||||
case EStage.Main:
|
||||
_Stage = EStage.Singing;
|
||||
_StartRound(GameData.SingRoundNr);
|
||||
_StartRound(GameData.FieldNr);
|
||||
break;
|
||||
case EStage.Singing:
|
||||
_Stage = EStage.Main;
|
||||
@@ -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()
|
||||
@@ -559,8 +533,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 +543,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 +599,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 +609,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--;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
private float _FieldSize = 100;
|
||||
|
||||
private int _PreviewStream = -1;
|
||||
private int _SelectedField = -1;
|
||||
private int _OldSelectedField = -1;
|
||||
|
||||
private int[,] _Possibilities;
|
||||
@@ -152,7 +151,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
case EStatus.FieldChoosing:
|
||||
if (_Fields[i].Button.Selected)
|
||||
{
|
||||
_SelectedField = i;
|
||||
_PartyMode.GameData.FieldNr = i;
|
||||
_FieldSelected();
|
||||
}
|
||||
break;
|
||||
@@ -160,7 +159,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
case EStatus.JokerRetry:
|
||||
if (_Fields[i].Button.Selected)
|
||||
{
|
||||
_SelectedField = i;
|
||||
_PartyMode.GameData.FieldNr = i;
|
||||
_FieldSelectedAgain();
|
||||
}
|
||||
break;
|
||||
@@ -217,7 +216,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
case EStatus.FieldChoosing:
|
||||
if (_Fields[i].Button.Selected)
|
||||
{
|
||||
_SelectedField = i;
|
||||
_PartyMode.GameData.FieldNr = i;
|
||||
_FieldSelected();
|
||||
}
|
||||
break;
|
||||
@@ -225,7 +224,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
case EStatus.JokerRetry:
|
||||
if (_Fields[i].Button.Selected)
|
||||
{
|
||||
_SelectedField = i;
|
||||
_PartyMode.GameData.FieldNr = i;
|
||||
_FieldSelectedAgain();
|
||||
}
|
||||
break;
|
||||
@@ -281,7 +280,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]);
|
||||
@@ -419,7 +418,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_Fields[i].Button.Color = CBase.Themes.GetPlayerColor(_Fields[i].Content.Winner);
|
||||
_Fields[i].Button.SelColor = CBase.Themes.GetPlayerColor(_Fields[i].Content.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);
|
||||
@@ -456,8 +455,8 @@ 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();
|
||||
}
|
||||
@@ -470,8 +469,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
_StartPreview(songID);
|
||||
_Status = EStatus.FieldSelected;
|
||||
_Fields[_SelectedField].Content.SongID = songID;
|
||||
_PartyMode.GameData.Rounds[_SelectedField].SongID = songID;
|
||||
_Fields[_PartyMode.GameData.FieldNr].Content.SongID = songID;
|
||||
_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SongID = songID;
|
||||
_UpdateFieldContents();
|
||||
_UpdateJokerButtons();
|
||||
|
||||
@@ -484,13 +483,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
private void _FieldSelectedAgain()
|
||||
{
|
||||
int songID = _Fields[_SelectedField].Content.SongID;
|
||||
int songID = _Fields[_PartyMode.GameData.FieldNr].Content.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;
|
||||
_Fields[_PartyMode.GameData.FieldNr].Content.SongID = songID;
|
||||
_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 +521,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 +555,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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user