Merge branch 'challenge' of github.com:Vocaluxe/Vocaluxe into challenge

This commit is contained in:
Florian Kuepper committed 2012-12-17 18:54:57 +01:00
commit 39ef7b1d2d
5 files changed
+211 -105

No files matched your search

@@ -114,41 +114,12 @@ 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();
}
}
}
OnAdd();
OnRemove();
break;
case Keys.Delete:
for (int i = 0; i < PlayerDestinationButtons.Count; i++)
{
if (PlayerDestinationButtons[i].Selected)
{
if ((i + 1) <= ProfileIDs.Count)
{
ProfileIDs.RemoveAt(i);
UpdateButtonPlayerDestination();
UpdateButtonPlayerChoose();
}
}
}
OnRemove();
break;
}
}
@@ -159,6 +130,7 @@ namespace Vocaluxe.PartyModes
{
base.HandleMouse(MouseEvent);
/*
//Check if LeftButton is hold and Select-Mode inactive
if (MouseEvent.LBH && !SelectingMouseActive)
{
@@ -184,7 +156,7 @@ namespace Vocaluxe.PartyModes
}
}
}
}
}*/
//Check if LeftButton is hold and Select-Mode active
if (MouseEvent.LBH && SelectingMouseActive)
@@ -248,22 +220,13 @@ namespace Vocaluxe.PartyModes
if (Buttons[htButtons(ButtonNext)].Selected)
Next();
OnAdd();
}
if (MouseEvent.RB && IsMouseOver(MouseEvent))
{
for (int i = 0; i < PlayerDestinationButtons.Count; i++)
{
if (PlayerDestinationButtons[i].Selected)
{
if ((i + 1) <= ProfileIDs.Count)
{
ProfileIDs.RemoveAt(i);
UpdateButtonPlayerDestination();
UpdateButtonPlayerChoose();
}
}
}
OnRemove();
}
return true;
@@ -316,6 +279,7 @@ namespace Vocaluxe.PartyModes
column = 0;
}
b.Visible = true;
b.Enabled = false;
AddButton(b);
}
}
@@ -342,6 +306,7 @@ namespace Vocaluxe.PartyModes
column = 0;
}
b.Visible = true;
b.Enabled = false;
AddButton(b);
}
}
@@ -377,6 +342,7 @@ namespace Vocaluxe.PartyModes
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);
PlayerChooseButtons[i].Button.Enabled = true;
}
else
{
@@ -386,6 +352,7 @@ namespace Vocaluxe.PartyModes
PlayerChooseButtons[i].Button.STexture = Buttons[htButtons(ButtonPlayerChoose)].STexture;
PlayerChooseButtons[i].Button.Color = Buttons[htButtons(ButtonPlayerChoose)].Color;
PlayerChooseButtons[i].Button.SColor = Buttons[htButtons(ButtonPlayerChoose)].SColor;
PlayerChooseButtons[i].Button.Enabled = false;
}
}
}
@@ -421,10 +388,16 @@ namespace Vocaluxe.PartyModes
{
for (int i = 0; i < PlayerDestinationButtons.Count; i++)
{
if(NumPlayers > i)
if (NumPlayers > i)
{
PlayerDestinationButtons[i].Visible = true;
PlayerDestinationButtons[i].Enabled = true;
}
else
{
PlayerDestinationButtons[i].Visible = false;
PlayerDestinationButtons[i].Enabled = false;
}
}
for (int i = 0; i < NumPlayers; i++)
{
@@ -437,6 +410,7 @@ namespace Vocaluxe.PartyModes
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;
PlayerDestinationButtons[i].Enabled = true;
}
}
else
@@ -446,6 +420,7 @@ namespace Vocaluxe.PartyModes
PlayerDestinationButtons[i].Texture = Buttons[htButtons(ButtonPlayerDestination)].Texture;
PlayerDestinationButtons[i].STexture = Buttons[htButtons(ButtonPlayerDestination)].STexture;
PlayerDestinationButtons[i].Text.Text = String.Empty;
PlayerDestinationButtons[i].Enabled = false;
}
}
}
@@ -458,6 +433,49 @@ namespace Vocaluxe.PartyModes
Buttons[htButtons(ButtonNext)].Visible = false;
}
private void OnAdd()
{
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;
PlayerDestinationButtons[added].Enabled = true;
//Update Tiles-List
UpdateButtonPlayerChoose();
CheckInteraction();
}
}
}
}
private void OnRemove()
{
for (int i = 0; i < PlayerDestinationButtons.Count; i++)
{
if (PlayerDestinationButtons[i].Selected)
{
if ((i + 1) <= ProfileIDs.Count)
{
ProfileIDs.RemoveAt(i);
UpdateButtonNext();
UpdateButtonPlayerDestination();
UpdateButtonPlayerChoose();
CheckInteraction();
}
}
}
}
private void Back()
{
Data.ScreenNames.FadeToConfig = true;
+64 -46
View File
@@ -114,41 +114,12 @@ 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();
}
}
}
OnAdd();
OnRemove();
break;
case Keys.Delete:
for (int i = 0; i < PlayerDestinationButtons.Count; i++)
{
if (PlayerDestinationButtons[i].Selected)
{
if ((i + 1) <= ProfileIDs.Count)
{
ProfileIDs.RemoveAt(i);
UpdateButtonPlayerDestination();
UpdateButtonPlayerChoose();
}
}
}
OnRemove();
break;
}
}
@@ -159,6 +130,7 @@ namespace Vocaluxe.PartyModes
{
base.HandleMouse(MouseEvent);
/*
//Check if LeftButton is hold and Select-Mode inactive
if (MouseEvent.LBH && !SelectingMouseActive)
{
@@ -184,7 +156,7 @@ namespace Vocaluxe.PartyModes
}
}
}
}
}*/
//Check if LeftButton is hold and Select-Mode active
if (MouseEvent.LBH && SelectingMouseActive)
@@ -248,22 +220,13 @@ namespace Vocaluxe.PartyModes
if (Buttons[htButtons(ButtonNext)].Selected)
Next();
OnAdd();
}
if (MouseEvent.RB && IsMouseOver(MouseEvent))
{
for (int i = 0; i < PlayerDestinationButtons.Count; i++)
{
if (PlayerDestinationButtons[i].Selected)
{
if ((i + 1) <= ProfileIDs.Count)
{
ProfileIDs.RemoveAt(i);
UpdateButtonPlayerDestination();
UpdateButtonPlayerChoose();
}
}
}
OnRemove();
}
return true;
@@ -316,6 +279,7 @@ namespace Vocaluxe.PartyModes
column = 0;
}
b.Visible = true;
b.Enabled = false;
AddButton(b);
}
}
@@ -342,6 +306,7 @@ namespace Vocaluxe.PartyModes
column = 0;
}
b.Visible = true;
b.Enabled = false;
AddButton(b);
}
}
@@ -377,6 +342,7 @@ namespace Vocaluxe.PartyModes
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);
PlayerChooseButtons[i].Button.Enabled = true;
}
else
{
@@ -386,6 +352,7 @@ namespace Vocaluxe.PartyModes
PlayerChooseButtons[i].Button.STexture = Buttons[htButtons(ButtonPlayerChoose)].STexture;
PlayerChooseButtons[i].Button.Color = Buttons[htButtons(ButtonPlayerChoose)].Color;
PlayerChooseButtons[i].Button.SColor = Buttons[htButtons(ButtonPlayerChoose)].SColor;
PlayerChooseButtons[i].Button.Enabled = false;
}
}
}
@@ -421,10 +388,16 @@ namespace Vocaluxe.PartyModes
{
for (int i = 0; i < PlayerDestinationButtons.Count; i++)
{
if(NumPlayers > i)
if (NumPlayers > i)
{
PlayerDestinationButtons[i].Visible = true;
PlayerDestinationButtons[i].Enabled = true;
}
else
{
PlayerDestinationButtons[i].Visible = false;
PlayerDestinationButtons[i].Enabled = false;
}
}
for (int i = 0; i < NumPlayers; i++)
{
@@ -437,6 +410,7 @@ namespace Vocaluxe.PartyModes
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;
PlayerDestinationButtons[i].Enabled = true;
}
}
else
@@ -446,6 +420,7 @@ namespace Vocaluxe.PartyModes
PlayerDestinationButtons[i].Texture = Buttons[htButtons(ButtonPlayerDestination)].Texture;
PlayerDestinationButtons[i].STexture = Buttons[htButtons(ButtonPlayerDestination)].STexture;
PlayerDestinationButtons[i].Text.Text = String.Empty;
PlayerDestinationButtons[i].Enabled = false;
}
}
}
@@ -458,6 +433,49 @@ namespace Vocaluxe.PartyModes
Buttons[htButtons(ButtonNext)].Visible = false;
}
private void OnAdd()
{
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;
PlayerDestinationButtons[added].Enabled = true;
//Update Tiles-List
UpdateButtonPlayerChoose();
CheckInteraction();
}
}
}
}
private void OnRemove()
{
for (int i = 0; i < PlayerDestinationButtons.Count; i++)
{
if (PlayerDestinationButtons[i].Selected)
{
if ((i + 1) <= ProfileIDs.Count)
{
ProfileIDs.RemoveAt(i);
UpdateButtonNext();
UpdateButtonPlayerDestination();
UpdateButtonPlayerChoose();
CheckInteraction();
}
}
}
}
private void Back()
{
Data.ScreenNames.FadeToConfig = true;
+4 -1
View File
@@ -66,6 +66,7 @@ namespace Vocaluxe.Menu
}
}
public bool Visible;
public bool Enabled;
public string GetThemeName()
{
@@ -89,6 +90,7 @@ namespace Vocaluxe.Menu
Selected = false;
Visible = true;
EditMode = false;
Enabled = true;
Reflection = false;
ReflectionSpace = 0f;
@@ -122,6 +124,7 @@ namespace Vocaluxe.Menu
Visible = true;
EditMode = false;
_ThemeLoaded = false;
Enabled = button.Enabled;
Reflection = button.Reflection;
ReflectionHeight = button.ReflectionHeight;
@@ -304,7 +307,7 @@ namespace Vocaluxe.Menu
STexture texture = new STexture(-1);
if (!Selected && !Pressed)
if (!Selected && !Pressed || !Enabled)
{
if (Texture.index != -1)
texture = Texture;
+53 -6
View File
@@ -1370,6 +1370,12 @@ namespace Vocaluxe.Menu
#endregion Elements
#region InteractionHandling
public void CheckInteraction()
{
if (!_IsEnabled(_Selection) || !_IsVisible(_Selection))
PrevInteraction();
}
public void NextInteraction()
{
if (_Interactions.Count > 0)
@@ -1460,7 +1466,7 @@ namespace Vocaluxe.Menu
float z = _Base.Settings.GetZFar();
for (int i = 0; i < _Interactions.Count; i++)
{
if ((_Base.Settings.GetGameState() == EGameState.EditTheme) || (!_Interactions[i].ThemeEditorOnly && _IsVisible(i)))
if ((_Base.Settings.GetGameState() == EGameState.EditTheme) || (!_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsEnabled(i)))
{
if (_IsMouseOver(x, y, _Interactions[i]))
{
@@ -1613,7 +1619,7 @@ namespace Vocaluxe.Menu
if (start > _Interactions.Count - 1)
start = 0;
if ((start == _Selection) || (!_Interactions[start].ThemeEditorOnly && _IsVisible(start)))
if ((start == _Selection) || (!_Interactions[start].ThemeEditorOnly && _IsVisible(start) && _IsEnabled(start)))
found = true;
} while (!found);
_Selection = start;
@@ -1640,7 +1646,7 @@ namespace Vocaluxe.Menu
if (start < 0)
start = _Interactions.Count - 1;
if ((start == _Selection) || (!_Interactions[start].ThemeEditorOnly && _IsVisible(start)))
if ((start == _Selection) || (!_Interactions[start].ThemeEditorOnly && _IsVisible(start) && _IsEnabled(start)))
found = true;
} while (!found);
_Selection = start;
@@ -1741,7 +1747,7 @@ namespace Vocaluxe.Menu
for (int i = 0; i < _Interactions.Count; i++)
{
if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i))
if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsEnabled(i))
{
SRectF targetRect = _GetRect(i);
float dist = _GetDistanceDirect(Key, actualRect, targetRect);
@@ -1758,7 +1764,7 @@ namespace Vocaluxe.Menu
{
for (int i = 0; i < _Interactions.Count; i++)
{
if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i))
if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsEnabled(i))
{
SRectF targetRect = _GetRect(i);
float dist = _GetDistance180(Key, actualRect, targetRect);
@@ -1794,7 +1800,7 @@ namespace Vocaluxe.Menu
for (int i = 0; i < _Interactions.Count; i++)
{
if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i))
if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsEnabled(i))
{
SRectF targetRect = _GetRect(i);
float dist = _GetDistance180(Key, actualRect, targetRect);
@@ -2074,6 +2080,9 @@ namespace Vocaluxe.Menu
private bool _IsVisible(int interaction)
{
if (_Selection >= _Interactions.Count || _Selection < 0)
return false;
switch (_Interactions[interaction].Type)
{
case EType.TButton:
@@ -2107,6 +2116,44 @@ namespace Vocaluxe.Menu
return false;
}
private bool _IsEnabled(int interaction)
{
if (_Selection >= _Interactions.Count || _Selection < 0)
return false;
switch (_Interactions[interaction].Type)
{
case EType.TButton:
return _Buttons[_Interactions[interaction].Num].Enabled;
case EType.TSelectSlide:
return _SelectSlides[_Interactions[interaction].Num].Visible;
case EType.TStatic:
return false; //_Statics[_Interactions[interaction].Num].Visible;
case EType.TText:
return false; //_Texts[_Interactions[interaction].Num].Visible;
case EType.TSongMenu:
return _SongMenus[_Interactions[interaction].Num].Visible;
case EType.TLyric:
return false; //_Lyrics[_Interactions[interaction].Num].Visible;
case EType.TNameSelection:
return _NameSelections[_Interactions[interaction].Num].Visible;
case EType.TEqualizer:
return false; //_Equalizers[_Interactions[interaction].Num].Visible;
case EType.TPlaylist:
return _Playlists[_Interactions[interaction].Num].Visible;
}
return false;
}
private SRectF _GetRect(int interaction)
{
SRectF Result = new SRectF();
+26 -6
View File
@@ -481,7 +481,7 @@ namespace Vocaluxe.Menu
float z = _Base.Settings.GetZFar();
for (int i = 0; i < _Interactions.Count; i++)
{
if ((_Base.Settings.GetGameState() == EGameState.EditTheme) || (!_Interactions[i].ThemeEditorOnly && _IsVisible(i)))
if ((_Base.Settings.GetGameState() == EGameState.EditTheme) || (!_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsEnabled(i)))
{
if (_IsMouseOver(x, y, _Interactions[i]))
{
@@ -577,7 +577,7 @@ namespace Vocaluxe.Menu
if (start > _Interactions.Count - 1)
start = 0;
if ((start == _Selection) || (!_Interactions[start].ThemeEditorOnly && _IsVisible(start)))
if ((start == _Selection) || (!_Interactions[start].ThemeEditorOnly && _IsVisible(start) && _IsEnabled(start)))
found = true;
} while (!found);
_Selection = start;
@@ -604,7 +604,7 @@ namespace Vocaluxe.Menu
if (start < 0)
start = _Interactions.Count - 1;
if ((start == _Selection) || (!_Interactions[start].ThemeEditorOnly && _IsVisible(start)))
if ((start == _Selection) || (!_Interactions[start].ThemeEditorOnly && _IsVisible(start) && _IsEnabled(start)))
found = true;
} while (!found);
_Selection = start;
@@ -705,7 +705,7 @@ namespace Vocaluxe.Menu
for (int i = 0; i < _Interactions.Count; i++)
{
if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i))
if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsEnabled(i))
{
SRectF targetRect = _GetRect(i);
float dist = _GetDistanceDirect(Key, actualRect, targetRect);
@@ -722,7 +722,7 @@ namespace Vocaluxe.Menu
{
for (int i = 0; i < _Interactions.Count; i++)
{
if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i))
if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsEnabled(i))
{
SRectF targetRect = _GetRect(i);
float dist = _GetDistance180(Key, actualRect, targetRect);
@@ -758,7 +758,7 @@ namespace Vocaluxe.Menu
for (int i = 0; i < _Interactions.Count; i++)
{
if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i))
if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsEnabled(i))
{
SRectF targetRect = _GetRect(i);
float dist = _GetDistance180(Key, actualRect, targetRect);
@@ -1014,6 +1014,26 @@ namespace Vocaluxe.Menu
return false;
}
private bool _IsEnabled(int interaction)
{
switch (_Interactions[interaction].Type)
{
case EType.TButton:
return _Buttons[_Interactions[interaction].Num].Enabled;
case EType.TSelectSlide:
return _SelectSlides[_Interactions[interaction].Num].Visible;
case EType.TStatic:
return false; //_Statics[_Interactions[interaction].Num].Visible;
case EType.TText:
return false; //_Texts[_Interactions[interaction].Num].Visible;
}
return false;
}
private SRectF _GetRect(int interaction)
{
SRectF Result = new SRectF();