fixed profile handling in party mode challenge (TODO: fix it in challenge medley and tic-tac-toe too)
This commit is contained in:
1 parent
9e6a48c978
commit
622de6ec4d
5 files changed
+34
-110
No files matched your search
@@ -62,7 +62,6 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
private bool _SelectingMouseActive;
|
||||
private int _OldMouseX;
|
||||
private int _OldMouseY;
|
||||
private int _SelectedPlayerNr = -1;
|
||||
private bool _ButtonsAdded;
|
||||
|
||||
private int _NumPlayer = 4;
|
||||
@@ -148,34 +147,6 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
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
|
||||
for (int i = 0; i < PlayerChooseButtons.Count; i++)
|
||||
{
|
||||
if (PlayerChooseButtons[i].Button.Selected)
|
||||
{
|
||||
SelectedPlayerNr = PlayerChooseButtons[i].ProfileID;
|
||||
if (SelectedPlayerNr != -1)
|
||||
{
|
||||
//Activate mouse-selecting
|
||||
SelectingMouseActive = true;
|
||||
//Update of Drag/Drop-Texture
|
||||
chooseAvatarStatic.Visible = true;
|
||||
chooseAvatarStatic.Rect = PlayerChooseButtons[i].Button.Rect;
|
||||
chooseAvatarStatic.Rect.Z = -100;
|
||||
chooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
|
||||
chooseAvatarStatic.Texture = CBase.Profiles.GetProfiles()[SelectedPlayerNr].Avatar.Texture;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
//Check if LeftButton is hold and Select-Mode active
|
||||
if (mouseEvent.LBH && _SelectingMouseActive)
|
||||
{
|
||||
@@ -188,44 +159,6 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
// LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
|
||||
else 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 (_Data.ScreenNames.ProfileIDs.Count < (i + 1))
|
||||
{
|
||||
_Data.ScreenNames.ProfileIDs.Add(_SelectedPlayerNr);
|
||||
added = _Data.ScreenNames.ProfileIDs.Count - 1;
|
||||
}
|
||||
else if (_Data.ScreenNames.ProfileIDs.Count >= (i + 1))
|
||||
{
|
||||
_Data.ScreenNames.ProfileIDs[i] = _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.GetProfiles()[_SelectedPlayerNr].PlayerName;
|
||||
//Update Tiles-List
|
||||
_UpdateButtonPlayerChoose();
|
||||
}
|
||||
}
|
||||
}
|
||||
_SelectedPlayerNr = -1;
|
||||
}
|
||||
//Reset variables
|
||||
_SelectingMouseActive = false;
|
||||
_ChooseAvatarStatic.Visible = false;
|
||||
@@ -350,12 +283,11 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
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;
|
||||
@@ -377,14 +309,15 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
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.ProfileIDs.All(profileID => profileID != i);
|
||||
if (profiles[i].Active == EOffOn.TR_CONFIG_ON)
|
||||
visible = _Data.ScreenNames.ProfileIDs.All(profileID => profileID != profiles[i].ID);
|
||||
if (visible)
|
||||
_PlayerChooseButtonsVisibleProfiles.Add(i);
|
||||
_PlayerChooseButtonsVisibleProfiles.Add(profiles[i].ID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -409,11 +342,12 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
if (_Data.ScreenNames.ProfileIDs[i] != -1)
|
||||
{
|
||||
int id = _Data.ScreenNames.ProfileIDs[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.ProfileIDs[i]].Avatar.Texture;
|
||||
_PlayerDestinationButtons[i].SelTexture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDs[i]].Avatar.Texture;
|
||||
_PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDs[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;
|
||||
}
|
||||
}
|
||||
@@ -444,17 +378,18 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
foreach (CPlayerChooseButton button in _PlayerChooseButtons)
|
||||
{
|
||||
if (!button.Button.Selected || button.ProfileID == -1 || _Data.ScreenNames.ProfileIDs.Count >= _NumPlayer)
|
||||
int id = button.ProfileID;
|
||||
if (!button.Button.Selected || id == -1 || _Data.ScreenNames.ProfileIDs.Count >= _NumPlayer)
|
||||
continue;
|
||||
_Data.ScreenNames.ProfileIDs.Add(button.ProfileID);
|
||||
_Data.ScreenNames.ProfileIDs.Add(id);
|
||||
int added = _Data.ScreenNames.ProfileIDs.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.GetProfiles()[button.ProfileID].Avatar.Texture;
|
||||
_PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[button.ProfileID].Avatar.Texture;
|
||||
_PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[button.ProfileID].PlayerName;
|
||||
_PlayerDestinationButtons[added].Texture = CBase.Profiles.GetAvatar(id);
|
||||
_PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetAvatar(id);
|
||||
_PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetPlayerName(id);
|
||||
_PlayerDestinationButtons[added].Enabled = true;
|
||||
//Update Tiles-List
|
||||
_UpdateButtonPlayerChoose();
|
||||
|
||||
Reference in new issue
Block a user