Merge pull request #74 from flokuep/release-0.3

Release 0.3
This commit is contained in:
Alexander Eckart committed 2013-06-27 10:25:14 -07:00
commit c6f9289590
7 files changed
+127 -181

No files matched your search

+1
View File
@@ -92,6 +92,7 @@
<string name="TR_SCREENPARTY_AUTHOR">Author</string>
<string name="TR_SCREENPARTY_VERSION">Version</string>
<string name="TR_SCREENPARTY_ERROR">Can't load this party-mode.</string>
<string name="TR_SCREENPARTY_ERROR_MICS">There are no mics configured!</string>
<string name="TR_SCREENPARTY_TARGETAUDIENCE">Target audience</string>
<string name="TR_SCREENPARTY_NOTEAMS">No teams</string>
<string name="TR_SCREENPARTY_NUMTEAMS">Number of teams</string>
@@ -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();
+5
View File
@@ -481,6 +481,11 @@ namespace Vocaluxe.Base
return _Profiles[profileID].Avatar.ID;
}
public static int GetProfileID(int num)
{
return _Profiles[num].ID;
}
#endregion profile properties
#region avatar texture
+60 -111
View File
@@ -62,7 +62,7 @@ namespace Vocaluxe.Screens
private bool _SelectingFast;
private int _SelectingSwitchNr = -1;
private int _SelectingFastPlayerNr;
private int _SelectedPlayerNr = -1;
private int _SelectedProfileID = -1;
private bool _AvatarsChanged;
private bool _ProfilesChanged;
@@ -177,23 +177,13 @@ namespace Vocaluxe.Screens
//Check, if a player is selected
if (_NameSelections[_NameSelection].Selection > -1)
{
CProfile[] profiles = CProfiles.GetProfiles();
_SelectedPlayerNr = _NameSelections[_NameSelection].Selection;
if (profiles.Length <= _SelectedPlayerNr)
_SelectedProfileID = _NameSelections[_NameSelection].Selection;
if (!CProfiles.IsProfileIDValid(_SelectedProfileID))
return true;
//Update Game-infos with new player
CGame.Players[_SelectingFastPlayerNr - 1].ProfileID = profiles[_SelectedPlayerNr].ID;
//Update config for default players.
CConfig.Players[_SelectingFastPlayerNr - 1] = profiles[_SelectedPlayerNr].FileName;
CConfig.SaveConfig();
//Update texture and name
_Statics[_StaticPlayerAvatar[_SelectingFastPlayerNr - 1]].Texture = profiles[_SelectedPlayerNr].Avatar.Texture;
_Texts[_TextPlayer[_SelectingFastPlayerNr - 1]].Text = profiles[_SelectedPlayerNr].PlayerName;
//Update profile-warning
_CheckPlayers();
//Update Tiles-List
_NameSelections[_NameSelection].UpdateList();
_UpdateSelectedProfile(_SelectingFastPlayerNr - 1, _SelectedProfileID);
_SetInteractionToButton(_Buttons[_ButtonStart]);
}
//Started selecting with 'P'
@@ -242,15 +232,7 @@ namespace Vocaluxe.Screens
case Keys.Delete:
//Delete profile-selection
CGame.Players[_SelectingFastPlayerNr - 1].ProfileID = -1;
//Update config for default players.
CConfig.Players[_SelectingFastPlayerNr - 1] = String.Empty;
CConfig.SaveConfig();
//Update texture and name
_Statics[_StaticPlayerAvatar[_SelectingFastPlayerNr - 1]].Texture = _OriginalPlayerAvatarTextures[_SelectingFastPlayerNr - 1];
_Texts[_TextPlayer[_SelectingFastPlayerNr - 1]].Text = CProfiles.GetPlayerName(-1, _SelectingFastPlayerNr);
//Update profile-warning
_CheckPlayers();
_ResetPlayerSelection(_SelectingFastPlayerNr - 1);
//Reset all values
_SelectingFastPlayerNr = 0;
_SelectingKeyboardActive = false;
@@ -365,7 +347,7 @@ namespace Vocaluxe.Screens
base.HandleMouse(mouseEvent);
//Check if LeftButton is hold and Select-Mode inactive
if (mouseEvent.LBH && _SelectedPlayerNr < 0 && !_SelectingFast)
if (mouseEvent.LBH && _SelectedProfileID < 0 && !_SelectingFast)
{
//Save mouse-coords
_OldMouseX = mouseEvent.X;
@@ -374,8 +356,8 @@ namespace Vocaluxe.Screens
if (_NameSelections[_NameSelection].IsOverTile(mouseEvent))
{
//Get player-number of tile
_SelectedPlayerNr = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
if (_SelectedPlayerNr != -1)
_SelectedProfileID = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
if (_SelectedProfileID != -1)
{
//Update of Drag/Drop-Texture
CStatic selectedPlayer = _NameSelections[_NameSelection].TilePlayerAvatar(mouseEvent);
@@ -393,7 +375,7 @@ namespace Vocaluxe.Screens
if (CHelper.IsInBounds(_Statics[_StaticPlayer[i]].Rect, mouseEvent))
{
_SelectingSwitchNr = i;
_SelectedPlayerNr = CGame.Players[i].ProfileID;
_SelectedProfileID = CGame.Players[i].ProfileID;
//Update of Drag/Drop-Texture
CStatic selectedPlayer = _Statics[_StaticPlayerAvatar[i]];
_ChooseAvatarStatic.Visible = true;
@@ -408,7 +390,7 @@ namespace Vocaluxe.Screens
}
//Check if LeftButton is hold and Select-Mode active
if (mouseEvent.LBH && _SelectedPlayerNr >= 0 && !_SelectingFast)
if (mouseEvent.LBH && _SelectedProfileID >= 0 && !_SelectingFast)
{
//Update coords for Drag/Drop-Texture
_ChooseAvatarStatic.Rect.X += mouseEvent.X - _OldMouseX;
@@ -417,7 +399,7 @@ namespace Vocaluxe.Screens
_OldMouseY = mouseEvent.Y;
}
// LeftButton isn't hold anymore, but Select-Mode is still active -> "Drop" of Avatar
else if (_SelectedPlayerNr >= 0 && !_SelectingFast)
else if (_SelectedProfileID >= 0 && !_SelectingFast)
{
//Foreach Drop-Area
for (int i = 0; i < _StaticPlayer.Length; i++)
@@ -430,58 +412,27 @@ namespace Vocaluxe.Screens
{
if (_SelectingSwitchNr > -1 && CGame.Players[i].ProfileID > -1)
{
//Update Game-infos with new player
CGame.Players[_SelectingSwitchNr].ProfileID = CGame.Players[i].ProfileID;
//Update config for default players.
CConfig.Players[_SelectingSwitchNr] = CProfiles.GetProfileFileName(CGame.Players[i].ProfileID);
//Update texture and name
_Statics[_StaticPlayerAvatar[_SelectingSwitchNr]].Texture = CProfiles.GetAvatarTextureFromProfile(CGame.Players[i].ProfileID);
_Texts[_TextPlayer[_SelectingSwitchNr]].Text = CProfiles.GetPlayerName(CGame.Players[i].ProfileID);
_UpdateSelectedProfile(_SelectingSwitchNr, CGame.Players[i].ProfileID);
}
else if (_SelectingSwitchNr > -1)
{
//Update Game-infos with new player
CGame.Players[_SelectingSwitchNr].ProfileID = -1;
//Update config for default players.
CConfig.Players[_SelectingSwitchNr] = string.Empty;
//Update texture and name
_Statics[_StaticPlayerAvatar[_SelectingSwitchNr]].Texture = _OriginalPlayerAvatarTextures[_SelectingSwitchNr];
_Texts[_TextPlayer[_SelectingSwitchNr]].Text = CProfiles.GetPlayerName(-1, (_SelectingSwitchNr + 1));
_ResetPlayerSelection(_SelectingSwitchNr);
}
CProfile[] profiles = CProfiles.GetProfiles();
if (profiles.Length <= _SelectedPlayerNr)
if (!CProfiles.IsProfileIDValid(_SelectedProfileID))
return true;
//Update Game-infos with new player
CGame.Players[i].ProfileID = profiles[_SelectedPlayerNr].ID;
//Update config for default players.
CConfig.Players[i] = profiles[_SelectedPlayerNr].FileName;
CConfig.SaveConfig();
//Update texture and name
_Statics[_StaticPlayerAvatar[i]].Texture = _ChooseAvatarStatic.Texture;
_Texts[_TextPlayer[i]].Text = profiles[_SelectedPlayerNr].PlayerName;
//Update profile-warning
_CheckPlayers();
//Update Tiles-List
_NameSelections[_NameSelection].UpdateList();
_UpdateSelectedProfile(i, _SelectedProfileID);
break;
}
//Selected player is dropped out of area
if (_SelectingSwitchNr > -1)
{
//Update Game-infos with new player
CGame.Players[_SelectingSwitchNr].ProfileID = -1;
//Update config for default players.
CConfig.Players[_SelectingSwitchNr] = string.Empty;
//Update texture and name
_Statics[_StaticPlayerAvatar[_SelectingSwitchNr]].Texture = _OriginalPlayerAvatarTextures[_SelectingSwitchNr];
_Texts[_TextPlayer[_SelectingSwitchNr]].Text = CProfiles.GetPlayerName(-1, (_SelectingSwitchNr + 1));
_NameSelections[_NameSelection].UpdateList();
_ResetPlayerSelection(_SelectingSwitchNr);
}
}
_SelectingSwitchNr = -1;
_SelectedPlayerNr = -1;
_SelectedProfileID = -1;
//Reset variables
_ChooseAvatarStatic.Visible = false;
}
@@ -491,25 +442,14 @@ namespace Vocaluxe.Screens
if (_NameSelections[_NameSelection].IsOverTile(mouseEvent))
{
//Get player-number of tile
_SelectedPlayerNr = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
if (_SelectedPlayerNr != -1)
_SelectedProfileID = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
if (_SelectedProfileID != -1)
{
CProfile[] profiles = CProfiles.GetProfiles();
if (profiles.Length <= _SelectedPlayerNr)
if (!CProfiles.IsProfileIDValid(_SelectedProfileID))
return true;
//Update Game-infos with new player
CGame.Players[_SelectingFastPlayerNr - 1].ProfileID = profiles[_SelectedPlayerNr].ID;
//Update config for default players.
CConfig.Players[_SelectingFastPlayerNr - 1] = profiles[_SelectedPlayerNr].FileName;
CConfig.SaveConfig();
//Update texture and name
_Statics[_StaticPlayerAvatar[_SelectingFastPlayerNr - 1]].Texture = profiles[_SelectedPlayerNr].Avatar.Texture;
_Texts[_TextPlayer[_SelectingFastPlayerNr - 1]].Text = profiles[_SelectedPlayerNr].PlayerName;
//Update profile-warning
_CheckPlayers();
//Update Tiles-List
_NameSelections[_NameSelection].UpdateList();
_UpdateSelectedProfile(_SelectingFastPlayerNr - 1, _SelectedProfileID);
_SelectingFastPlayerNr++;
if (_SelectingFastPlayerNr <= CGame.NumPlayer)
_NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr);
@@ -534,29 +474,17 @@ namespace Vocaluxe.Screens
if (mouseEvent.LD && _NameSelections[_NameSelection].IsOverTile(mouseEvent) && !_SelectingFast)
{
_SelectedPlayerNr = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
if (_SelectedPlayerNr > -1)
_SelectedProfileID = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
if (_SelectedProfileID > -1)
{
for (int i = 0; i < CGame.NumPlayer; i++)
{
if (CGame.Players[i].ProfileID == -1)
{
CProfile[] profiles = CProfiles.GetProfiles();
if (profiles.Length <= _SelectedPlayerNr)
if (!CProfiles.IsProfileIDValid(_SelectedProfileID))
return true;
//Update Game-infos with new player
CGame.Players[i].ProfileID = profiles[_SelectedPlayerNr].ID;
//Update config for default players.
CConfig.Players[i] = profiles[_SelectedPlayerNr].FileName;
CConfig.SaveConfig();
//Update texture and name
_Statics[_StaticPlayerAvatar[i]].Texture = profiles[_SelectedPlayerNr].Avatar.Texture;
_Texts[_TextPlayer[i]].Text = profiles[_SelectedPlayerNr].PlayerName;
//Update profile-warning
_CheckPlayers();
//Update Tiles-List
_NameSelections[_NameSelection].UpdateList();
_UpdateSelectedProfile(i, _SelectedProfileID);
break;
}
}
@@ -573,17 +501,7 @@ namespace Vocaluxe.Screens
{
if (CHelper.IsInBounds(_Statics[_StaticPlayer[i]].Rect, mouseEvent))
{
CGame.Players[i].ProfileID = -1;
//Update config for default players.
CConfig.Players[i] = String.Empty;
CConfig.SaveConfig();
//Update texture and name
_Statics[_StaticPlayerAvatar[i]].Texture = _OriginalPlayerAvatarTextures[i];
_Texts[_TextPlayer[i]].Text = CProfiles.GetPlayerName(-1, i + 1);
//Update profile-warning
_CheckPlayers();
//Update Tiles-List
_NameSelections[_NameSelection].UpdateList();
_ResetPlayerSelection(i);
exit = false;
}
}
@@ -760,6 +678,22 @@ namespace Vocaluxe.Screens
_CheckPlayers();
}
private void _UpdateSelectedProfile(int playerNum, int profileId)
{
//Update Game-infos with new player
CGame.Players[playerNum].ProfileID = profileId;
//Update config for default players.
CConfig.Players[playerNum] = CProfiles.GetProfileFileName(profileId);
CConfig.SaveConfig();
//Update texture and name
_Statics[_StaticPlayerAvatar[playerNum]].Texture = CProfiles.GetAvatarTextureFromProfile(profileId);
_Texts[_TextPlayer[playerNum]].Text = CProfiles.GetPlayerName(profileId);
//Update profile-warning
_CheckPlayers();
//Update Tiles-List
_NameSelections[_NameSelection].UpdateList();
}
private void _ResetPlayerSelections()
{
for (int i = 0; i < CGame.NumPlayer; i++)
@@ -775,6 +709,21 @@ namespace Vocaluxe.Screens
CConfig.SaveConfig();
}
private void _ResetPlayerSelection(int playerNum)
{
CGame.Players[playerNum].ProfileID = -1;
//Update config for default players.
CConfig.Players[playerNum] = String.Empty;
CConfig.SaveConfig();
//Update texture and name
_Statics[_StaticPlayerAvatar[playerNum]].Texture = _OriginalPlayerAvatarTextures[playerNum];
_Texts[_TextPlayer[playerNum]].Text = CProfiles.GetPlayerName(-1, playerNum + 1);
//Update profile-warning
_CheckPlayers();
//Update Tiles-List
_NameSelections[_NameSelection].UpdateList();
}
private void _CheckMics()
{
List<int> playerWithoutMicro = new List<int>();
+11 -11
View File
@@ -44,15 +44,15 @@ namespace VocaluxeLib.Menu
{
private class CTile
{
public int PlayerNr;
public int ProfileID;
public readonly CStatic Avatar;
public readonly CText Name;
public CTile(CStatic av, CText tex, int pl)
public CTile(CStatic av, CText tex, int pID)
{
Avatar = av;
Name = tex;
PlayerNr = pl;
ProfileID = pID;
}
}
@@ -281,7 +281,7 @@ namespace VocaluxeLib.Menu
case Keys.Right:
if (_ActualSelection + 1 < _Tiles.Count)
{
if (_Tiles[_ActualSelection + 1].PlayerNr != -1)
if (_Tiles[_ActualSelection + 1].ProfileID != -1)
_ActualSelection++;
}
else
@@ -316,7 +316,7 @@ namespace VocaluxeLib.Menu
case Keys.Down:
if (_ActualSelection + _NumW < _Tiles.Count)
{
if (_Tiles[_ActualSelection + _NumW].PlayerNr != -1)
if (_Tiles[_ActualSelection + _NumW].ProfileID != -1)
_ActualSelection += _NumW;
}
else
@@ -326,11 +326,11 @@ namespace VocaluxeLib.Menu
if (offset != Offset)
{
_ActualSelection = _ActualSelection - _Tiles.Count + _NumW;
if (_Tiles[_ActualSelection].PlayerNr == -1)
if (_Tiles[_ActualSelection].ProfileID == -1)
{
for (int i = _Tiles.Count - 1; i >= 0; i--)
{
if (_Tiles[i].PlayerNr != -1)
if (_Tiles[i].ProfileID != -1)
{
_ActualSelection = i;
break;
@@ -412,14 +412,14 @@ namespace VocaluxeLib.Menu
_Tiles[i].Avatar.Texture = CBase.Profiles.GetProfiles()[_VisibleProfiles[i + offset * _Tiles.Count]].Avatar.Texture;
_Tiles[i].Avatar.Color = new SColorF(1, 1, 1, 1);
_Tiles[i].Name.Text = CBase.Profiles.GetProfiles()[_VisibleProfiles[i + offset * _Tiles.Count]].PlayerName;
_Tiles[i].PlayerNr = _VisibleProfiles[i + offset * _Tiles.Count];
_Tiles[i].ProfileID = _VisibleProfiles[i + offset * _Tiles.Count];
}
else
{
_Tiles[i].Avatar.Texture = _TextureEmptyTile;
_Tiles[i].Avatar.Color = ColorEmptyTile;
_Tiles[i].Name.Text = "";
_Tiles[i].PlayerNr = -1;
_Tiles[i].ProfileID = -1;
}
}
Offset = offset;
@@ -441,7 +441,7 @@ namespace VocaluxeLib.Menu
foreach (CTile tile in _Tiles)
{
if (CHelper.IsInBounds(tile.Avatar.Rect, mevent))
return tile.PlayerNr;
return tile.ProfileID;
}
return -1;
@@ -515,7 +515,7 @@ namespace VocaluxeLib.Menu
}
}
if (visible)
_VisibleProfiles.Add(i);
_VisibleProfiles.Add(profiles[i].ID);
}
}