Fixed player-handling in tic-tac-toe.

This commit is contained in:
Florian Küpper committed 2013-06-16 15:24:23 +02:00
1 parent 622de6ec4d
commit 0b89f65ea8
3 files changed
+50 -59

No files matched your search

@@ -727,7 +727,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
if (players.Length < 2)
return;
CProfile[] profiles = CBase.Profiles.GetProfiles();
CRound r = _GameData.Rounds[roundNr];
bool isDuet = CBase.Songs.GetSongByID(r.SongID).IsDuet;
@@ -740,18 +739,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe
//try to fill with the right data
if (r != null)
{
if (_GameData.ProfileIDsTeam1[r.SingerTeam1] < profiles.Length)
{
players[0].ProfileID = _GameData.ProfileIDsTeam1[r.SingerTeam1];
if (isDuet)
players[0].LineNr = 0;
}
if (_GameData.ProfileIDsTeam2[r.SingerTeam2] < profiles.Length)
{
players[1].ProfileID = _GameData.ProfileIDsTeam2[r.SingerTeam2];
if (isDuet)
players[1].LineNr = 1;
}
players[0].ProfileID = _GameData.ProfileIDsTeam1[r.SingerTeam1];
if (isDuet)
players[0].LineNr = 0;
players[1].ProfileID = _GameData.ProfileIDsTeam2[r.SingerTeam2];
if (isDuet)
players[1].LineNr = 1;
SongSelected(r.SongID);
}
}
@@ -494,17 +494,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_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;
_UpdatePlayerInformation();
}
int songID = 0;
@@ -553,17 +543,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_GameData.Rounds[_SelectedField].SingerTeam2 = _GameData.Rounds[_OldSelectedField].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;
_UpdatePlayerInformation();
_UpdateJokerButtons();
@@ -574,6 +554,20 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_SetInteractionToButton(_Buttons[_ButtonNextRound]);
}
private void _UpdatePlayerInformation()
{
_Texts[_TextNextPlayerT1].Visible = true;
_Texts[_TextNextPlayerT2].Visible = true;
_Texts[_TextNextPlayerNameT1].Visible = true;
_Texts[_TextNextPlayerNameT2].Visible = true;
_Texts[_TextNextPlayerNameT1].Text = CBase.Profiles.GetPlayerName(_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]);
_Texts[_TextNextPlayerNameT2].Text = CBase.Profiles.GetPlayerName(_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]);
_Statics[_StaticAvatarT1].Visible = true;
_Statics[_StaticAvatarT2].Visible = true;
_Statics[_StaticAvatarT1].Texture = CBase.Profiles.GetAvatar(_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]);
_Statics[_StaticAvatarT2].Texture = CBase.Profiles.GetAvatar(_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]);
}
private void _UseJoker(int teamNr, int jokerNum)
{
switch (jokerNum)
@@ -187,7 +187,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_ChooseAvatarStatic.Rect = chooseButton.Button.Rect;
_ChooseAvatarStatic.Rect.Z = -100;
_ChooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
_ChooseAvatarStatic.Texture = CBase.Profiles.GetProfiles()[_SelectedPlayerNr].Avatar.Texture;
_ChooseAvatarStatic.Texture = CBase.Profiles.GetAvatar(_SelectedPlayerNr);
}
}
}
@@ -254,7 +254,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1);
_PlayerDestinationButtons[added].Texture = _ChooseAvatarStatic.Texture;
_PlayerDestinationButtons[added].SelTexture = _ChooseAvatarStatic.Texture;
_PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[_SelectedPlayerNr].PlayerName;
_PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetPlayerName(_SelectedPlayerNr);
_PlayerDestinationButtons[added].Enabled = true;
//Update Tiles-List
_UpdateButtonPlayerChoose();
@@ -414,12 +414,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{
if ((i + offset * numButtonPlayerChoose) < _PlayerChooseButtonsVisibleProfiles.Count)
{
_PlayerChooseButtons[i].ProfileID = _PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose];
_PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].PlayerName;
_PlayerChooseButtons[i].Button.Texture =
CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture;
_PlayerChooseButtons[i].Button.SelTexture =
CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture;
int id = _PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose];
_PlayerChooseButtons[i].ProfileID = id;
_PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetPlayerName(id);
_PlayerChooseButtons[i].Button.Texture = CBase.Profiles.GetAvatar(id);
_PlayerChooseButtons[i].Button.SelTexture = CBase.Profiles.GetAvatar(id);
_PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 0.6f);
_PlayerChooseButtons[i].Button.SelColor = new SColorF(1, 1, 1, 1);
_PlayerChooseButtons[i].Button.Enabled = true;
@@ -441,14 +440,15 @@ namespace VocaluxeLib.PartyModes.TicTacToe
private void _UpdateVisibleProfiles()
{
_PlayerChooseButtonsVisibleProfiles.Clear();
for (int i = 0; i < CBase.Profiles.GetProfiles().Length; i++)
Profile.CProfile[] profiles = CBase.Profiles.GetProfiles();
for (int i = 0; i < profiles.Length; i++)
{
bool visible = false;
//Show profile only if active
if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON)
visible = _Data.ScreenNames.ProfileIDsTeam1.All(t => t != i) && _Data.ScreenNames.ProfileIDsTeam2.All(t => t != i);
if (profiles[i].Active == EOffOn.TR_CONFIG_ON)
visible = _Data.ScreenNames.ProfileIDsTeam1.All(profileID => profileID != profiles[i].ID) && _Data.ScreenNames.ProfileIDsTeam2.All(profileID => profileID != profiles[i].ID);
if (visible)
_PlayerChooseButtonsVisibleProfiles.Add(i);
_PlayerChooseButtonsVisibleProfiles.Add(profiles[i].ID);
}
}
@@ -486,11 +486,12 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{
if (_Data.ScreenNames.ProfileIDsTeam1[i] != -1)
{
int id = _Data.ScreenNames.ProfileIDsTeam1[i];
_PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f);
_PlayerDestinationButtons[i].SelColor = new SColorF(1, 1, 1, 1);
_PlayerDestinationButtons[i].Texture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam1[i]].Avatar.Texture;
_PlayerDestinationButtons[i].SelTexture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam1[i]].Avatar.Texture;
_PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam1[i]].PlayerName;
_PlayerDestinationButtons[i].Texture = CBase.Profiles.GetAvatar(id);
_PlayerDestinationButtons[i].SelTexture = CBase.Profiles.GetAvatar(id);
_PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetPlayerName(id);
_PlayerDestinationButtons[i].Enabled = true;
}
}
@@ -510,11 +511,12 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{
if (_Data.ScreenNames.ProfileIDsTeam2[i] != -1)
{
int id = _Data.ScreenNames.ProfileIDsTeam2[i];
_PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Color = new SColorF(1, 1, 1, 0.6f);
_PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].SelColor = new SColorF(1, 1, 1, 1);
_PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Texture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam2[i]].Avatar.Texture;
_PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].SelTexture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam2[i]].Avatar.Texture;
_PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Text.Text = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam2[i]].PlayerName;
_PlayerDestinationButtons[i].Texture = CBase.Profiles.GetAvatar(id);
_PlayerDestinationButtons[i].SelTexture = CBase.Profiles.GetAvatar(id);
_PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetPlayerName(id);
_PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Enabled = true;
}
}
@@ -553,9 +555,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
//Update texture and name
_PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
_PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1);
_PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].Avatar.Texture;
_PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].Avatar.Texture;
_PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].PlayerName;
_PlayerDestinationButtons[added].Texture = CBase.Profiles.GetAvatar(chooseButton.ProfileID);
_PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetAvatar(chooseButton.ProfileID);
_PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetPlayerName(chooseButton.ProfileID);
_PlayerDestinationButtons[added].Enabled = true;
//Update Tiles-List
_UpdateButtonPlayerChoose();
@@ -570,9 +572,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
//Update texture and name
_PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
_PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1);
_PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].Avatar.Texture;
_PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].Avatar.Texture;
_PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].PlayerName;
_PlayerDestinationButtons[added].Texture = CBase.Profiles.GetAvatar(chooseButton.ProfileID);
_PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetAvatar(chooseButton.ProfileID);
_PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetPlayerName(chooseButton.ProfileID);
_PlayerDestinationButtons[added].Enabled = true;
//Update Tiles-List
_UpdateButtonPlayerChoose();