diff --git a/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeNames.xml b/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeNames.xml
index 2e73b1b1..93c1d892 100644
--- a/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeNames.xml
+++ b/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeNames.xml
@@ -57,163 +57,7 @@
-
-
-
- 58
- 375
-
- -1,00
-
- 20
-
-
-
- Player1
-
-
- TextSColor
-
- Center
-
- Center
-
-
-
- Outline
-
- TR_SCREENNAMES_TEAM1
-
-
-
-
-
-
- 58
- 500
-
- -1,00
-
- 20
-
-
-
- Player2
-
-
- TextSColor
-
- Center
-
- Center
-
-
-
- Outline
-
- TR_SCREENNAMES_TEAM2
-
-
-
-
-
-
- ScrollUp
-
- ScrollUp
-
- 609
- 90
- -0,01
- 28
- 15
-
-
- ButtonColor
-
-
- ButtonSColor
-
-
- 75
- 10
-
- 27
-
- 142
-
-
- ButtonTextColor
-
-
- ButtonTextSColor
-
- Center
-
- Center
-
-
-
- Outline
-
-
-
-
-
-
-
-
-
-
-
-
- ScrollDown
-
- ScrollDown
-
- 609
- 345
- -0,01
- 28
- 15
-
-
- ButtonColor
-
-
- ButtonSColor
-
-
- 75
- 10
-
- 27
-
- 142
-
-
- ButtonTextColor
-
-
- ButtonTextSColor
-
- Center
-
- Center
-
-
-
- Outline
-
-
-
-
-
-
-
-
-
-
+
Button
@@ -328,103 +172,183 @@
26
-
+
- CoverTile
-
- CoverTile
-
- 0
- 0
+ Invisible
+
+ SelectSlideArrowLeft
+
+ SelectSlideArrowRight
+
+ SelectSlide
+
+ SelectSlideArrowLeft
+
+ SelectSlideArrowRight
+
+ SelectSlide
+
+ 40
+ 100
0,00
- 100
- 100
-
+ 1200
+ 50
+
+ 45
+ 105
+ 0,00
+ 40
+ 40
+
+ 1170
+ 105
+ 0,00
+ 40
+ 40
+
- ButtonColor
-
+ SelectSlideColor
+
- ButtonSColor
-
-
- 50
- 102
-
- 20
-
- 98
-
-
- ButtonTextColor
-
-
- ButtonTextSColor
-
- Center
-
- Center
-
-
-
- Outline
-
-
-
-
-
-
-
-
-
-
-
+ SelectSlideSColor
+
+
+ SelectSlideHColor
+
+
+ ArrowColor
+
+
+ ArrowSColor
+
+
+ TextColor
+
+
+ TextSColor
+
+ 27,00
+
+
+
+ 205,33
+
+ Outline
+
+ Bold
+
+ 2
+
+
- CoverTile
-
- CoverTile
-
- 0
- 0
+ Invisible
+
+ SelectSlideArrowLeft
+
+ SelectSlideArrowRight
+
+ SelectSlidePlayer
+
+ SelectSlideArrowLeft
+
+ SelectSlideArrowRight
+
+ SelectSlidePlayer
+
+ 40
+ 160
0,00
- 100
- 100
-
+ 1200
+ 150
+
+ 45
+ 165
+ 0,00
+ 40
+ 40
+
+ 1170
+ 165
+ 0,00
+ 40
+ 40
+
- ButtonColor
-
+ SelectSlideColor
+
- ButtonSColor
-
-
- 50
- 102
-
- 20
-
- 98
-
-
- ButtonTextColor
-
-
- ButtonTextSColor
-
- Center
-
- Center
-
-
-
- Outline
-
-
-
-
-
-
-
-
-
-
+ SelectSlideSColor
+
+
+ SelectSlideHColor
+
+
+ ArrowColor
+
+
+ ArrowSColor
+
+
+ TextColor
+
+
+ TextSColor
+
+ 27,00
+
+
+ -5,00
+
+ 205,33
+
+ Outline
+
+ Bold
+
+ 3
+
+
+
+ 42
+ 327
+ 0,00
+ 1200
+ 393
+
+ CoverTile
+
+
+ 1,00
+ 1,00
+ 1,00
+ 0,20
+
+ PlayerSelector
+
+
+
+ 100
+ 100
+
+ 10
+ 2
+
+ 20,71
+ 30,00
+
+
+
+ 2,0
+
+ Outline
+
+ TextColor
+
+
+
+ 17
+
+
+
diff --git a/Output/PartyModes/TicTacToe/Textures/Skin.xml b/Output/PartyModes/TicTacToe/Textures/Skin.xml
index 4965d2eb..7cc7e4a2 100644
--- a/Output/PartyModes/TicTacToe/Textures/Skin.xml
+++ b/Output/PartyModes/TicTacToe/Textures/Skin.xml
@@ -222,8 +222,9 @@
ScrollUp.png
ScrollDown.png
Invisible.png
+ PlayerSelector.png
[Blue]BG_Video.mp4
-
\ No newline at end of file
+
diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs
index 4f8a86cd..0fd0d3cd 100644
--- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs
+++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs
@@ -25,7 +25,7 @@ using VocaluxeLib.Profile;
namespace VocaluxeLib.PartyModes.TicTacToe
{
// ReSharper disable UnusedMember.Global
- public class CPartyScreenTicTacToeNames : CMenuParty
+ public class CPartyScreenTicTacToeNames : CMenuPartyNameSelection
// ReSharper restore UnusedMember.Global
{
// Version number for theme files. Increment it, if you've changed something on the theme files!
@@ -34,38 +34,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
get { return 1; }
}
- private const string _ButtonNext = "ButtonNext";
- private const string _ButtonBack = "ButtonBack";
- private const string _ButtonPlayerDestination = "ButtonPlayerDestination";
- private const string _ButtonPlayerChoose = "ButtonPlayerChoose";
- private const string _ButtonPlayerChooseScrollUp = "ButtonPlayerChooseScrollUp";
- private const string _ButtonPlayerChooseScrollDown = "ButtonPlayerChooseScrollDown";
-
- private List _PlayerChooseButtons;
- private List _PlayerDestinationButtons;
- //PlayerDestinationButtons-Option
- private const int _PlayerDestinationButtonsNumH = 10;
- private const int _PlayerDestinationButtonsFirstX = 58;
- private const int _PlayerDestinationButtonsFirstY = 380;
- private const int _PlayerDestinationButtonsSpaceH = 15;
- private const int _PlayerDestinationButtonsSpaceW = 25;
- //PlayerChooseButtons-Option
- private List _PlayerChooseButtonsVisibleProfiles;
- private const int _PlayerChooseButtonsNumH = 10;
- private const int _PlayerChooseButtonsNumW = 2;
- private const int _PlayerChooseButtonsFirstX = 58;
- private const int _PlayerChooseButtonsFirstY = 105;
- private const int _PlayerChooseButtonsSpaceH = 15;
- private const int _PlayerChooseButtonsSpaceW = 25;
- private int _PlayerChooseButtonsOffset;
-
- private CStatic _ChooseAvatarStatic;
- private bool _SelectingMouseActive;
- private int _OldMouseX;
- private int _OldMouseY;
- private int _SelectedPlayerNr = -1;
- private bool _ButtonsAdded;
-
private int _NumPlayerTeam1 = 2;
private int _NumPlayerTeam2 = 2;
@@ -81,16 +49,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{
base.Init();
- _ChooseAvatarStatic = GetNewStatic();
- _ChooseAvatarStatic.Visible = false;
-
- _PlayerChooseButtonsVisibleProfiles = new List();
-
_Data.ScreenNames.ProfileIDsTeam1 = new List();
_Data.ScreenNames.ProfileIDsTeam2 = new List();
- _ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose, _ButtonPlayerChooseScrollUp, _ButtonPlayerChooseScrollDown};
-
_Data = new SDataFromScreen();
var names = new SFromScreenNames {FadeToConfig = false, ProfileIDsTeam1 = new List(), ProfileIDsTeam2 = new List()};
_Data.ScreenNames = names;
@@ -122,514 +83,33 @@ namespace VocaluxeLib.PartyModes.TicTacToe
}
}
- public override bool HandleInput(SKeyEvent keyEvent)
- {
- base.HandleInput(keyEvent);
-
- if (keyEvent.KeyPressed) {}
- else
- {
- switch (keyEvent.Key)
- {
- case Keys.Back:
- case Keys.Escape:
- _Back();
- break;
-
- case Keys.Enter:
- if (_Buttons[_ButtonBack].Selected)
- _Back();
-
- if (_Buttons[_ButtonNext].Selected)
- _Next();
-
- if (_Buttons[_ButtonPlayerChooseScrollUp].Selected)
- _Scroll(-1);
-
- if (_Buttons[_ButtonPlayerChooseScrollDown].Selected)
- _Scroll(1);
-
- if (!_OnAdd())
- _OnRemove();
- break;
-
- case Keys.Delete:
- _OnRemove();
- break;
- }
- }
- return true;
- }
-
- public override bool HandleMouse(SMouseEvent mouseEvent)
- {
- base.HandleMouse(mouseEvent);
-
- //Check if LeftButton is hold and Select-Mode inactive
- if (mouseEvent.LBH && !_SelectingMouseActive)
- {
- //Save mouse-coords
- _OldMouseX = mouseEvent.X;
- _OldMouseY = mouseEvent.Y;
- //Check if mouse if over tile
- foreach (CPlayerChooseButton chooseButton in _PlayerChooseButtons)
- {
- if (chooseButton.Button.Selected)
- {
- _SelectedPlayerNr = chooseButton.ProfileID;
- if (_SelectedPlayerNr != -1)
- {
- //Activate mouse-selecting
- _SelectingMouseActive = true;
- //Update of Drag/Drop-Texture
- _ChooseAvatarStatic.Visible = true;
- _ChooseAvatarStatic.Rect = chooseButton.Button.Rect;
- _ChooseAvatarStatic.Rect.Z = -100;
- _ChooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
- _ChooseAvatarStatic.Texture = CBase.Profiles.GetAvatar(_SelectedPlayerNr);
- }
- }
- }
- return true;
- }
-
- //Check if LeftButton is hold and Select-Mode active
- if (mouseEvent.LBH && _SelectingMouseActive)
- {
- //Update coords for Drag/Drop-Texture
- _ChooseAvatarStatic.Rect.X += mouseEvent.X - _OldMouseX;
- _ChooseAvatarStatic.Rect.Y += mouseEvent.Y - _OldMouseY;
- _OldMouseX = mouseEvent.X;
- _OldMouseY = mouseEvent.Y;
-
- return true;
- }
- // LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
- if (_SelectingMouseActive)
- {
- //Check if really a player was selected
- if (_SelectedPlayerNr != -1)
- {
- //Foreach Drop-Area
- for (int i = 0; i < _PlayerDestinationButtons.Count; i++)
- {
- //Check first, if area is "active"
- if (_PlayerDestinationButtons[i].Visible)
- {
- //Check if Mouse is in area
- if (CHelper.IsInBounds(_PlayerDestinationButtons[i].Rect, mouseEvent))
- {
- int added = -1;
- //Add Player-ID to list.
- if (i - _PlayerDestinationButtonsNumH < 0)
- {
- if (_Data.ScreenNames.ProfileIDsTeam1.Count < (i + 1))
- {
- _Data.ScreenNames.ProfileIDsTeam1.Add(_SelectedPlayerNr);
- added = _Data.ScreenNames.ProfileIDsTeam1.Count - 1;
- }
- else if (_Data.ScreenNames.ProfileIDsTeam1.Count >= (i + 1))
- {
- _Data.ScreenNames.ProfileIDsTeam1[i] = _SelectedPlayerNr;
- added = i;
- }
- }
- else if (i - _PlayerDestinationButtonsNumH >= 0)
- {
- if (_Data.ScreenNames.ProfileIDsTeam2.Count < ((i - _PlayerDestinationButtonsNumH) + 1))
- {
- _Data.ScreenNames.ProfileIDsTeam2.Add(_SelectedPlayerNr);
- added = _Data.ScreenNames.ProfileIDsTeam2.Count - 1 + _PlayerDestinationButtonsNumH;
- }
- else if (_Data.ScreenNames.ProfileIDsTeam2.Count >= ((i - _PlayerDestinationButtonsNumH) + 1))
- {
- _Data.ScreenNames.ProfileIDsTeam2[i - _PlayerDestinationButtonsNumH] = _SelectedPlayerNr;
- added = i;
- }
- }
- _UpdateButtonNext();
- //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 = _ChooseAvatarStatic.Texture;
- _PlayerDestinationButtons[added].SelTexture = _ChooseAvatarStatic.Texture;
- _PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetPlayerName(_SelectedPlayerNr);
- _PlayerDestinationButtons[added].Enabled = true;
- //Update Tiles-List
- _UpdateButtonPlayerChoose();
- }
- }
- }
- _SelectedPlayerNr = -1;
- }
- //Reset variables
- _SelectingMouseActive = false;
- _ChooseAvatarStatic.Visible = false;
- return true;
- }
-
- if (mouseEvent.LB && _IsMouseOver(mouseEvent))
- {
- if (_Buttons[_ButtonBack].Selected)
- _Back();
-
- if (_Buttons[_ButtonNext].Selected)
- _Next();
-
- if (_Buttons[_ButtonPlayerChooseScrollUp].Selected)
- _Scroll(-1);
-
- if (_Buttons[_ButtonPlayerChooseScrollDown].Selected)
- _Scroll(1);
- }
-
- if (mouseEvent.LD && _IsMouseOver(mouseEvent))
- {
- if (!_OnAdd())
- _OnRemove();
- }
-
- if (mouseEvent.RB)
- _Back();
-
- return true;
- }
public override void OnShow()
{
base.OnShow();
-
- if (!_ButtonsAdded)
- {
- _AddButtonPlayerDestination();
- _AddButtonPlayerChoose();
- _ButtonsAdded = true;
- }
-
- _UpdateButtonPlayerDestination();
- _UpdateButtonPlayerChoose();
-
- _UpdateButtonNext();
+ SetPartyModeData(2, _NumPlayerTeam1 + _NumPlayerTeam2, new int[] { _NumPlayerTeam1, _NumPlayerTeam2 });
}
- public override bool UpdateGame()
+ public override void Back()
{
- return true;
- }
-
- public override bool Draw()
- {
- base.Draw();
- if (_ChooseAvatarStatic.Visible)
- _ChooseAvatarStatic.Draw();
- return true;
- }
-
- private void _Scroll(int offset)
- {
- if (offset < 0 && _PlayerChooseButtonsOffset > 0)
+ List[] ids = GetTeamIDs();
+ if(ids.Length == 2)
{
- _PlayerChooseButtonsOffset += offset;
- _UpdateButtonPlayerChoose();
+ _Data.ScreenNames.ProfileIDsTeam1 = ids[0];
+ _Data.ScreenNames.ProfileIDsTeam2 = ids[1];
}
- else if (_PlayerChooseButtonsVisibleProfiles.Count < _PlayerChooseButtons.Count + (_PlayerChooseButtonsOffset + offset) * _PlayerChooseButtonsNumH)
- {
- _PlayerChooseButtonsOffset += offset;
- _UpdateButtonPlayerChoose();
- }
- }
-
- private void _AddButtonPlayerDestination()
- {
- _Buttons[_ButtonPlayerDestination].Visible = false;
- _PlayerDestinationButtons = new List();
- int row = 0;
- int column = 0;
- for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++)
- {
- CButton b = GetNewButton(_Buttons[_ButtonPlayerDestination]);
- b.Rect.X = _PlayerDestinationButtonsFirstX + column * (b.Rect.W + _PlayerDestinationButtonsSpaceH);
- b.Rect.Y = _PlayerDestinationButtonsFirstY + row * (b.Rect.H + _PlayerDestinationButtonsSpaceW);
- _PlayerDestinationButtons.Add(b);
- column++;
- if (column >= _PlayerDestinationButtonsNumH)
- {
- row++;
- column = 0;
- }
- b.Visible = true;
- b.Enabled = false;
- _AddButton(b);
- }
- }
-
- private void _AddButtonPlayerChoose()
- {
- _Buttons[_ButtonPlayerChoose].Visible = false;
- _PlayerChooseButtons = new List();
- int row = 0;
- int column = 0;
- for (int i = 1; i <= _PlayerChooseButtonsNumH * _PlayerChooseButtonsNumW; i++)
- {
- CButton b = GetNewButton(_Buttons[_ButtonPlayerChoose]);
- b.Rect.X = _PlayerChooseButtonsFirstX + column * (b.Rect.W + _PlayerChooseButtonsSpaceH);
- b.Rect.Y = _PlayerChooseButtonsFirstY + row * (b.Rect.H + _PlayerChooseButtonsSpaceW);
- var pcb = new CPlayerChooseButton {Button = b, ProfileID = -1};
- _PlayerChooseButtons.Add(pcb);
- column++;
- if (column >= _PlayerChooseButtonsNumH)
- {
- row++;
- column = 0;
- }
- b.Visible = true;
- b.Enabled = false;
- _AddButton(b);
- }
- }
-
- private void _UpdateButtonPlayerChoose()
- {
- _UpdateVisibleProfiles();
- if ((_PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH) * (_PlayerChooseButtonsOffset + 1) - _PlayerChooseButtonsVisibleProfiles.Count >=
- (_PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH) * _PlayerChooseButtonsOffset)
- _UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset - 1);
- else
- _UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset);
- _Buttons[_ButtonPlayerChooseScrollUp].Enabled = _PlayerChooseButtonsOffset > 0;
- _Buttons[_ButtonPlayerChooseScrollDown].Enabled = _PlayerChooseButtonsVisibleProfiles.Count >
- _PlayerChooseButtons.Count + _PlayerChooseButtonsOffset * _PlayerChooseButtonsNumH;
- }
-
- private void _UpdateButtonPlayerChoose(int offset)
- {
- const int numButtonPlayerChoose = _PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH;
- if (offset < 0)
- offset = 0;
-
- if (numButtonPlayerChoose * (offset + 1) - _PlayerChooseButtonsVisibleProfiles.Count <= numButtonPlayerChoose)
- {
- for (int i = 0; i < numButtonPlayerChoose; i++)
- {
- if ((i + offset * numButtonPlayerChoose) < _PlayerChooseButtonsVisibleProfiles.Count)
- {
- 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;
- }
- else
- {
- _PlayerChooseButtons[i].ProfileID = -1;
- _PlayerChooseButtons[i].Button.Text.Text = String.Empty;
- _PlayerChooseButtons[i].Button.Texture = _Buttons[_ButtonPlayerChoose].Texture;
- _PlayerChooseButtons[i].Button.SelTexture = _Buttons[_ButtonPlayerChoose].SelTexture;
- _PlayerChooseButtons[i].Button.Color = _Buttons[_ButtonPlayerChoose].Color;
- _PlayerChooseButtons[i].Button.SelColor = _Buttons[_ButtonPlayerChoose].SelColor;
- _PlayerChooseButtons[i].Button.Enabled = false;
- }
- }
- }
- }
-
- private void _UpdateVisibleProfiles()
- {
- _PlayerChooseButtonsVisibleProfiles.Clear();
- CProfile[] profiles = CBase.Profiles.GetProfiles();
- foreach (CProfile profile in profiles)
- {
- bool visible = false;
- //Show profile only if active
- if (profile.Active == EOffOn.TR_CONFIG_ON)
- {
- visible = _Data.ScreenNames.ProfileIDsTeam1.All(profileID => profileID != profile.ID) &&
- _Data.ScreenNames.ProfileIDsTeam2.All(profileID => profileID != profile.ID);
- }
- if (visible)
- _PlayerChooseButtonsVisibleProfiles.Add(profile.ID);
- }
- }
-
- private void _UpdateButtonPlayerDestination()
- {
- for (int i = 0; i < _PlayerDestinationButtons.Count / 2; i++)
- {
- if (_NumPlayerTeam1 > i)
- {
- _PlayerDestinationButtons[i].Visible = true;
- _PlayerDestinationButtons[i].Enabled = true;
- }
- else
- {
- _PlayerDestinationButtons[i].Visible = false;
- _PlayerDestinationButtons[i].Enabled = false;
- }
- }
- for (int i = 0; i < _PlayerDestinationButtons.Count / 2; i++)
- {
- if (_NumPlayerTeam2 > i)
- {
- _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Visible = true;
- _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Enabled = true;
- }
- else
- {
- _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Visible = false;
- _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Enabled = false;
- }
- }
- for (int i = 0; i < _NumPlayerTeam1; i++)
- {
- if (i < _Data.ScreenNames.ProfileIDsTeam1.Count)
- {
- 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.GetAvatar(id);
- _PlayerDestinationButtons[i].SelTexture = CBase.Profiles.GetAvatar(id);
- _PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetPlayerName(id);
- _PlayerDestinationButtons[i].Enabled = true;
- }
- }
- else
- {
- _PlayerDestinationButtons[i].Color = _Buttons[_ButtonPlayerDestination].Color;
- _PlayerDestinationButtons[i].SelColor = _Buttons[_ButtonPlayerDestination].SelColor;
- _PlayerDestinationButtons[i].Texture = _Buttons[_ButtonPlayerDestination].Texture;
- _PlayerDestinationButtons[i].SelTexture = _Buttons[_ButtonPlayerDestination].SelTexture;
- _PlayerDestinationButtons[i].Text.Text = String.Empty;
- _PlayerDestinationButtons[i].Enabled = false;
- }
- }
- for (int i = 0; i < _NumPlayerTeam2; i++)
- {
- if (i < _Data.ScreenNames.ProfileIDsTeam2.Count)
- {
- 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].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;
- }
- }
- else
- {
- _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Color = _Buttons[_ButtonPlayerDestination].Color;
- _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].SelColor = _Buttons[_ButtonPlayerDestination].SelColor;
- _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Texture = _Buttons[_ButtonPlayerDestination].Texture;
- _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].SelTexture = _Buttons[_ButtonPlayerDestination].SelTexture;
- _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Text.Text = String.Empty;
- _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Enabled = false;
- }
- }
- }
-
- private void _UpdateButtonNext()
- {
- if (_Data.ScreenNames.ProfileIDsTeam1.Count == _NumPlayerTeam1 && _Data.ScreenNames.ProfileIDsTeam2.Count == _NumPlayerTeam2)
- {
- _Buttons[_ButtonNext].Visible = true;
- _SetInteractionToButton(_Buttons[_ButtonNext]);
- }
- else
- _Buttons[_ButtonNext].Visible = false;
- }
-
- private bool _OnAdd()
- {
- foreach (CPlayerChooseButton chooseButton in _PlayerChooseButtons.Where(chooseButton => chooseButton.Button.Selected && chooseButton.ProfileID != -1))
- {
- if (_Data.ScreenNames.ProfileIDsTeam1.Count < _NumPlayerTeam1)
- {
- _Data.ScreenNames.ProfileIDsTeam1.Add(chooseButton.ProfileID);
- int added = _Data.ScreenNames.ProfileIDsTeam1.Count - 1;
- _UpdateButtonNext();
- //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.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();
- _CheckInteraction();
- return true;
- }
- if (_Data.ScreenNames.ProfileIDsTeam2.Count < _NumPlayerTeam2)
- {
- _Data.ScreenNames.ProfileIDsTeam2.Add(chooseButton.ProfileID);
- int added = (_Data.ScreenNames.ProfileIDsTeam2.Count - 1) + _PlayerDestinationButtonsNumH;
- _UpdateButtonNext();
- //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.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();
- _CheckInteraction();
- return true;
- }
- }
- return false;
- }
-
- private bool _OnRemove()
- {
- for (int i = 0; i < _PlayerDestinationButtonsNumH; i++)
- {
- if (_PlayerDestinationButtons[i].Selected)
- {
- if ((i + 1) <= _Data.ScreenNames.ProfileIDsTeam1.Count)
- {
- _Data.ScreenNames.ProfileIDsTeam1.RemoveAt(i);
- _UpdateButtonNext();
- _UpdateButtonPlayerDestination();
- _UpdateButtonPlayerChoose();
- _CheckInteraction();
- return true;
- }
- }
- }
- for (int i = _PlayerDestinationButtonsNumH; i < _PlayerDestinationButtonsNumH * 2; i++)
- {
- if (_PlayerDestinationButtons[i].Selected)
- {
- if (((i - _PlayerDestinationButtonsNumH) + 1) <= _Data.ScreenNames.ProfileIDsTeam2.Count)
- {
- _Data.ScreenNames.ProfileIDsTeam2.RemoveAt(i - _PlayerDestinationButtonsNumH);
- _UpdateButtonNext();
- _UpdateButtonPlayerDestination();
- _UpdateButtonPlayerChoose();
- _CheckInteraction();
- return true;
- }
- }
- }
- return false;
- }
-
- private void _Back()
- {
_Data.ScreenNames.FadeToConfig = true;
_PartyMode.DataFromScreen(ThemeName, _Data);
}
- private void _Next()
+ public override void Next()
{
+ List[] ids = GetTeamIDs();
+ if (ids.Length == 2)
+ {
+ _Data.ScreenNames.ProfileIDsTeam1 = ids[0];
+ _Data.ScreenNames.ProfileIDsTeam2 = ids[1];
+ }
_Data.ScreenNames.FadeToConfig = false;
_PartyMode.DataFromScreen(ThemeName, _Data);
}
diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs
index ff9f0f5d..94539b78 100644
--- a/Vocaluxe/Base/CMain.cs
+++ b/Vocaluxe/Base/CMain.cs
@@ -595,6 +595,21 @@ namespace Vocaluxe.Base
{
return CProfiles.GetAvatarTextureFromProfile(profileID);
}
+
+ public bool IsProfileIDValid(int profileID)
+ {
+ return CProfiles.IsProfileIDValid(profileID);
+ }
+
+ public bool IsGuest(int profileID)
+ {
+ return CProfiles.IsGuestProfile(profileID);
+ }
+
+ public void AddProfileChangedCallback(ProfileChangedCallback notification)
+ {
+ CProfiles.AddProfileChangedCallback(notification);
+ }
}
class CBrecord : IRecording
diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs
index d77331ca..f15be468 100644
--- a/Vocaluxe/Base/CProfiles.cs
+++ b/Vocaluxe/Base/CProfiles.cs
@@ -24,16 +24,6 @@ using VocaluxeLib.Draw;
namespace Vocaluxe.Base
{
- [Flags]
- public enum EProfileChangedFlags
- {
- None = 1,
- Avatar = 2,
- Profile = 4
- }
-
- public delegate void ProfileChangedCallback(EProfileChangedFlags typeChanged);
-
static class CProfiles
{
#region enums and structs
diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs
index 62a99c37..faf86007 100644
--- a/Vocaluxe/Screens/CScreenNames.cs
+++ b/Vocaluxe/Screens/CScreenNames.cs
@@ -23,6 +23,7 @@ using VocaluxeLib;
using VocaluxeLib.Draw;
using VocaluxeLib.Menu;
using VocaluxeLib.Songs;
+using VocaluxeLib.Profile;
namespace Vocaluxe.Screens
{
@@ -602,6 +603,7 @@ namespace Vocaluxe.Screens
for (int i = 0; i < CSettings.MaxNumPlayer; i++)
{
+ _NameSelections[_NameSelection].UseProfile(CGame.Players[i].ProfileID);
_Statics[_StaticPlayerAvatar[i]].Texture = CProfiles.IsProfileIDValid(CGame.Players[i].ProfileID) ?
CProfiles.GetAvatarTextureFromProfile(CGame.Players[i].ProfileID) :
_OriginalPlayerAvatarTextures[i];
@@ -675,6 +677,8 @@ namespace Vocaluxe.Screens
private void _UpdateSelectedProfile(int playerNum, int profileId)
{
+ _NameSelections[_NameSelection].RemoveUsedProfile(CGame.Players[playerNum].ProfileID);
+ _NameSelections[_NameSelection].UseProfile(profileId);
//Update Game-infos with new player
CGame.Players[playerNum].ProfileID = profileId;
//Update config for default players.
@@ -693,6 +697,7 @@ namespace Vocaluxe.Screens
{
for (int i = 0; i < CGame.NumPlayer; i++)
{
+ _NameSelections[_NameSelection].RemoveUsedProfile(CGame.Players[i].ProfileID);
CGame.Players[i].ProfileID = -1;
//Update config for default players.
CConfig.Players[i] = String.Empty;
@@ -706,6 +711,7 @@ namespace Vocaluxe.Screens
private void _ResetPlayerSelection(int playerNum)
{
+ _NameSelections[_NameSelection].RemoveUsedProfile(CGame.Players[playerNum].ProfileID);
CGame.Players[playerNum].ProfileID = -1;
//Update config for default players.
CConfig.Players[playerNum] = String.Empty;
diff --git a/VocaluxeLib/IBasic.cs b/VocaluxeLib/IBasic.cs
index ac8ed878..3c3725ad 100644
--- a/VocaluxeLib/IBasic.cs
+++ b/VocaluxeLib/IBasic.cs
@@ -209,6 +209,9 @@ namespace VocaluxeLib
EGameDifficulty GetDifficulty(int profileID);
string GetPlayerName(int profileID, int playerNum = 0);
CTexture GetAvatar(int profileID);
+ bool IsProfileIDValid(int profileID);
+ bool IsGuest(int profileID);
+ void AddProfileChangedCallback(ProfileChangedCallback notification);
}
public interface ISongs
diff --git a/VocaluxeLib/Menu/CMenuPartyNameSelection.cs b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs
new file mode 100644
index 00000000..15c1122d
--- /dev/null
+++ b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs
@@ -0,0 +1,486 @@
+#region license
+// This file is part of Vocaluxe.
+//
+// Vocaluxe is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Vocaluxe is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Vocaluxe. If not, see .
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using VocaluxeLib.PartyModes;
+using VocaluxeLib.Draw;
+using VocaluxeLib.Profile;
+
+namespace VocaluxeLib.Menu
+{
+ public abstract class CMenuPartyNameSelection : CMenuParty
+ {
+ private bool _Teams;
+ protected int _NumTeams = -1;
+ protected int _NumPlayer = -1;
+ protected int[] _NumPlayerTeams;
+ private int _CurrentTeam = 0;
+
+ private bool _AvatarsChanged;
+ private bool _ProfilesChanged;
+
+ private bool _SelectingKeyboardActive;
+ private bool _SelectingFast;
+ private int _SelectingSwitchNr = -1;
+ private int _SelectingFastPlayerNr;
+ private int _SelectedProfileID = -1;
+
+ private CStatic _ChooseAvatarStatic;
+ private int _OldMouseX;
+ private int _OldMouseY;
+
+ private const string _ButtonNext = "ButtonNext";
+ private const string _ButtonBack = "ButtonBack";
+ private const string _SelectSlideTeams = "SelectSlideTeams";
+ private const string _SelectSlidePlayer = "SelectSlidePlayer";
+ private const string _NameSelection = "NameSelection";
+
+ private List[] _TeamList;
+
+ public override void Init()
+ {
+ base.Init();
+ _Teams = _PartyMode.GetMinTeams() > 0;
+
+ _ThemeButtons = new string[] { _ButtonBack, _ButtonNext };
+ _ThemeSelectSlides = new string[] { _SelectSlideTeams, _SelectSlidePlayer };
+ _ThemeNameSelections = new string[] { _NameSelection };
+
+ _ChooseAvatarStatic = GetNewStatic();
+ _ChooseAvatarStatic.Visible = false;
+ _ChooseAvatarStatic.Aspect = EAspect.Crop;
+
+ CBase.Profiles.AddProfileChangedCallback(_OnProfileChanged);
+ }
+
+ public void SetPartyModeData(int numTeams, int numPlayer, int[] numPlayerTeams)
+ {
+ _NumTeams = numTeams;
+ _NumPlayer = numPlayer;
+ _NumPlayerTeams = numPlayerTeams;
+
+ if (_NumTeams > 0)
+ _TeamList = new List[_NumTeams];
+ else
+ _TeamList = new List[1];
+
+ if (_NumTeams != _NumPlayerTeams.Length)
+ _NumPlayerTeams = new int[_NumTeams];
+
+ for (int i = 0; i < _TeamList.Length; i++)
+ _TeamList[i] = new List();
+
+ _UpdateSlides();
+ _LoadProfiles();
+ }
+
+ public override bool HandleInput(SKeyEvent keyEvent)
+ {
+ //Check if selecting with keyboard is active
+ if (_SelectingKeyboardActive)
+ {
+ //Handle left/right/up/down
+ _NameSelections[_NameSelection].HandleInput(keyEvent);
+ int numberPressed = -1;
+ bool resetSelection = false;
+ switch (keyEvent.Key)
+ {
+ case Keys.Enter:
+ //Check, if a player is selected
+ if (_NameSelections[_NameSelection].Selection > -1)
+ {
+ _SelectedProfileID = _NameSelections[_NameSelection].Selection;
+
+ if (!CBase.Profiles.IsProfileIDValid(_SelectedProfileID))
+ return true;
+
+ _AddPlayer(_CurrentTeam, _SelectedProfileID);
+ }
+ //Started selecting with 'P'
+ if (_SelectingFast &&_SelectSlides[_SelectSlidePlayer].NumValues == _NumPlayerTeams[_CurrentTeam])
+ resetSelection = true;
+ else if(!_SelectingFast)
+ resetSelection = true;
+ break;
+
+ case Keys.Escape:
+ case Keys.Back:
+ resetSelection = true;
+ break;
+ }
+ if (numberPressed > 0 || resetSelection)
+ {
+ if (numberPressed == _SelectingFastPlayerNr || resetSelection)
+ {
+ //Reset all values
+ _SelectingFastPlayerNr = 0;
+ _SelectingKeyboardActive = false;
+ _NameSelections[_NameSelection].FastSelection(false, -1);
+ }
+ else if (numberPressed <= _NumPlayerTeams[_CurrentTeam])
+ {
+ _SelectingFastPlayerNr = numberPressed;
+ _NameSelections[_NameSelection].FastSelection(true, numberPressed);
+ }
+ _SelectingFast = false;
+ }
+ }
+ else
+ {
+ base.HandleInput(keyEvent);
+
+ switch (keyEvent.Key)
+ {
+ case Keys.Back:
+ case Keys.Escape:
+ Back();
+ break;
+
+ case Keys.Enter:
+ if (_Buttons[_ButtonBack].Selected)
+ Back();
+
+ if (_Buttons[_ButtonNext].Selected)
+ Next();
+
+ break;
+
+ case Keys.Delete:
+ if (_SelectSlides[_SelectSlidePlayer].Selected && _SelectSlides[_SelectSlidePlayer].NumValues > 0)
+ {
+ int index = _SelectSlides[_SelectSlidePlayer].Selection;
+ _RemovePlayerByIndex(_CurrentTeam, index);
+ _UpdatePlayerSlide();
+ }
+ break;
+
+ case Keys.Left:
+ case Keys.Right:
+ if (_SelectSlides[_SelectSlideTeams].Selected)
+ _ChangeTeamSlide();
+ break;
+
+ case Keys.P:
+ if (!_SelectingKeyboardActive)
+ {
+ _SelectingFastPlayerNr = (_CurrentTeam + 1);
+ _SelectingFast = true;
+ //_ResetPlayerSelections();
+ }
+ break;
+ }
+ }
+ if (_SelectingFastPlayerNr > 0 && _SelectingFastPlayerNr <= _NumPlayerTeams[_CurrentTeam])
+ {
+ _SelectingKeyboardActive = true;
+ _NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr);
+ }
+ return true;
+ }
+
+ public override bool HandleMouse(SMouseEvent mouseEvent)
+ {
+ bool stopSelectingFast = false;
+
+ if (_SelectingFast)
+ _NameSelections[_NameSelection].HandleMouse(mouseEvent);
+ else
+ base.HandleMouse(mouseEvent);
+
+ //Check if LeftButton is hold and Select-Mode inactive
+ if (mouseEvent.LBH && _SelectedProfileID < 0 && !_SelectingFast)
+ {
+ //Save mouse-coords
+ _OldMouseX = mouseEvent.X;
+ _OldMouseY = mouseEvent.Y;
+ //Check if mouse if over tile
+ if (_NameSelections[_NameSelection].IsOverTile(mouseEvent))
+ {
+ //Get player-number of tile
+ _SelectedProfileID = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
+ if (_SelectedProfileID != -1)
+ {
+ //Update of Drag/Drop-Texture
+ CStatic selectedPlayer = _NameSelections[_NameSelection].TilePlayerAvatar(mouseEvent);
+ _ChooseAvatarStatic.Visible = true;
+ _ChooseAvatarStatic.Rect = selectedPlayer.Rect;
+ _ChooseAvatarStatic.Rect.Z = CBase.Settings.GetZNear();
+ _ChooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
+ _ChooseAvatarStatic.Texture = selectedPlayer.Texture;
+ }
+ }
+ }
+ //Check if LeftButton is hold and Select-Mode active
+ if (mouseEvent.LBH && _SelectedProfileID >= 0 && !_SelectingFast)
+ {
+ //Update coords for Drag/Drop-Texture
+ _ChooseAvatarStatic.Rect.X += mouseEvent.X - _OldMouseX;
+ _ChooseAvatarStatic.Rect.Y += mouseEvent.Y - _OldMouseY;
+ _OldMouseX = mouseEvent.X;
+ _OldMouseY = mouseEvent.Y;
+ }
+ // LeftButton isn't hold anymore, but Select-Mode is still active -> "Drop" of Avatar
+ else if (_SelectedProfileID >= 0 && !_SelectingFast)
+ {
+ //Check if mouse is in drop-area
+ if (CHelper.IsInBounds(_SelectSlides[_SelectSlidePlayer].Rect, mouseEvent))
+ {
+ if (!CBase.Profiles.IsProfileIDValid(_SelectedProfileID))
+ return true;
+
+ _AddPlayer(_CurrentTeam, _SelectedProfileID);
+ }
+
+ //Reset variables
+ _SelectingSwitchNr = -1;
+ _SelectedProfileID = -1;
+ _ChooseAvatarStatic.Visible = false;
+ }
+ if (mouseEvent.LB && _SelectingFast)
+ {
+ if (_NameSelections[_NameSelection].IsOverTile(mouseEvent))
+ {
+ //Get player-number of tile
+ _SelectedProfileID = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
+ if (_SelectedProfileID != -1)
+ {
+ if (!CBase.Profiles.IsProfileIDValid(_SelectedProfileID))
+ return true;
+
+ _AddPlayer(_CurrentTeam, _SelectedProfileID);
+
+ if (_SelectSlides[_SelectSlidePlayer].NumValues == _NumPlayerTeams[_CurrentTeam])
+ stopSelectingFast = true;
+ }
+ else
+ stopSelectingFast = true;
+ }
+ }
+
+ else if (mouseEvent.LB && _IsMouseOver(mouseEvent))
+ {
+ if (_Buttons[_ButtonBack].Selected)
+ Back();
+
+ if (_Buttons[_ButtonNext].Selected)
+ Next();
+
+ if (_SelectSlides[_SelectSlideTeams].Selected)
+ _ChangeTeamSlide();
+
+ //Update Tiles-List
+ _NameSelections[_NameSelection].UpdateList();
+ }
+
+ if (mouseEvent.LD && _NameSelections[_NameSelection].IsOverTile(mouseEvent) && !_SelectingFast)
+ {
+ _SelectedProfileID = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
+ if (_SelectedProfileID > -1)
+ {
+ if (!CBase.Profiles.IsProfileIDValid(_SelectedProfileID))
+ return true;
+
+ _AddPlayer(_CurrentTeam, _SelectedProfileID);
+ }
+ }
+
+ if (mouseEvent.RB && _SelectingFast)
+ stopSelectingFast = true;
+ else if (mouseEvent.RB)
+ {
+ bool exit = true;
+ if (_SelectSlides[_SelectSlidePlayer].Selected && _SelectSlides[_SelectSlidePlayer].NumValues > 0 )
+ {
+ int currentSelection = _SelectSlides[_SelectSlidePlayer].Selection;
+ int id = _TeamList[_CurrentTeam][currentSelection];
+ _RemovePlayer(_CurrentTeam, id);
+ _UpdatePlayerSlide();
+ exit = false;
+ }
+
+ if (exit)
+ Back();
+ }
+
+ if (mouseEvent.MB && _SelectingFast)
+ {
+ if (_SelectSlides[_SelectSlidePlayer].NumValues == _NumPlayerTeams[_CurrentTeam])
+ stopSelectingFast = true;
+ }
+ else if (mouseEvent.MB)
+ {
+ _SelectingFast = true;
+ _SelectingFastPlayerNr = (_CurrentTeam + 1);
+ _SelectingKeyboardActive = true;
+ _NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr);
+ }
+
+ //Check mouse-wheel for scrolling
+ if (mouseEvent.Wheel != 0)
+ {
+ if (CHelper.IsInBounds(_NameSelections[_NameSelection].Rect, mouseEvent))
+ {
+ int offset = _NameSelections[_NameSelection].Offset + mouseEvent.Wheel;
+ _NameSelections[_NameSelection].UpdateList(offset);
+ }
+ }
+
+ if (stopSelectingFast)
+ {
+ _SelectingFast = false;
+ _SelectingFastPlayerNr = 0;
+ _SelectingKeyboardActive = false;
+ _NameSelections[_NameSelection].FastSelection(false, -1);
+ }
+ return true;
+ }
+
+ public override void LoadTheme(string xmlPath)
+ {
+ base.LoadTheme(xmlPath);
+ _SelectSlides[_SelectSlidePlayer].WithTextures = true;
+ _SelectSlides[_SelectSlidePlayer].SelectionByHover = true;
+ }
+
+ public override bool UpdateGame()
+ {
+ if (_ProfilesChanged || _AvatarsChanged)
+ _LoadProfiles();
+
+ return true;
+ }
+
+ public override void OnShow()
+ {
+ _NameSelections[_NameSelection].Init();
+
+ base.OnShow();
+ }
+
+ public override bool Draw()
+ {
+ base.Draw();
+
+ if (_ChooseAvatarStatic.Visible)
+ _ChooseAvatarStatic.Draw();
+
+ return true;
+ }
+
+ public abstract void Back();
+ public abstract void Next();
+
+ public List GetTeamIDs(int team)
+ {
+ if (team < _TeamList.Length)
+ return _TeamList[team];
+ return null;
+ }
+
+ public List[] GetTeamIDs()
+ {
+ return _TeamList;
+ }
+ #region private methods
+
+ private void _OnProfileChanged(EProfileChangedFlags flags)
+ {
+ if (EProfileChangedFlags.Avatar == (EProfileChangedFlags.Avatar & flags))
+ _AvatarsChanged = true;
+
+ if (EProfileChangedFlags.Profile == (EProfileChangedFlags.Profile & flags))
+ _ProfilesChanged = true;
+ }
+
+ private void _LoadProfiles()
+ {
+ _NameSelections[_NameSelection].UpdateList();
+
+ _UpdateSlides();
+ _ChangeTeamSlide();
+
+ _ProfilesChanged = false;
+ _AvatarsChanged = false;
+ }
+
+ private void _UpdateSlides()
+ {
+ _SelectSlides[_SelectSlideTeams].Clear();
+ for (int i = 1; i <= _NumTeams; i++)
+ _SelectSlides[_SelectSlideTeams].AddValue("Team " + i);
+
+ _SelectSlides[_SelectSlidePlayer].Clear();
+ }
+
+ private void _ChangeTeamSlide()
+ {
+ if (_CurrentTeam == _SelectSlides[_SelectSlideTeams].Selection)
+ return;
+
+ _CurrentTeam = _SelectSlides[_SelectSlideTeams].Selection;
+ _UpdatePlayerSlide();
+ }
+
+ private void _UpdatePlayerSlide()
+ {
+ _SelectSlides[_SelectSlidePlayer].Clear();
+ for (int i = 0; i < _TeamList[_CurrentTeam].Count; i++)
+ {
+ string name = CBase.Profiles.GetPlayerName(_TeamList[_CurrentTeam][i]);
+ CTexture avatar = CBase.Profiles.GetAvatar(_TeamList[_CurrentTeam][i]);
+ _SelectSlides[_SelectSlidePlayer].AddValue(name, avatar);
+ }
+ }
+
+ private void _AddPlayer(int team, int profileID)
+ {
+ if (_NumPlayerTeams[team] == _TeamList[team].Count)
+ return;
+
+ _NameSelections[_NameSelection].UseProfile(profileID);
+ _TeamList[team].Add(profileID);
+
+ if (team == _CurrentTeam)
+ {
+ string name = CBase.Profiles.GetPlayerName(profileID);
+ CTexture avatar = CBase.Profiles.GetAvatar(profileID);
+ _SelectSlides[_SelectSlidePlayer].AddValue(name, avatar);
+ }
+ }
+
+ private void _RemovePlayerByIndex(int team, int index)
+ {
+ if (_TeamList[team].Count > index)
+ {
+ int id = _TeamList[team][index];
+ _TeamList[team].RemoveAt(index);
+ _NameSelections[_NameSelection].RemoveUsedProfile(id);
+ }
+ }
+
+ private void _RemovePlayer(int team, int profileID)
+ {
+ _TeamList[team].Remove(profileID);
+ _NameSelections[_NameSelection].RemoveUsedProfile(profileID);
+ }
+
+ #endregion
+ }
+}
diff --git a/VocaluxeLib/Menu/CNameSelection.cs b/VocaluxeLib/Menu/CNameSelection.cs
index bb1df5b2..9f086781 100644
--- a/VocaluxeLib/Menu/CNameSelection.cs
+++ b/VocaluxeLib/Menu/CNameSelection.cs
@@ -90,6 +90,7 @@ namespace VocaluxeLib.Menu
private int _Player = -1;
private readonly List _VisibleProfiles;
+ private List _UsedProfiles;
private CStatic _PlayerSelector;
@@ -100,6 +101,7 @@ namespace VocaluxeLib.Menu
_Tiles = new List();
_VisibleProfiles = new List();
+ _UsedProfiles = new List();
}
public void Init()
@@ -478,6 +480,19 @@ namespace VocaluxeLib.Menu
_PrepareTiles();
}
+ public void UseProfile(int id)
+ {
+ if(id > -1)
+ if (!_UsedProfiles.Contains(id) && CBase.Profiles.IsProfileIDValid(id) && !CBase.Profiles.IsGuest(id))
+ _UsedProfiles.Add(id);
+ }
+
+ public void RemoveUsedProfile(int id)
+ {
+ if(id > -1)
+ _UsedProfiles.Remove(id);
+ }
+
private void _PrepareTiles()
{
_Tiles.Clear();
@@ -504,14 +519,8 @@ namespace VocaluxeLib.Menu
bool visible = profile.Active == EOffOn.TR_CONFIG_ON;
if (visible)
{
- //Show profile only if active
- for (int p = 0; p < CBase.Game.GetNumPlayer(); p++)
- {
- //Don't show profile if is selected, but if selected and guest
- if (CBase.Game.GetPlayers()[p].ProfileID == profile.ID
- && profile.UserRole.HasFlag(EUserRole.TR_USERROLE_GUEST))
- visible = false;
- }
+ if (_UsedProfiles.Contains(profile.ID) && !profile.UserRole.HasFlag(EUserRole.TR_USERROLE_GUEST))
+ visible = false;
}
if (visible)
_VisibleProfiles.Add(profile.ID);
diff --git a/VocaluxeLib/Profile/CProfile.cs b/VocaluxeLib/Profile/CProfile.cs
index 21b10e03..4e27614c 100644
--- a/VocaluxeLib/Profile/CProfile.cs
+++ b/VocaluxeLib/Profile/CProfile.cs
@@ -22,6 +22,16 @@ using System.Xml;
namespace VocaluxeLib.Profile
{
+ [Flags]
+ public enum EProfileChangedFlags
+ {
+ None = 1,
+ Avatar = 2,
+ Profile = 4
+ }
+
+ public delegate void ProfileChangedCallback(EProfileChangedFlags typeChanged);
+
public class CProfile
{
public int ID;
diff --git a/VocaluxeLib/VocaluxeLib.csproj b/VocaluxeLib/VocaluxeLib.csproj
index ee8e196f..d44d9b74 100644
--- a/VocaluxeLib/VocaluxeLib.csproj
+++ b/VocaluxeLib/VocaluxeLib.csproj
@@ -142,6 +142,7 @@
+