changes on ScreenSong for party mode are nearly completed
This commit is contained in:
1 parent
7ae8b32348
commit
bf3fdeb69a
6 files changed
+136
-47
No files matched your search
@@ -51,5 +51,10 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
_PartyModes[_CurrentModeNr].SetSearchString(SearchString, Visible);
|
||||
}
|
||||
|
||||
public static void JokerUsed(int TeamNr)
|
||||
{
|
||||
_PartyModes[_CurrentModeNr].JokerUsed(TeamNr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -200,7 +200,7 @@ namespace Vocaluxe.Menu.SongMenu
|
||||
|
||||
case Keys.Escape:
|
||||
case Keys.Back:
|
||||
if (CSongs.Category > -1 && CSongs.Tabs == EOffOn.TR_CONFIG_ON)
|
||||
if (CSongs.Category > -1 && CSongs.Tabs == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
ShowCategories();
|
||||
KeyEvent.Handled = true;
|
||||
@@ -212,21 +212,21 @@ namespace Vocaluxe.Menu.SongMenu
|
||||
break;
|
||||
|
||||
case Keys.PageUp:
|
||||
if (CSongs.Tabs == EOffOn.TR_CONFIG_ON)
|
||||
if (CSongs.Tabs == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
PrevCategory();
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.PageDown:
|
||||
if (CSongs.Tabs == EOffOn.TR_CONFIG_ON)
|
||||
if (CSongs.Tabs == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
NextCategory();
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Left:
|
||||
if (_Locked > 0 && !SongOptions.Selection.RandomOnly && !SongOptions.Selection.RandomOnly)
|
||||
if (_Locked > 0 && (!SongOptions.Selection.RandomOnly || SongOptions.Selection.CategoryChangeAllowed && CSongs.Category < 0))
|
||||
{
|
||||
_Locked--;
|
||||
if (CSongs.Category < 0 && _Locked < CSongs.NumCategories - _NumW ||
|
||||
@@ -236,7 +236,7 @@ namespace Vocaluxe.Menu.SongMenu
|
||||
break;
|
||||
|
||||
case Keys.Right:
|
||||
if (CSongs.Category < 0)
|
||||
if (CSongs.Category < 0 && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
if (_Locked < CSongs.NumCategories - 1)
|
||||
{
|
||||
@@ -248,7 +248,7 @@ namespace Vocaluxe.Menu.SongMenu
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_Locked < CSongs.NumVisibleSongs - 1 && !SongOptions.Selection.RandomOnly)
|
||||
if (CSongs.Category != -1 && _Locked < CSongs.NumVisibleSongs - 1 && !SongOptions.Selection.RandomOnly)
|
||||
{
|
||||
_Locked++;
|
||||
if (_Locked < CSongs.NumVisibleSongs - _NumW)
|
||||
@@ -258,13 +258,13 @@ namespace Vocaluxe.Menu.SongMenu
|
||||
break;
|
||||
|
||||
case Keys.Up:
|
||||
if (KeyEvent.ModSHIFT && CSongs.Tabs == EOffOn.TR_CONFIG_ON && !SongOptions.Selection.RandomOnly)
|
||||
if (KeyEvent.ModSHIFT && CSongs.Tabs == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
PrevCategory();
|
||||
break;
|
||||
}
|
||||
|
||||
if (_Locked > _NumW - 1 && (!SongOptions.Selection.RandomOnly || CSongs.Category < 0))
|
||||
if (_Locked > _NumW - 1 && (!SongOptions.Selection.RandomOnly || SongOptions.Selection.CategoryChangeAllowed && CSongs.Category < 0))
|
||||
{
|
||||
_Locked -= _NumW;
|
||||
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
|
||||
@@ -272,13 +272,13 @@ namespace Vocaluxe.Menu.SongMenu
|
||||
break;
|
||||
|
||||
case Keys.Down:
|
||||
if (KeyEvent.ModSHIFT && CSongs.Tabs == EOffOn.TR_CONFIG_ON && !SongOptions.Selection.RandomOnly)
|
||||
if (KeyEvent.ModSHIFT && CSongs.Tabs == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
NextCategory();
|
||||
break;
|
||||
}
|
||||
|
||||
if (CSongs.Category < 0)
|
||||
if (CSongs.Category < 0 && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
if (_Locked < CSongs.NumCategories - _NumW)
|
||||
{
|
||||
@@ -323,7 +323,7 @@ namespace Vocaluxe.Menu.SongMenu
|
||||
bool sel = false;
|
||||
int lastselection = _actualSelection;
|
||||
|
||||
if (!SongOptions.Selection.RandomOnly)
|
||||
if (!SongOptions.Selection.RandomOnly || CSongs.Category < 0 && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
@@ -359,7 +359,7 @@ namespace Vocaluxe.Menu.SongMenu
|
||||
if (!sel)
|
||||
_actualSelection = -1;
|
||||
|
||||
if ((MouseEvent.RB) && (CSongs.NumCategories > 0) && CSongs.Category >= 0 && CSongs.Tabs == EOffOn.TR_CONFIG_ON)
|
||||
if ((MouseEvent.RB) && (CSongs.NumCategories > 0) && CSongs.Category >= 0 && CSongs.Tabs == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
ShowCategories();
|
||||
return;
|
||||
@@ -389,7 +389,7 @@ namespace Vocaluxe.Menu.SongMenu
|
||||
|
||||
if (MouseEvent.Wheel > 0)
|
||||
{
|
||||
if (CHelper.IsInBounds(_ScrollRect, MouseEvent) && !SongOptions.Selection.PartyMode)
|
||||
if (CHelper.IsInBounds(_ScrollRect, MouseEvent) && (!SongOptions.Selection.RandomOnly || CSongs.Category < 0 && SongOptions.Selection.CategoryChangeAllowed))
|
||||
{
|
||||
if (CSongs.Category >= 0 && CSongs.NumVisibleSongs > _Offset + _NumW * MouseEvent.Wheel + _NumW * (_NumH - 1) ||
|
||||
CSongs.Category < 0 && CSongs.NumCategories > _Offset + _NumW * MouseEvent.Wheel + _NumW * (_NumH - 1))
|
||||
@@ -402,7 +402,7 @@ namespace Vocaluxe.Menu.SongMenu
|
||||
|
||||
if (MouseEvent.Wheel < 0)
|
||||
{
|
||||
if (CHelper.IsInBounds(_ScrollRect, MouseEvent) && !SongOptions.Selection.PartyMode)
|
||||
if (CHelper.IsInBounds(_ScrollRect, MouseEvent) && (!SongOptions.Selection.RandomOnly || CSongs.Category < 0 && SongOptions.Selection.CategoryChangeAllowed))
|
||||
{
|
||||
_Offset += _NumW * MouseEvent.Wheel;
|
||||
if (_Offset < 0)
|
||||
|
||||
@@ -8,6 +8,15 @@ namespace Vocaluxe.PartyModes
|
||||
{
|
||||
abstract class CPartyMode : IPartyMode
|
||||
{
|
||||
protected ScreenSongOptions _ScreenSongOptions;
|
||||
|
||||
public CPartyMode()
|
||||
{
|
||||
_ScreenSongOptions = new ScreenSongOptions();
|
||||
_ScreenSongOptions.Selection = new SelectionOptions();
|
||||
_ScreenSongOptions.Sorting = new SortingOptions();
|
||||
}
|
||||
|
||||
#region Implementation
|
||||
public virtual void Init()
|
||||
{
|
||||
@@ -31,6 +40,18 @@ namespace Vocaluxe.PartyModes
|
||||
public virtual void SetSearchString(string SearchString, bool Visible)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void JokerUsed(int TeamNr)
|
||||
{
|
||||
if (_ScreenSongOptions.Selection.NumJokers == null)
|
||||
return;
|
||||
|
||||
if (_ScreenSongOptions.Selection.NumJokers.Length < TeamNr)
|
||||
return;
|
||||
|
||||
if (_ScreenSongOptions.Selection.NumJokers[TeamNr] > 0)
|
||||
_ScreenSongOptions.Selection.NumJokers[TeamNr]--;
|
||||
}
|
||||
#endregion Implementation
|
||||
}
|
||||
}
|
||||
@@ -9,18 +9,12 @@ namespace Vocaluxe.PartyModes
|
||||
class CPartyModeNone : CPartyMode
|
||||
{
|
||||
//just a dummy for normal game mode
|
||||
private ScreenSongOptions _ScreenSongOptions;
|
||||
|
||||
public CPartyModeNone()
|
||||
{
|
||||
_ScreenSongOptions = new ScreenSongOptions();
|
||||
_ScreenSongOptions.Selection = new SelectionOptions();
|
||||
_ScreenSongOptions.Sorting = new SortingOptions();
|
||||
|
||||
_ScreenSongOptions.Selection.RandomOnly = false;
|
||||
_ScreenSongOptions.Selection.PartyMode = false;
|
||||
_ScreenSongOptions.Selection.NumJokers = 0;
|
||||
_ScreenSongOptions.Selection.NumTeams = 0;
|
||||
_ScreenSongOptions.Selection.CategoryChangeAllowed = true;
|
||||
_ScreenSongOptions.Selection.NumJokers = null;
|
||||
|
||||
_ScreenSongOptions.Sorting.SearchString = String.Empty;
|
||||
_ScreenSongOptions.Sorting.SearchStringVisible = false;
|
||||
@@ -40,5 +34,6 @@ namespace Vocaluxe.PartyModes
|
||||
_ScreenSongOptions.Sorting.SearchString = SearchString;
|
||||
_ScreenSongOptions.Sorting.SearchStringVisible = Visible;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -23,12 +23,30 @@ namespace Vocaluxe.PartyModes
|
||||
public bool SearchStringVisible;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configuration of song selection options
|
||||
/// </summary>
|
||||
public struct SelectionOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Choosing song only by random
|
||||
/// </summary>
|
||||
public bool RandomOnly;
|
||||
|
||||
/// <summary>
|
||||
/// If true, it is not allowed to go to MainScreen nor open the playlist nor open the song menu
|
||||
/// </summary>
|
||||
public bool PartyMode;
|
||||
public int NumJokers;
|
||||
public int NumTeams;
|
||||
|
||||
/// <summary>
|
||||
/// If true, it is not alled to change or leave the category. It's only valid if Tabs=On.
|
||||
/// </summary>
|
||||
public bool CategoryChangeAllowed;
|
||||
|
||||
/// <summary>
|
||||
/// The number of jokers left for each team
|
||||
/// </summary>
|
||||
public int[] NumJokers;
|
||||
}
|
||||
#endregion Structs
|
||||
|
||||
@@ -41,5 +59,7 @@ namespace Vocaluxe.PartyModes
|
||||
ScreenSongOptions GetScreenSongOptions();
|
||||
|
||||
void SetSearchString(string SearchString, bool Visible);
|
||||
|
||||
void JokerUsed(int TeamNr);
|
||||
}
|
||||
}
|
||||
@@ -140,7 +140,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
if (!_SongOptionsActive)
|
||||
{
|
||||
if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode))
|
||||
if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode) && KeyEvent.Mod != EModifier.Ctrl)
|
||||
{
|
||||
if (_SearchActive)
|
||||
ApplyNewSearchFilter(_SearchText + KeyEvent.Unicode);
|
||||
@@ -248,14 +248,8 @@ namespace Vocaluxe.Screens
|
||||
|
||||
//TODO: We need another key for random!
|
||||
case Keys.R:
|
||||
if (!_SearchActive && CSongs.Category != -1 && KeyEvent.Mod == EModifier.Ctrl)
|
||||
{
|
||||
SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong());
|
||||
}
|
||||
else if (CSongs.Category == -1 && KeyEvent.Mod == EModifier.Ctrl)
|
||||
{
|
||||
SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory());
|
||||
}
|
||||
if (KeyEvent.Mod == EModifier.Ctrl && !_sso.Selection.RandomOnly)
|
||||
SelectNextRandom(-1);
|
||||
break;
|
||||
|
||||
//TODO: Delete that!
|
||||
@@ -266,6 +260,30 @@ namespace Vocaluxe.Screens
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.D1:
|
||||
SelectNextRandom(0);
|
||||
break;
|
||||
|
||||
case Keys.D2:
|
||||
SelectNextRandom(1);
|
||||
break;
|
||||
|
||||
case Keys.D3:
|
||||
SelectNextRandom(2);
|
||||
break;
|
||||
|
||||
case Keys.D4:
|
||||
SelectNextRandom(3);
|
||||
break;
|
||||
|
||||
case Keys.D5:
|
||||
SelectNextRandom(4);
|
||||
break;
|
||||
|
||||
case Keys.D6:
|
||||
SelectNextRandom(5);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -399,21 +417,9 @@ namespace Vocaluxe.Screens
|
||||
}
|
||||
}
|
||||
|
||||
if (MouseEvent.MB)
|
||||
if (MouseEvent.MB && !_sso.Selection.PartyMode)
|
||||
{
|
||||
if (CSongs.Category != -1)
|
||||
{
|
||||
ToggleSongOptions(ESongOptionsView.None);
|
||||
SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (CSongs.Category == -1)
|
||||
{
|
||||
ToggleSongOptions(ESongOptionsView.None);
|
||||
SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory());
|
||||
return true;
|
||||
}
|
||||
return SelectNextRandom(-1);
|
||||
}
|
||||
|
||||
if (MouseEvent.LD && !_sso.Selection.PartyMode)
|
||||
@@ -759,6 +765,48 @@ namespace Vocaluxe.Screens
|
||||
CGraphics.FadeTo(EScreens.ScreenNames);
|
||||
}
|
||||
|
||||
private bool SelectNextRandom(int TeamNr)
|
||||
{
|
||||
if (TeamNr != -1 && _sso.Selection.RandomOnly && _sso.Selection.NumJokers != null)
|
||||
{
|
||||
bool result = false;
|
||||
if (_sso.Selection.NumJokers.Length > TeamNr)
|
||||
{
|
||||
if (_sso.Selection.NumJokers[TeamNr] > 0)
|
||||
{
|
||||
result = SelectNextRandomSong(TeamNr) || SelectNextRandomCategory();
|
||||
CParty.JokerUsed(TeamNr);
|
||||
_sso = CParty.GetSongSelectionOptions();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
return SelectNextRandomSong(TeamNr) || SelectNextRandomCategory();
|
||||
}
|
||||
|
||||
private bool SelectNextRandomSong(int TeamNr)
|
||||
{
|
||||
if (CSongs.Category != -1)
|
||||
{
|
||||
ToggleSongOptions(ESongOptionsView.None);
|
||||
SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool SelectNextRandomCategory()
|
||||
{
|
||||
if (CSongs.Category == -1)
|
||||
{
|
||||
ToggleSongOptions(ESongOptionsView.None);
|
||||
SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void JumpTo(char Letter)
|
||||
{
|
||||
int song = SongMenus[htSongMenus(SongMenu)].GetSelectedSong();
|
||||
|
||||
Reference in new issue
Block a user