Change behavior on ScreenNames: Only show active profiles, you could select every profile only one time, except guest-profiles.

This commit is contained in:
Florian Kuepper committed 2012-04-12 11:42:48 +02:00
1 parent f597cc55e2
commit ddee8f5fae
2 files changed
+66 -9

No files matched your search

+50 -5
View File
@@ -73,6 +73,8 @@ namespace Vocaluxe.Menu
int _player = -1; int _player = -1;
private List<int> VisibleProfiles;
public CNameSelection() public CNameSelection()
{ {
@@ -81,6 +83,8 @@ namespace Vocaluxe.Menu
_TextureEmptyTile = CTheme.GetSkinTexture(_Theme.TextureEmptyTileName); _TextureEmptyTile = CTheme.GetSkinTexture(_Theme.TextureEmptyTileName);
_Tiles = new List<CTile>(); _Tiles = new List<CTile>();
VisibleProfiles = new List<int>();
} }
public void Init() public void Init()
@@ -97,6 +101,8 @@ namespace Vocaluxe.Menu
} }
} }
UpdateVisibleProfiles();
UpdateList(0); UpdateList(0);
} }
@@ -361,22 +367,35 @@ namespace Vocaluxe.Menu
} }
} }
public void UpdateList()
{
UpdateVisibleProfiles();
if (_Tiles.Count * (_Offset + 1) - VisibleProfiles.Count >= _Tiles.Count * _Offset)
{
UpdateList(_Offset - 1);
}
else
{
UpdateList(_Offset);
}
}
public void UpdateList(int offset) public void UpdateList(int offset)
{ {
if (offset < 0) if (offset < 0)
offset = 0; offset = 0;
if ( _Tiles.Count * (offset + 1) - CProfiles.Profiles.Length < _Tiles.Count) if ( _Tiles.Count * (offset + 1) - VisibleProfiles.Count < _Tiles.Count)
{ {
for (int i = 0; i < _Tiles.Count; i++) for (int i = 0; i < _Tiles.Count; i++)
{ {
if ((i + offset * _Tiles.Count) < CProfiles.Profiles.Length) if ((i + offset * _Tiles.Count) < VisibleProfiles.Count)
{ {
_Tiles[i].Avatar.Texture = CProfiles.Profiles[i + offset * _Tiles.Count].Avatar.Texture; _Tiles[i].Avatar.Texture = CProfiles.Profiles[VisibleProfiles[i + offset * _Tiles.Count]].Avatar.Texture;
_Tiles[i].Avatar.Color = new SColorF(1, 1, 1, 1); _Tiles[i].Avatar.Color = new SColorF(1, 1, 1, 1);
_Tiles[i].Name.Text = CProfiles.Profiles[i + offset * _Tiles.Count].PlayerName; _Tiles[i].Name.Text = CProfiles.Profiles[VisibleProfiles[i + offset * _Tiles.Count]].PlayerName;
_Tiles[i].PlayerNr = i + offset * _Tiles.Count; _Tiles[i].PlayerNr = VisibleProfiles[i + offset * _Tiles.Count];
} }
else else
{ {
@@ -449,6 +468,32 @@ namespace Vocaluxe.Menu
LoadTextures(); LoadTextures();
} }
private void UpdateVisibleProfiles()
{
VisibleProfiles.Clear();
for (int i = 0; i < CProfiles.Profiles.Length; i++)
{
bool visible = false;
//Show profile only if active
if (CProfiles.Profiles[i].Active == EOffOn.TR_CONFIG_ON)
{
visible = true;
}
for (int p = 0; p < CGame.NumPlayer; p++)
{
//Don't show profile if is selected, but if selected and guest
if (CGame.Player[p].ProfileID == i && CProfiles.Profiles[i].GuestProfile == EOffOn.TR_CONFIG_OFF)
{
visible = false;
}
}
if (visible)
{
VisibleProfiles.Add(i);
}
}
}
#region ThemeEdit #region ThemeEdit
public void MoveElement(int stepX, int stepY) public void MoveElement(int stepX, int stepY)
{ {
+16 -4
View File
@@ -111,18 +111,20 @@ namespace Vocaluxe.Screens
case Keys.Add: case Keys.Add:
if (CConfig.NumPlayer + 1 <= CSettings.MaxNumPlayer) if (CConfig.NumPlayer + 1 <= CSettings.MaxNumPlayer)
{ {
CConfig.NumPlayer++; SelectSlides[htSelectSlides(SelectSlidePlayerNumber)].Selection = CConfig.NumPlayer;
SelectSlides[htSelectSlides(SelectSlidePlayerNumber)].Selection = CConfig.NumPlayer - 1;
UpdatePlayerNumber(); UpdatePlayerNumber();
//Update Tiles-List
NameSelections[htNameSelections(NameSelection)].UpdateList();
} }
break; break;
case Keys.Subtract: case Keys.Subtract:
if (CConfig.NumPlayer - 1 > 0) if (CConfig.NumPlayer - 1 > 0)
{ {
CConfig.NumPlayer--; SelectSlides[htSelectSlides(SelectSlidePlayerNumber)].Selection = CConfig.NumPlayer - 2;
SelectSlides[htSelectSlides(SelectSlidePlayerNumber)].Selection = CConfig.NumPlayer - 1;
UpdatePlayerNumber(); UpdatePlayerNumber();
//Update Tiles-List
NameSelections[htNameSelections(NameSelection)].UpdateList();
} }
break; break;
} }
@@ -150,6 +152,8 @@ namespace Vocaluxe.Screens
Texts[htTexts(TextPlayer[selectingKeyboardPlayerNr-1])].Text = CProfiles.Profiles[SelectedPlayerNr].PlayerName; Texts[htTexts(TextPlayer[selectingKeyboardPlayerNr-1])].Text = CProfiles.Profiles[SelectedPlayerNr].PlayerName;
//Update profile-warning //Update profile-warning
CheckPlayers(); CheckPlayers();
//Update Tiles-List
NameSelections[htNameSelections(NameSelection)].UpdateList();
} }
//Reset all values //Reset all values
selectingKeyboardPlayerNr = 0; selectingKeyboardPlayerNr = 0;
@@ -271,6 +275,8 @@ namespace Vocaluxe.Screens
selectingKeyboardPlayerNr = 0; selectingKeyboardPlayerNr = 0;
selectingKeyboardActive = false; selectingKeyboardActive = false;
NameSelections[htNameSelections(NameSelection)].KeyboardSelection(false, -1); NameSelections[htNameSelections(NameSelection)].KeyboardSelection(false, -1);
//Update Tiles-List
NameSelections[htNameSelections(NameSelection)].UpdateList();
break; break;
} }
@@ -414,6 +420,8 @@ namespace Vocaluxe.Screens
Texts[htTexts(TextPlayer[i])].Text = CProfiles.Profiles[SelectedPlayerNr].PlayerName; Texts[htTexts(TextPlayer[i])].Text = CProfiles.Profiles[SelectedPlayerNr].PlayerName;
//Update profile-warning //Update profile-warning
CheckPlayers(); CheckPlayers();
//Update Tiles-List
NameSelections[htNameSelections(NameSelection)].UpdateList();
} }
} }
} }
@@ -447,6 +455,8 @@ namespace Vocaluxe.Screens
if (!processed) if (!processed)
UpdatePlayerNumber(); UpdatePlayerNumber();
//Update Tiles-List
NameSelections[htNameSelections(NameSelection)].UpdateList();
} }
if (MouseEvent.RB) if (MouseEvent.RB)
@@ -469,6 +479,8 @@ namespace Vocaluxe.Screens
Texts[htTexts(TextPlayer[i])].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + (i+1).ToString(); Texts[htTexts(TextPlayer[i])].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + (i+1).ToString();
//Update profile-warning //Update profile-warning
CheckPlayers(); CheckPlayers();
//Update Tiles-List
NameSelections[htNameSelections(NameSelection)].UpdateList();
exit = false; exit = false;
} }
} }