Merge remote-tracking branch 'remotes/flokuep/challenge' into challenge
This commit is contained in:
commit
9e9383d5ad
2 files changed
+416
-198
No files matched your search
@@ -27,6 +27,7 @@ namespace Vocaluxe.PartyModes
|
||||
private const int PlayerDestinationButtonsSpaceH = 15;
|
||||
private const int PlayerDestinationButtonsSpaceW = 25;
|
||||
//PlayerChooseButtons-Option
|
||||
private List<int> PlayerChooseButtonsVisibleProfiles;
|
||||
private const int PlayerChooseButtonsNumH = 7;
|
||||
private const int PlayerChooseButtonsNumW = 4;
|
||||
private const int PlayerChooseButtonsFirstX = 52;
|
||||
@@ -37,16 +38,13 @@ namespace Vocaluxe.PartyModes
|
||||
|
||||
private CStatic chooseAvatarStatic;
|
||||
private bool SelectingMouseActive = false;
|
||||
private bool SelectingKeyboardActive = false;
|
||||
private bool SelectingKeyboardUnendless = false;
|
||||
private int OldMouseX = 0;
|
||||
private int OldMouseY = 0;
|
||||
private int SelectedPlayerNr = -1;
|
||||
private int SelectingKeyboardPlayerNr = -1;
|
||||
|
||||
//TODO: Get this data from party-mode!
|
||||
private int NumPlayers = 5;
|
||||
private int[] ProfileIDs;
|
||||
private List<int> ProfileIDs;
|
||||
|
||||
|
||||
private DataFromScreen Data;
|
||||
@@ -68,6 +66,10 @@ namespace Vocaluxe.PartyModes
|
||||
chooseAvatarStatic = GetNewStatic();
|
||||
chooseAvatarStatic.Visible = false;
|
||||
|
||||
PlayerChooseButtonsVisibleProfiles = new List<int>();
|
||||
|
||||
ProfileIDs = new List<int>();
|
||||
|
||||
_ThemeName = "PartyScreenChallengeNames";
|
||||
List<string> buttons = new List<string>();
|
||||
_ThemeButtons = new string[] { ButtonBack, ButtonNext, ButtonPlayerDestination, ButtonPlayerChoose };
|
||||
@@ -88,55 +90,6 @@ namespace Vocaluxe.PartyModes
|
||||
AddButtonPlayerChoose();
|
||||
}
|
||||
|
||||
private void AddButtonPlayerDestination()
|
||||
{
|
||||
Buttons[htButtons(ButtonPlayerDestination)].Visible = false;
|
||||
PlayerDestinationButtons = new List<CButton>();
|
||||
int row = 0;
|
||||
int column = 0;
|
||||
for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++)
|
||||
{
|
||||
CButton b = GetNewButton(Buttons[htButtons(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;
|
||||
AddButton(b);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddButtonPlayerChoose()
|
||||
{
|
||||
Buttons[htButtons(ButtonPlayerChoose)].Visible = false;
|
||||
PlayerChooseButtons = new List<CPlayerChooseButton>();
|
||||
int row = 0;
|
||||
int column = 0;
|
||||
for (int i = 1; i <= PlayerChooseButtonsNumH*PlayerChooseButtonsNumW; i++)
|
||||
{
|
||||
CButton b = GetNewButton(Buttons[htButtons(ButtonPlayerChoose)]);
|
||||
b.Rect.X = PlayerChooseButtonsFirstX + column * (b.Rect.W + PlayerChooseButtonsSpaceH);
|
||||
b.Rect.Y = PlayerChooseButtonsFirstY + row * (b.Rect.H + PlayerChooseButtonsSpaceW);
|
||||
CPlayerChooseButton pcb = new CPlayerChooseButton();
|
||||
pcb.Button = b;
|
||||
pcb.ProfileID = -1;
|
||||
PlayerChooseButtons.Add(pcb);
|
||||
column++;
|
||||
if (column >= PlayerChooseButtonsNumH)
|
||||
{
|
||||
row++;
|
||||
column = 0;
|
||||
}
|
||||
b.Visible = true;
|
||||
AddButton(b);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool HandleInput(KeyEvent KeyEvent)
|
||||
{
|
||||
base.HandleInput(KeyEvent);
|
||||
@@ -161,17 +114,39 @@ namespace Vocaluxe.PartyModes
|
||||
if (Buttons[htButtons(ButtonNext)].Selected)
|
||||
Next();
|
||||
|
||||
for (int i = 0; i < PlayerChooseButtons.Count; i++)
|
||||
{
|
||||
if (PlayerChooseButtons[i].Button.Selected && PlayerChooseButtons[i].ProfileID != -1)
|
||||
{
|
||||
if (ProfileIDs.Count < NumPlayers)
|
||||
{
|
||||
ProfileIDs.Add(PlayerChooseButtons[i].ProfileID);
|
||||
int added = ProfileIDs.Count - 1;
|
||||
UpdateButtonNext();
|
||||
//Update texture and name
|
||||
PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
|
||||
PlayerDestinationButtons[added].SColor = new SColorF(1, 1, 1, 1);
|
||||
PlayerDestinationButtons[added].Texture = _Base.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture;
|
||||
PlayerDestinationButtons[added].STexture = _Base.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture;
|
||||
PlayerDestinationButtons[added].Text.Text = _Base.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].PlayerName;
|
||||
//Update Tiles-List
|
||||
UpdateButtonPlayerChoose();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Delete:
|
||||
for (int i = 0; i < PlayerDestinationButtons.Count; i++)
|
||||
{
|
||||
if (PlayerDestinationButtons[i].Selected)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < PlayerChooseButtons.Count; i++)
|
||||
{
|
||||
if (PlayerChooseButtons[i].Button.Selected)
|
||||
{
|
||||
if ((i + 1) <= ProfileIDs.Count)
|
||||
{
|
||||
ProfileIDs.RemoveAt(i);
|
||||
UpdateButtonPlayerDestination();
|
||||
UpdateButtonPlayerChoose();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -202,7 +177,7 @@ namespace Vocaluxe.PartyModes
|
||||
SelectingMouseActive = true;
|
||||
//Update of Drag/Drop-Texture
|
||||
chooseAvatarStatic.Visible = true;
|
||||
chooseAvatarStatic.Rect = PlayerChooseButtons[SelectedPlayerNr].Button.Rect;
|
||||
chooseAvatarStatic.Rect = PlayerChooseButtons[i].Button.Rect;
|
||||
chooseAvatarStatic.Rect.Z = -100;
|
||||
chooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
|
||||
chooseAvatarStatic.Texture = _Base.Profiles.GetProfiles()[SelectedPlayerNr].Avatar.Texture;
|
||||
@@ -235,15 +210,25 @@ namespace Vocaluxe.PartyModes
|
||||
//Check if Mouse is in area
|
||||
if (CHelper.IsInBounds(PlayerDestinationButtons[i].Rect, MouseEvent))
|
||||
{
|
||||
int added = -1;
|
||||
//Add Player-ID to list.
|
||||
ProfileIDs[i] = SelectedPlayerNr;
|
||||
if (ProfileIDs.Count < (i + 1))
|
||||
{
|
||||
ProfileIDs.Add(SelectedPlayerNr);
|
||||
added = ProfileIDs.Count - 1;
|
||||
}
|
||||
else if (ProfileIDs.Count >= (i + 1))
|
||||
{
|
||||
ProfileIDs[i] = SelectedPlayerNr;
|
||||
added = i;
|
||||
}
|
||||
UpdateButtonNext();
|
||||
//Update texture and name
|
||||
PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 1);
|
||||
PlayerDestinationButtons[i].SColor = new SColorF(1, 1, 1, 1);
|
||||
PlayerDestinationButtons[i].Texture = chooseAvatarStatic.Texture;
|
||||
PlayerDestinationButtons[i].STexture = chooseAvatarStatic.Texture;
|
||||
PlayerDestinationButtons[i].Text.Text = _Base.Profiles.GetProfiles()[SelectedPlayerNr].PlayerName;
|
||||
PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
|
||||
PlayerDestinationButtons[added].SColor = new SColorF(1, 1, 1, 1);
|
||||
PlayerDestinationButtons[added].Texture = chooseAvatarStatic.Texture;
|
||||
PlayerDestinationButtons[added].STexture = chooseAvatarStatic.Texture;
|
||||
PlayerDestinationButtons[added].Text.Text = _Base.Profiles.GetProfiles()[SelectedPlayerNr].PlayerName;
|
||||
//Update Tiles-List
|
||||
UpdateButtonPlayerChoose();
|
||||
}
|
||||
@@ -265,9 +250,20 @@ namespace Vocaluxe.PartyModes
|
||||
Next();
|
||||
}
|
||||
|
||||
if (MouseEvent.RB)
|
||||
if (MouseEvent.RB && IsMouseOver(MouseEvent))
|
||||
{
|
||||
Back();
|
||||
for (int i = 0; i < PlayerDestinationButtons.Count; i++)
|
||||
{
|
||||
if (PlayerDestinationButtons[i].Selected)
|
||||
{
|
||||
if ((i + 1) <= ProfileIDs.Count)
|
||||
{
|
||||
ProfileIDs.RemoveAt(i);
|
||||
UpdateButtonPlayerDestination();
|
||||
UpdateButtonPlayerChoose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -277,21 +273,8 @@ namespace Vocaluxe.PartyModes
|
||||
{
|
||||
base.OnShow();
|
||||
|
||||
ProfileIDs = new int[NumPlayers];
|
||||
for (int i = 0; i < ProfileIDs.Length; i++ )
|
||||
ProfileIDs[i] = -1;
|
||||
|
||||
for (int i = 0; i < PlayerDestinationButtons.Count; i++)
|
||||
{
|
||||
PlayerDestinationButtons[i].Text.Text = "Player " + (i+1);
|
||||
if (i <= NumPlayers)
|
||||
PlayerDestinationButtons[i].Visible = true;
|
||||
else
|
||||
PlayerDestinationButtons[i].Visible = false;
|
||||
}
|
||||
|
||||
UpdateButtonPlayerChoose();
|
||||
UpdateButtonPlayerDestination();
|
||||
UpdateButtonPlayerChoose();
|
||||
|
||||
UpdateButtonNext();
|
||||
}
|
||||
@@ -314,25 +297,122 @@ namespace Vocaluxe.PartyModes
|
||||
base.OnClose();
|
||||
}
|
||||
|
||||
private void Back()
|
||||
private void AddButtonPlayerDestination()
|
||||
{
|
||||
Data.ScreenNames.FadeToConfig = true;
|
||||
Data.ScreenNames.FadeToMain = false;
|
||||
_PartyMode.DataFromScreen(_ThemeName, Data);
|
||||
Buttons[htButtons(ButtonPlayerDestination)].Visible = false;
|
||||
PlayerDestinationButtons = new List<CButton>();
|
||||
int row = 0;
|
||||
int column = 0;
|
||||
for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++)
|
||||
{
|
||||
CButton b = GetNewButton(Buttons[htButtons(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;
|
||||
AddButton(b);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddButtonPlayerChoose()
|
||||
{
|
||||
Buttons[htButtons(ButtonPlayerChoose)].Visible = false;
|
||||
PlayerChooseButtons = new List<CPlayerChooseButton>();
|
||||
int row = 0;
|
||||
int column = 0;
|
||||
for (int i = 1; i <= PlayerChooseButtonsNumH * PlayerChooseButtonsNumW; i++)
|
||||
{
|
||||
CButton b = GetNewButton(Buttons[htButtons(ButtonPlayerChoose)]);
|
||||
b.Rect.X = PlayerChooseButtonsFirstX + column * (b.Rect.W + PlayerChooseButtonsSpaceH);
|
||||
b.Rect.Y = PlayerChooseButtonsFirstY + row * (b.Rect.H + PlayerChooseButtonsSpaceW);
|
||||
CPlayerChooseButton pcb = new CPlayerChooseButton();
|
||||
pcb.Button = b;
|
||||
pcb.ProfileID = -1;
|
||||
PlayerChooseButtons.Add(pcb);
|
||||
column++;
|
||||
if (column >= PlayerChooseButtonsNumH)
|
||||
{
|
||||
row++;
|
||||
column = 0;
|
||||
}
|
||||
b.Visible = true;
|
||||
AddButton(b);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateButtonPlayerChoose()
|
||||
{
|
||||
for (int i = (PlayerChooseButtonsOffset * PlayerChooseButtonsNumW); i < _Base.Profiles.GetProfiles().Length; i++)
|
||||
UpdateVisibleProfiles();
|
||||
if ((PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * (PlayerChooseButtonsOffset + 1) - PlayerChooseButtonsVisibleProfiles.Count >= (PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * PlayerChooseButtonsOffset)
|
||||
{
|
||||
if (i < PlayerChooseButtons.Count)
|
||||
UpdateButtonPlayerChoose(PlayerChooseButtonsOffset - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateButtonPlayerChoose(PlayerChooseButtonsOffset);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateButtonPlayerChoose(int Offset)
|
||||
{
|
||||
int NumButtonPlayerChoose = PlayerChooseButtonsNumW * PlayerChooseButtonsNumH;
|
||||
if (Offset < 0)
|
||||
Offset = 0;
|
||||
|
||||
if (NumButtonPlayerChoose * (Offset + 1) - PlayerChooseButtonsVisibleProfiles.Count < NumButtonPlayerChoose)
|
||||
{
|
||||
for (int i = 0; i < NumButtonPlayerChoose; i++)
|
||||
{
|
||||
PlayerChooseButtons[i].ProfileID = i;
|
||||
PlayerChooseButtons[i].Button.Text.Text = _Base.Profiles.GetProfiles()[i].PlayerName;
|
||||
PlayerChooseButtons[i].Button.Texture = _Base.Profiles.GetProfiles()[i].Avatar.Texture;
|
||||
PlayerChooseButtons[i].Button.STexture = _Base.Profiles.GetProfiles()[i].Avatar.Texture;
|
||||
PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 1);
|
||||
PlayerChooseButtons[i].Button.SColor = new SColorF(1, 1, 1, 1);
|
||||
if ((i + Offset * NumButtonPlayerChoose) < PlayerChooseButtonsVisibleProfiles.Count)
|
||||
{
|
||||
PlayerChooseButtons[i].ProfileID = PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose];
|
||||
PlayerChooseButtons[i].Button.Text.Text = _Base.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].PlayerName;
|
||||
PlayerChooseButtons[i].Button.Texture = _Base.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].Avatar.Texture;
|
||||
PlayerChooseButtons[i].Button.STexture = _Base.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].Avatar.Texture;
|
||||
PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 0.6f);
|
||||
PlayerChooseButtons[i].Button.SColor = new SColorF(1, 1, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerChooseButtons[i].ProfileID = -1;
|
||||
PlayerChooseButtons[i].Button.Text.Text = String.Empty;
|
||||
PlayerChooseButtons[i].Button.Texture = Buttons[htButtons(ButtonPlayerChoose)].Texture;
|
||||
PlayerChooseButtons[i].Button.STexture = Buttons[htButtons(ButtonPlayerChoose)].STexture;
|
||||
PlayerChooseButtons[i].Button.Color = Buttons[htButtons(ButtonPlayerChoose)].Color;
|
||||
PlayerChooseButtons[i].Button.SColor = Buttons[htButtons(ButtonPlayerChoose)].SColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateVisibleProfiles()
|
||||
{
|
||||
PlayerChooseButtonsVisibleProfiles.Clear();
|
||||
for (int i = 0; i < _Base.Profiles.GetProfiles().Length; i++)
|
||||
{
|
||||
bool visible = false;
|
||||
//Show profile only if active
|
||||
if (_Base.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
visible = true;
|
||||
}
|
||||
for (int p = 0; p < ProfileIDs.Count; p++)
|
||||
{
|
||||
//Don't show profile if is selected, but if selected and guest
|
||||
if (ProfileIDs[p] == i && _Base.Profiles.GetProfiles()[i].GuestProfile == EOffOn.TR_CONFIG_OFF)
|
||||
{
|
||||
visible = false;
|
||||
}
|
||||
}
|
||||
if (visible)
|
||||
{
|
||||
PlayerChooseButtonsVisibleProfiles.Add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -346,14 +426,43 @@ namespace Vocaluxe.PartyModes
|
||||
else
|
||||
PlayerDestinationButtons[i].Visible = false;
|
||||
}
|
||||
for (int i = 0; i < NumPlayers; i++)
|
||||
{
|
||||
if (i < ProfileIDs.Count)
|
||||
{
|
||||
if (ProfileIDs[i] != -1)
|
||||
{
|
||||
PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f);
|
||||
PlayerDestinationButtons[i].SColor = new SColorF(1, 1, 1, 1);
|
||||
PlayerDestinationButtons[i].Texture = _Base.Profiles.GetProfiles()[ProfileIDs[i]].Avatar.Texture;
|
||||
PlayerDestinationButtons[i].STexture = _Base.Profiles.GetProfiles()[ProfileIDs[i]].Avatar.Texture;
|
||||
PlayerDestinationButtons[i].Text.Text = _Base.Profiles.GetProfiles()[ProfileIDs[i]].PlayerName;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerDestinationButtons[i].Color = Buttons[htButtons(ButtonPlayerDestination)].Color;
|
||||
PlayerDestinationButtons[i].SColor = Buttons[htButtons(ButtonPlayerDestination)].SColor;
|
||||
PlayerDestinationButtons[i].Texture = Buttons[htButtons(ButtonPlayerDestination)].Texture;
|
||||
PlayerDestinationButtons[i].STexture = Buttons[htButtons(ButtonPlayerDestination)].STexture;
|
||||
PlayerDestinationButtons[i].Text.Text = String.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateButtonNext()
|
||||
{
|
||||
Buttons[htButtons(ButtonNext)].Visible = true;
|
||||
for (int i = 0; i < ProfileIDs.Length; i++)
|
||||
if (ProfileIDs[i] == -1)
|
||||
Buttons[htButtons(ButtonNext)].Visible = false;
|
||||
if (ProfileIDs.Count == NumPlayers)
|
||||
Buttons[htButtons(ButtonNext)].Visible = true;
|
||||
else
|
||||
Buttons[htButtons(ButtonNext)].Visible = false;
|
||||
}
|
||||
|
||||
private void Back()
|
||||
{
|
||||
Data.ScreenNames.FadeToConfig = true;
|
||||
Data.ScreenNames.FadeToMain = false;
|
||||
_PartyMode.DataFromScreen(_ThemeName, Data);
|
||||
}
|
||||
|
||||
private void Next()
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace Vocaluxe.PartyModes
|
||||
private const int PlayerDestinationButtonsSpaceH = 15;
|
||||
private const int PlayerDestinationButtonsSpaceW = 25;
|
||||
//PlayerChooseButtons-Option
|
||||
private List<int> PlayerChooseButtonsVisibleProfiles;
|
||||
private const int PlayerChooseButtonsNumH = 7;
|
||||
private const int PlayerChooseButtonsNumW = 4;
|
||||
private const int PlayerChooseButtonsFirstX = 52;
|
||||
@@ -37,16 +38,13 @@ namespace Vocaluxe.PartyModes
|
||||
|
||||
private CStatic chooseAvatarStatic;
|
||||
private bool SelectingMouseActive = false;
|
||||
private bool SelectingKeyboardActive = false;
|
||||
private bool SelectingKeyboardUnendless = false;
|
||||
private int OldMouseX = 0;
|
||||
private int OldMouseY = 0;
|
||||
private int SelectedPlayerNr = -1;
|
||||
private int SelectingKeyboardPlayerNr = -1;
|
||||
|
||||
//TODO: Get this data from party-mode!
|
||||
private int NumPlayers = 5;
|
||||
private int[] ProfileIDs;
|
||||
private List<int> ProfileIDs;
|
||||
|
||||
|
||||
private DataFromScreen Data;
|
||||
@@ -68,6 +66,10 @@ namespace Vocaluxe.PartyModes
|
||||
chooseAvatarStatic = GetNewStatic();
|
||||
chooseAvatarStatic.Visible = false;
|
||||
|
||||
PlayerChooseButtonsVisibleProfiles = new List<int>();
|
||||
|
||||
ProfileIDs = new List<int>();
|
||||
|
||||
_ThemeName = "PartyScreenChallengeNames";
|
||||
List<string> buttons = new List<string>();
|
||||
_ThemeButtons = new string[] { ButtonBack, ButtonNext, ButtonPlayerDestination, ButtonPlayerChoose };
|
||||
@@ -88,55 +90,6 @@ namespace Vocaluxe.PartyModes
|
||||
AddButtonPlayerChoose();
|
||||
}
|
||||
|
||||
private void AddButtonPlayerDestination()
|
||||
{
|
||||
Buttons[htButtons(ButtonPlayerDestination)].Visible = false;
|
||||
PlayerDestinationButtons = new List<CButton>();
|
||||
int row = 0;
|
||||
int column = 0;
|
||||
for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++)
|
||||
{
|
||||
CButton b = GetNewButton(Buttons[htButtons(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;
|
||||
AddButton(b);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddButtonPlayerChoose()
|
||||
{
|
||||
Buttons[htButtons(ButtonPlayerChoose)].Visible = false;
|
||||
PlayerChooseButtons = new List<CPlayerChooseButton>();
|
||||
int row = 0;
|
||||
int column = 0;
|
||||
for (int i = 1; i <= PlayerChooseButtonsNumH*PlayerChooseButtonsNumW; i++)
|
||||
{
|
||||
CButton b = GetNewButton(Buttons[htButtons(ButtonPlayerChoose)]);
|
||||
b.Rect.X = PlayerChooseButtonsFirstX + column * (b.Rect.W + PlayerChooseButtonsSpaceH);
|
||||
b.Rect.Y = PlayerChooseButtonsFirstY + row * (b.Rect.H + PlayerChooseButtonsSpaceW);
|
||||
CPlayerChooseButton pcb = new CPlayerChooseButton();
|
||||
pcb.Button = b;
|
||||
pcb.ProfileID = -1;
|
||||
PlayerChooseButtons.Add(pcb);
|
||||
column++;
|
||||
if (column >= PlayerChooseButtonsNumH)
|
||||
{
|
||||
row++;
|
||||
column = 0;
|
||||
}
|
||||
b.Visible = true;
|
||||
AddButton(b);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool HandleInput(KeyEvent KeyEvent)
|
||||
{
|
||||
base.HandleInput(KeyEvent);
|
||||
@@ -161,17 +114,39 @@ namespace Vocaluxe.PartyModes
|
||||
if (Buttons[htButtons(ButtonNext)].Selected)
|
||||
Next();
|
||||
|
||||
for (int i = 0; i < PlayerChooseButtons.Count; i++)
|
||||
{
|
||||
if (PlayerChooseButtons[i].Button.Selected && PlayerChooseButtons[i].ProfileID != -1)
|
||||
{
|
||||
if (ProfileIDs.Count < NumPlayers)
|
||||
{
|
||||
ProfileIDs.Add(PlayerChooseButtons[i].ProfileID);
|
||||
int added = ProfileIDs.Count - 1;
|
||||
UpdateButtonNext();
|
||||
//Update texture and name
|
||||
PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
|
||||
PlayerDestinationButtons[added].SColor = new SColorF(1, 1, 1, 1);
|
||||
PlayerDestinationButtons[added].Texture = _Base.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture;
|
||||
PlayerDestinationButtons[added].STexture = _Base.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture;
|
||||
PlayerDestinationButtons[added].Text.Text = _Base.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].PlayerName;
|
||||
//Update Tiles-List
|
||||
UpdateButtonPlayerChoose();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Delete:
|
||||
for (int i = 0; i < PlayerDestinationButtons.Count; i++)
|
||||
{
|
||||
if (PlayerDestinationButtons[i].Selected)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < PlayerChooseButtons.Count; i++)
|
||||
{
|
||||
if (PlayerChooseButtons[i].Button.Selected)
|
||||
{
|
||||
if ((i + 1) <= ProfileIDs.Count)
|
||||
{
|
||||
ProfileIDs.RemoveAt(i);
|
||||
UpdateButtonPlayerDestination();
|
||||
UpdateButtonPlayerChoose();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -202,7 +177,7 @@ namespace Vocaluxe.PartyModes
|
||||
SelectingMouseActive = true;
|
||||
//Update of Drag/Drop-Texture
|
||||
chooseAvatarStatic.Visible = true;
|
||||
chooseAvatarStatic.Rect = PlayerChooseButtons[SelectedPlayerNr].Button.Rect;
|
||||
chooseAvatarStatic.Rect = PlayerChooseButtons[i].Button.Rect;
|
||||
chooseAvatarStatic.Rect.Z = -100;
|
||||
chooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
|
||||
chooseAvatarStatic.Texture = _Base.Profiles.GetProfiles()[SelectedPlayerNr].Avatar.Texture;
|
||||
@@ -235,15 +210,25 @@ namespace Vocaluxe.PartyModes
|
||||
//Check if Mouse is in area
|
||||
if (CHelper.IsInBounds(PlayerDestinationButtons[i].Rect, MouseEvent))
|
||||
{
|
||||
int added = -1;
|
||||
//Add Player-ID to list.
|
||||
ProfileIDs[i] = SelectedPlayerNr;
|
||||
if (ProfileIDs.Count < (i + 1))
|
||||
{
|
||||
ProfileIDs.Add(SelectedPlayerNr);
|
||||
added = ProfileIDs.Count - 1;
|
||||
}
|
||||
else if (ProfileIDs.Count >= (i + 1))
|
||||
{
|
||||
ProfileIDs[i] = SelectedPlayerNr;
|
||||
added = i;
|
||||
}
|
||||
UpdateButtonNext();
|
||||
//Update texture and name
|
||||
PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 1);
|
||||
PlayerDestinationButtons[i].SColor = new SColorF(1, 1, 1, 1);
|
||||
PlayerDestinationButtons[i].Texture = chooseAvatarStatic.Texture;
|
||||
PlayerDestinationButtons[i].STexture = chooseAvatarStatic.Texture;
|
||||
PlayerDestinationButtons[i].Text.Text = _Base.Profiles.GetProfiles()[SelectedPlayerNr].PlayerName;
|
||||
PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
|
||||
PlayerDestinationButtons[added].SColor = new SColorF(1, 1, 1, 1);
|
||||
PlayerDestinationButtons[added].Texture = chooseAvatarStatic.Texture;
|
||||
PlayerDestinationButtons[added].STexture = chooseAvatarStatic.Texture;
|
||||
PlayerDestinationButtons[added].Text.Text = _Base.Profiles.GetProfiles()[SelectedPlayerNr].PlayerName;
|
||||
//Update Tiles-List
|
||||
UpdateButtonPlayerChoose();
|
||||
}
|
||||
@@ -265,9 +250,20 @@ namespace Vocaluxe.PartyModes
|
||||
Next();
|
||||
}
|
||||
|
||||
if (MouseEvent.RB)
|
||||
if (MouseEvent.RB && IsMouseOver(MouseEvent))
|
||||
{
|
||||
Back();
|
||||
for (int i = 0; i < PlayerDestinationButtons.Count; i++)
|
||||
{
|
||||
if (PlayerDestinationButtons[i].Selected)
|
||||
{
|
||||
if ((i + 1) <= ProfileIDs.Count)
|
||||
{
|
||||
ProfileIDs.RemoveAt(i);
|
||||
UpdateButtonPlayerDestination();
|
||||
UpdateButtonPlayerChoose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -277,21 +273,8 @@ namespace Vocaluxe.PartyModes
|
||||
{
|
||||
base.OnShow();
|
||||
|
||||
ProfileIDs = new int[NumPlayers];
|
||||
for (int i = 0; i < ProfileIDs.Length; i++ )
|
||||
ProfileIDs[i] = -1;
|
||||
|
||||
for (int i = 0; i < PlayerDestinationButtons.Count; i++)
|
||||
{
|
||||
PlayerDestinationButtons[i].Text.Text = "Player " + (i+1);
|
||||
if (i <= NumPlayers)
|
||||
PlayerDestinationButtons[i].Visible = true;
|
||||
else
|
||||
PlayerDestinationButtons[i].Visible = false;
|
||||
}
|
||||
|
||||
UpdateButtonPlayerChoose();
|
||||
UpdateButtonPlayerDestination();
|
||||
UpdateButtonPlayerChoose();
|
||||
|
||||
UpdateButtonNext();
|
||||
}
|
||||
@@ -314,25 +297,122 @@ namespace Vocaluxe.PartyModes
|
||||
base.OnClose();
|
||||
}
|
||||
|
||||
private void Back()
|
||||
private void AddButtonPlayerDestination()
|
||||
{
|
||||
Data.ScreenNames.FadeToConfig = true;
|
||||
Data.ScreenNames.FadeToMain = false;
|
||||
_PartyMode.DataFromScreen(_ThemeName, Data);
|
||||
Buttons[htButtons(ButtonPlayerDestination)].Visible = false;
|
||||
PlayerDestinationButtons = new List<CButton>();
|
||||
int row = 0;
|
||||
int column = 0;
|
||||
for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++)
|
||||
{
|
||||
CButton b = GetNewButton(Buttons[htButtons(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;
|
||||
AddButton(b);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddButtonPlayerChoose()
|
||||
{
|
||||
Buttons[htButtons(ButtonPlayerChoose)].Visible = false;
|
||||
PlayerChooseButtons = new List<CPlayerChooseButton>();
|
||||
int row = 0;
|
||||
int column = 0;
|
||||
for (int i = 1; i <= PlayerChooseButtonsNumH * PlayerChooseButtonsNumW; i++)
|
||||
{
|
||||
CButton b = GetNewButton(Buttons[htButtons(ButtonPlayerChoose)]);
|
||||
b.Rect.X = PlayerChooseButtonsFirstX + column * (b.Rect.W + PlayerChooseButtonsSpaceH);
|
||||
b.Rect.Y = PlayerChooseButtonsFirstY + row * (b.Rect.H + PlayerChooseButtonsSpaceW);
|
||||
CPlayerChooseButton pcb = new CPlayerChooseButton();
|
||||
pcb.Button = b;
|
||||
pcb.ProfileID = -1;
|
||||
PlayerChooseButtons.Add(pcb);
|
||||
column++;
|
||||
if (column >= PlayerChooseButtonsNumH)
|
||||
{
|
||||
row++;
|
||||
column = 0;
|
||||
}
|
||||
b.Visible = true;
|
||||
AddButton(b);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateButtonPlayerChoose()
|
||||
{
|
||||
for (int i = (PlayerChooseButtonsOffset * PlayerChooseButtonsNumW); i < _Base.Profiles.GetProfiles().Length; i++)
|
||||
UpdateVisibleProfiles();
|
||||
if ((PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * (PlayerChooseButtonsOffset + 1) - PlayerChooseButtonsVisibleProfiles.Count >= (PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * PlayerChooseButtonsOffset)
|
||||
{
|
||||
if (i < PlayerChooseButtons.Count)
|
||||
UpdateButtonPlayerChoose(PlayerChooseButtonsOffset - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateButtonPlayerChoose(PlayerChooseButtonsOffset);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateButtonPlayerChoose(int Offset)
|
||||
{
|
||||
int NumButtonPlayerChoose = PlayerChooseButtonsNumW * PlayerChooseButtonsNumH;
|
||||
if (Offset < 0)
|
||||
Offset = 0;
|
||||
|
||||
if (NumButtonPlayerChoose * (Offset + 1) - PlayerChooseButtonsVisibleProfiles.Count < NumButtonPlayerChoose)
|
||||
{
|
||||
for (int i = 0; i < NumButtonPlayerChoose; i++)
|
||||
{
|
||||
PlayerChooseButtons[i].ProfileID = i;
|
||||
PlayerChooseButtons[i].Button.Text.Text = _Base.Profiles.GetProfiles()[i].PlayerName;
|
||||
PlayerChooseButtons[i].Button.Texture = _Base.Profiles.GetProfiles()[i].Avatar.Texture;
|
||||
PlayerChooseButtons[i].Button.STexture = _Base.Profiles.GetProfiles()[i].Avatar.Texture;
|
||||
PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 1);
|
||||
PlayerChooseButtons[i].Button.SColor = new SColorF(1, 1, 1, 1);
|
||||
if ((i + Offset * NumButtonPlayerChoose) < PlayerChooseButtonsVisibleProfiles.Count)
|
||||
{
|
||||
PlayerChooseButtons[i].ProfileID = PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose];
|
||||
PlayerChooseButtons[i].Button.Text.Text = _Base.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].PlayerName;
|
||||
PlayerChooseButtons[i].Button.Texture = _Base.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].Avatar.Texture;
|
||||
PlayerChooseButtons[i].Button.STexture = _Base.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].Avatar.Texture;
|
||||
PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 0.6f);
|
||||
PlayerChooseButtons[i].Button.SColor = new SColorF(1, 1, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerChooseButtons[i].ProfileID = -1;
|
||||
PlayerChooseButtons[i].Button.Text.Text = String.Empty;
|
||||
PlayerChooseButtons[i].Button.Texture = Buttons[htButtons(ButtonPlayerChoose)].Texture;
|
||||
PlayerChooseButtons[i].Button.STexture = Buttons[htButtons(ButtonPlayerChoose)].STexture;
|
||||
PlayerChooseButtons[i].Button.Color = Buttons[htButtons(ButtonPlayerChoose)].Color;
|
||||
PlayerChooseButtons[i].Button.SColor = Buttons[htButtons(ButtonPlayerChoose)].SColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateVisibleProfiles()
|
||||
{
|
||||
PlayerChooseButtonsVisibleProfiles.Clear();
|
||||
for (int i = 0; i < _Base.Profiles.GetProfiles().Length; i++)
|
||||
{
|
||||
bool visible = false;
|
||||
//Show profile only if active
|
||||
if (_Base.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
visible = true;
|
||||
}
|
||||
for (int p = 0; p < ProfileIDs.Count; p++)
|
||||
{
|
||||
//Don't show profile if is selected, but if selected and guest
|
||||
if (ProfileIDs[p] == i && _Base.Profiles.GetProfiles()[i].GuestProfile == EOffOn.TR_CONFIG_OFF)
|
||||
{
|
||||
visible = false;
|
||||
}
|
||||
}
|
||||
if (visible)
|
||||
{
|
||||
PlayerChooseButtonsVisibleProfiles.Add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -346,14 +426,43 @@ namespace Vocaluxe.PartyModes
|
||||
else
|
||||
PlayerDestinationButtons[i].Visible = false;
|
||||
}
|
||||
for (int i = 0; i < NumPlayers; i++)
|
||||
{
|
||||
if (i < ProfileIDs.Count)
|
||||
{
|
||||
if (ProfileIDs[i] != -1)
|
||||
{
|
||||
PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f);
|
||||
PlayerDestinationButtons[i].SColor = new SColorF(1, 1, 1, 1);
|
||||
PlayerDestinationButtons[i].Texture = _Base.Profiles.GetProfiles()[ProfileIDs[i]].Avatar.Texture;
|
||||
PlayerDestinationButtons[i].STexture = _Base.Profiles.GetProfiles()[ProfileIDs[i]].Avatar.Texture;
|
||||
PlayerDestinationButtons[i].Text.Text = _Base.Profiles.GetProfiles()[ProfileIDs[i]].PlayerName;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerDestinationButtons[i].Color = Buttons[htButtons(ButtonPlayerDestination)].Color;
|
||||
PlayerDestinationButtons[i].SColor = Buttons[htButtons(ButtonPlayerDestination)].SColor;
|
||||
PlayerDestinationButtons[i].Texture = Buttons[htButtons(ButtonPlayerDestination)].Texture;
|
||||
PlayerDestinationButtons[i].STexture = Buttons[htButtons(ButtonPlayerDestination)].STexture;
|
||||
PlayerDestinationButtons[i].Text.Text = String.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateButtonNext()
|
||||
{
|
||||
Buttons[htButtons(ButtonNext)].Visible = true;
|
||||
for (int i = 0; i < ProfileIDs.Length; i++)
|
||||
if (ProfileIDs[i] == -1)
|
||||
Buttons[htButtons(ButtonNext)].Visible = false;
|
||||
if (ProfileIDs.Count == NumPlayers)
|
||||
Buttons[htButtons(ButtonNext)].Visible = true;
|
||||
else
|
||||
Buttons[htButtons(ButtonNext)].Visible = false;
|
||||
}
|
||||
|
||||
private void Back()
|
||||
{
|
||||
Data.ScreenNames.FadeToConfig = true;
|
||||
Data.ScreenNames.FadeToMain = false;
|
||||
_PartyMode.DataFromScreen(_ThemeName, Data);
|
||||
}
|
||||
|
||||
private void Next()
|
||||
|
||||
Reference in new issue
Block a user