prepared ScreenSong for party mode (it is not finished yet)

This commit is contained in:
Alexander Eckart committed 2012-12-10 23:11:28 +01:00
1 parent a73a371dfc
commit 7ae8b32348
7 files changed
+105 -71

No files matched your search

+5 -4
View File
@@ -6,6 +6,7 @@ using System.Xml.XPath;
using Vocaluxe.Base; using Vocaluxe.Base;
using Vocaluxe.Lib.Draw; using Vocaluxe.Lib.Draw;
using Vocaluxe.PartyModes;
namespace Vocaluxe.Menu.SongMenu namespace Vocaluxe.Menu.SongMenu
{ {
@@ -58,14 +59,14 @@ namespace Vocaluxe.Menu.SongMenu
_SongMenu.OnHide(); _SongMenu.OnHide();
} }
public void HandleInput(ref KeyEvent KeyEvent) public void HandleInput(ref KeyEvent KeyEvent, ScreenSongOptions SongOptions)
{ {
_SongMenu.HandleInput(ref KeyEvent); _SongMenu.HandleInput(ref KeyEvent, SongOptions);
} }
public void HandleMouse(ref MouseEvent MouseEvent) public void HandleMouse(ref MouseEvent MouseEvent, ScreenSongOptions SongOptions)
{ {
_SongMenu.HandleMouse(ref MouseEvent); _SongMenu.HandleMouse(ref MouseEvent, SongOptions);
} }
public void Draw() public void Draw()
+3 -2
View File
@@ -8,6 +8,7 @@ using System.Xml.XPath;
using Vocaluxe.Base; using Vocaluxe.Base;
using Vocaluxe.Lib.Draw; using Vocaluxe.Lib.Draw;
using Vocaluxe.PartyModes;
namespace Vocaluxe.Menu.SongMenu namespace Vocaluxe.Menu.SongMenu
{ {
@@ -488,13 +489,13 @@ namespace Vocaluxe.Menu.SongMenu
_SelectedInternal = _SelectedPending; _SelectedInternal = _SelectedPending;
} }
public virtual void HandleInput(ref KeyEvent KeyEvent) public virtual void HandleInput(ref KeyEvent KeyEvent, ScreenSongOptions SongOptions)
{ {
if (!_Initialized) if (!_Initialized)
return; return;
} }
public virtual void HandleMouse(ref MouseEvent MouseEvent) public virtual void HandleMouse(ref MouseEvent MouseEvent, ScreenSongOptions SongOptions)
{ {
if (!_Initialized) if (!_Initialized)
return; return;
+37 -30
View File
@@ -7,6 +7,7 @@ using System.Windows.Forms;
using Vocaluxe.Base; using Vocaluxe.Base;
using Vocaluxe.Lib.Draw; using Vocaluxe.Lib.Draw;
using Vocaluxe.Lib.Song; using Vocaluxe.Lib.Song;
using Vocaluxe.PartyModes;
namespace Vocaluxe.Menu.SongMenu namespace Vocaluxe.Menu.SongMenu
{ {
@@ -140,9 +141,9 @@ namespace Vocaluxe.Menu.SongMenu
} }
} }
public override void HandleInput(ref KeyEvent KeyEvent) public override void HandleInput(ref KeyEvent KeyEvent, ScreenSongOptions SongOptions)
{ {
base.HandleInput(ref KeyEvent); base.HandleInput(ref KeyEvent, SongOptions);
if (KeyEvent.KeyPressed) if (KeyEvent.KeyPressed)
{ {
@@ -225,7 +226,7 @@ namespace Vocaluxe.Menu.SongMenu
break; break;
case Keys.Left: case Keys.Left:
if (_Locked > 0) if (_Locked > 0 && !SongOptions.Selection.RandomOnly && !SongOptions.Selection.RandomOnly)
{ {
_Locked--; _Locked--;
if (CSongs.Category < 0 && _Locked < CSongs.NumCategories - _NumW || if (CSongs.Category < 0 && _Locked < CSongs.NumCategories - _NumW ||
@@ -247,7 +248,7 @@ namespace Vocaluxe.Menu.SongMenu
} }
else else
{ {
if (_Locked < CSongs.NumVisibleSongs - 1) if (_Locked < CSongs.NumVisibleSongs - 1 && !SongOptions.Selection.RandomOnly)
{ {
_Locked++; _Locked++;
if (_Locked < CSongs.NumVisibleSongs - _NumW) if (_Locked < CSongs.NumVisibleSongs - _NumW)
@@ -257,13 +258,13 @@ namespace Vocaluxe.Menu.SongMenu
break; break;
case Keys.Up: case Keys.Up:
if (KeyEvent.ModSHIFT && CSongs.Tabs == EOffOn.TR_CONFIG_ON) if (KeyEvent.ModSHIFT && CSongs.Tabs == EOffOn.TR_CONFIG_ON && !SongOptions.Selection.RandomOnly)
{ {
PrevCategory(); PrevCategory();
break; break;
} }
if (_Locked > _NumW - 1) if (_Locked > _NumW - 1 && (!SongOptions.Selection.RandomOnly || CSongs.Category < 0))
{ {
_Locked -= _NumW; _Locked -= _NumW;
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2))); UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
@@ -271,7 +272,7 @@ namespace Vocaluxe.Menu.SongMenu
break; break;
case Keys.Down: case Keys.Down:
if (KeyEvent.ModSHIFT && CSongs.Tabs == EOffOn.TR_CONFIG_ON) if (KeyEvent.ModSHIFT && CSongs.Tabs == EOffOn.TR_CONFIG_ON && !SongOptions.Selection.RandomOnly)
{ {
NextCategory(); NextCategory();
break; break;
@@ -289,7 +290,7 @@ namespace Vocaluxe.Menu.SongMenu
} }
else else
{ {
if (_Locked < CSongs.NumVisibleSongs - _NumW) if (_Locked < CSongs.NumVisibleSongs - _NumW && !SongOptions.Selection.RandomOnly)
{ {
_Locked += _NumW; _Locked += _NumW;
if (_Locked < CSongs.NumVisibleSongs - _NumW) if (_Locked < CSongs.NumVisibleSongs - _NumW)
@@ -314,37 +315,43 @@ namespace Vocaluxe.Menu.SongMenu
} }
} }
public override void HandleMouse(ref MouseEvent MouseEvent) public override void HandleMouse(ref MouseEvent MouseEvent, ScreenSongOptions SongOptions)
{ {
base.HandleMouse(ref MouseEvent); base.HandleMouse(ref MouseEvent, SongOptions);
int i = 0; int i = 0;
bool sel = false; bool sel = false;
int lastselection = _actualSelection; int lastselection = _actualSelection;
foreach (CStatic tile in _Tiles)
if (!SongOptions.Selection.RandomOnly)
{ {
if ((tile.Texture.index != _CoverTexture.index) && CHelper.IsInBounds(tile.Rect, MouseEvent) && !sel) foreach (CStatic tile in _Tiles)
{ {
if (MouseEvent.LB || CSongs.Category == -1) if ((tile.Texture.index != _CoverTexture.index) && CHelper.IsInBounds(tile.Rect, MouseEvent) && !sel)
{ {
if (_PreviewSelected == i + _Offset) if (MouseEvent.LB || CSongs.Category == -1)
_Locked = _PreviewSelected;
else
{ {
_PreviewSelected = i + _Offset; if (_PreviewSelected == i + _Offset)
_Locked = -1; _Locked = _PreviewSelected;
else
{
_PreviewSelected = i + _Offset;
_Locked = -1;
}
} }
tile.Selected = true;
_actualSelection = i + _Offset;
sel = true;
} }
tile.Selected = true; else
_actualSelection = i + _Offset; {
sel = true; tile.Selected = false;
}
i++;
} }
else
{
tile.Selected = false;
}
i++;
} }
else
sel = true;
if (MouseEvent.Sender == ESender.WiiMote && _actualSelection != lastselection && _actualSelection != -1) if (MouseEvent.Sender == ESender.WiiMote && _actualSelection != lastselection && _actualSelection != -1)
CInput.SetRumble(0.050f); CInput.SetRumble(0.050f);
@@ -357,11 +364,11 @@ namespace Vocaluxe.Menu.SongMenu
ShowCategories(); ShowCategories();
return; return;
} }
else if (MouseEvent.RB && CSongs.Tabs == EOffOn.TR_CONFIG_OFF) else if (MouseEvent.RB && CSongs.Tabs == EOffOn.TR_CONFIG_OFF && !SongOptions.Selection.PartyMode)
{ {
CGraphics.FadeTo(EScreens.ScreenMain); CGraphics.FadeTo(EScreens.ScreenMain);
} }
else if (_PreviewSelected != -1 && MouseEvent.LB && CSongs.Category != -1) else if (_PreviewSelected != -1 && MouseEvent.LB && CSongs.Category != -1 && !SongOptions.Selection.PartyMode)
{ {
if (CHelper.IsInBounds(_CoverBig.Rect, MouseEvent) || CHelper.IsInBounds(_TextBG.Rect, MouseEvent)) if (CHelper.IsInBounds(_CoverBig.Rect, MouseEvent) || CHelper.IsInBounds(_TextBG.Rect, MouseEvent))
{ {
@@ -382,7 +389,7 @@ namespace Vocaluxe.Menu.SongMenu
if (MouseEvent.Wheel > 0) if (MouseEvent.Wheel > 0)
{ {
if (CHelper.IsInBounds(_ScrollRect, MouseEvent)) if (CHelper.IsInBounds(_ScrollRect, MouseEvent) && !SongOptions.Selection.PartyMode)
{ {
if (CSongs.Category >= 0 && CSongs.NumVisibleSongs > _Offset + _NumW * MouseEvent.Wheel + _NumW * (_NumH - 1) || 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)) CSongs.Category < 0 && CSongs.NumCategories > _Offset + _NumW * MouseEvent.Wheel + _NumW * (_NumH - 1))
@@ -395,7 +402,7 @@ namespace Vocaluxe.Menu.SongMenu
if (MouseEvent.Wheel < 0) if (MouseEvent.Wheel < 0)
{ {
if (CHelper.IsInBounds(_ScrollRect, MouseEvent)) if (CHelper.IsInBounds(_ScrollRect, MouseEvent) && !SongOptions.Selection.PartyMode)
{ {
_Offset += _NumW * MouseEvent.Wheel; _Offset += _NumW * MouseEvent.Wheel;
if (_Offset < 0) if (_Offset < 0)
+3 -2
View File
@@ -4,6 +4,7 @@ using System.Text;
using Vocaluxe.Base; using Vocaluxe.Base;
using Vocaluxe.Lib.Draw; using Vocaluxe.Lib.Draw;
using Vocaluxe.PartyModes;
namespace Vocaluxe.Menu.SongMenu namespace Vocaluxe.Menu.SongMenu
{ {
@@ -13,8 +14,8 @@ namespace Vocaluxe.Menu.SongMenu
void OnShow(); void OnShow();
void OnHide(); void OnHide();
void HandleInput(ref KeyEvent KeyEvent); void HandleInput(ref KeyEvent KeyEvent, ScreenSongOptions SongOptions);
void HandleMouse(ref MouseEvent MouseEvent); void HandleMouse(ref MouseEvent MouseEvent, ScreenSongOptions SongOptions);
void Draw(); void Draw();
void ApplyVolume(float VolumeMax); void ApplyVolume(float VolumeMax);
+13 -12
View File
@@ -14,30 +14,31 @@ namespace Vocaluxe.PartyModes
public CPartyModeNone() public CPartyModeNone()
{ {
_ScreenSongOptions = new ScreenSongOptions(); _ScreenSongOptions = new ScreenSongOptions();
_ScreenSongOptions.SongSelection = new SongSelectionOptions(); _ScreenSongOptions.Selection = new SelectionOptions();
_ScreenSongOptions.SongSorting = new SongSortingOptions(); _ScreenSongOptions.Sorting = new SortingOptions();
_ScreenSongOptions.SongSelection.RandomOnly = false; _ScreenSongOptions.Selection.RandomOnly = false;
_ScreenSongOptions.SongSelection.NumJokers = 0; _ScreenSongOptions.Selection.PartyMode = false;
_ScreenSongOptions.SongSelection.NumTeams = 0; _ScreenSongOptions.Selection.NumJokers = 0;
_ScreenSongOptions.Selection.NumTeams = 0;
_ScreenSongOptions.SongSorting.SearchString = String.Empty; _ScreenSongOptions.Sorting.SearchString = String.Empty;
_ScreenSongOptions.SongSorting.SearchStringVisible = false; _ScreenSongOptions.Sorting.SearchStringVisible = false;
} }
public override ScreenSongOptions GetScreenSongOptions() public override ScreenSongOptions GetScreenSongOptions()
{ {
_ScreenSongOptions.SongSorting.SongSorting = CConfig.SongSorting; _ScreenSongOptions.Sorting.SongSorting = CConfig.SongSorting;
_ScreenSongOptions.SongSorting.Tabs = CConfig.Tabs; _ScreenSongOptions.Sorting.Tabs = CConfig.Tabs;
_ScreenSongOptions.SongSorting.IgnoreArticles = CConfig.IgnoreArticles; _ScreenSongOptions.Sorting.IgnoreArticles = CConfig.IgnoreArticles;
return _ScreenSongOptions; return _ScreenSongOptions;
} }
public override void SetSearchString(string SearchString, bool Visible) public override void SetSearchString(string SearchString, bool Visible)
{ {
_ScreenSongOptions.SongSorting.SearchString = SearchString; _ScreenSongOptions.Sorting.SearchString = SearchString;
_ScreenSongOptions.SongSorting.SearchStringVisible = Visible; _ScreenSongOptions.Sorting.SearchStringVisible = Visible;
} }
} }
} }
+5 -4
View File
@@ -10,11 +10,11 @@ namespace Vocaluxe.PartyModes
#region Structs #region Structs
public struct ScreenSongOptions public struct ScreenSongOptions
{ {
public SongSortingOptions SongSorting; public SortingOptions Sorting;
public SongSelectionOptions SongSelection; public SelectionOptions Selection;
} }
public struct SongSortingOptions public struct SortingOptions
{ {
public ESongSorting SongSorting; public ESongSorting SongSorting;
public EOffOn Tabs; public EOffOn Tabs;
@@ -23,9 +23,10 @@ namespace Vocaluxe.PartyModes
public bool SearchStringVisible; public bool SearchStringVisible;
} }
public struct SongSelectionOptions public struct SelectionOptions
{ {
public bool RandomOnly; public bool RandomOnly;
public bool PartyMode;
public int NumJokers; public int NumJokers;
public int NumTeams; public int NumTeams;
} }
+39 -17
View File
@@ -153,14 +153,14 @@ namespace Vocaluxe.Screens
} }
else else
{ {
SongMenus[htSongMenus(SongMenu)].HandleInput(ref KeyEvent); SongMenus[htSongMenus(SongMenu)].HandleInput(ref KeyEvent, _sso);
if (KeyEvent.Handled) if (KeyEvent.Handled)
return true; return true;
switch (KeyEvent.Key) switch (KeyEvent.Key)
{ {
case Keys.Escape: case Keys.Escape:
if (CSongs.Category < 0 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF) if ((CSongs.Category < 0 || !(_sso.Sorting.Tabs == EOffOn.TR_CONFIG_OFF)) && !_sso.Selection.PartyMode)
CGraphics.FadeTo(EScreens.ScreenMain); CGraphics.FadeTo(EScreens.ScreenMain);
break; break;
@@ -168,7 +168,12 @@ namespace Vocaluxe.Screens
if (CSongs.NumVisibleSongs > 0) if (CSongs.NumVisibleSongs > 0)
{ {
if (SongMenus[htSongMenus(SongMenu)].GetSelectedSong() != -1 && !_SongOptionsActive) if (SongMenus[htSongMenus(SongMenu)].GetSelectedSong() != -1 && !_SongOptionsActive)
ToggleSongOptions(ESongOptionsView.Song); {
if (!_sso.Selection.PartyMode)
ToggleSongOptions(ESongOptionsView.Song);
else
HandlePartySongSelection(SongMenus[htSongMenus(SongMenu)].GetSelectedSong());
}
} }
break; break;
@@ -187,13 +192,15 @@ namespace Vocaluxe.Screens
ApplyNewSearchFilter(_SearchText.Remove(_SearchText.Length - 1)); ApplyNewSearchFilter(_SearchText.Remove(_SearchText.Length - 1));
} }
if (!_SearchActive && CSongs.Category < 0) if (!_SearchActive && (CSongs.Category < 0) && !_sso.Selection.PartyMode)
{
CGraphics.FadeTo(EScreens.ScreenMain); CGraphics.FadeTo(EScreens.ScreenMain);
}
break; break;
case Keys.Space: case Keys.Space:
if (!_SearchActive) if (!_SearchActive && !_sso.Selection.PartyMode)
ToggleSongOptions(ESongOptionsView.General); ToggleSongOptions(ESongOptionsView.General);
break; break;
@@ -204,7 +211,7 @@ namespace Vocaluxe.Screens
_SearchText = String.Empty; _SearchText = String.Empty;
ApplyNewSearchFilter(_SearchText); ApplyNewSearchFilter(_SearchText);
} }
else else if (!_sso.Selection.PartyMode)
{ {
_SearchActive = true; _SearchActive = true;
} }
@@ -212,11 +219,11 @@ namespace Vocaluxe.Screens
//TODO: Delete it! ??? Shouldn't we keep this as shortcut? //TODO: Delete it! ??? Shouldn't we keep this as shortcut?
case Keys.A: case Keys.A:
if (!_SearchActive && KeyEvent.Mod == EModifier.None) if (!_SearchActive && KeyEvent.Mod == EModifier.None && !_sso.Selection.PartyMode)
{ {
StartRandomAllSongs(); StartRandomAllSongs();
} }
if (KeyEvent.Mod == EModifier.Ctrl) if (KeyEvent.Mod == EModifier.Ctrl && !_sso.Selection.PartyMode)
{ {
StartRandomVisibleSongs(); StartRandomVisibleSongs();
} }
@@ -232,7 +239,7 @@ namespace Vocaluxe.Screens
_SearchText = String.Empty; _SearchText = String.Empty;
ApplyNewSearchFilter(_SearchText); ApplyNewSearchFilter(_SearchText);
} }
else else if (!_sso.Selection.PartyMode)
{ {
_SearchActive = true; _SearchActive = true;
} }
@@ -253,7 +260,7 @@ namespace Vocaluxe.Screens
//TODO: Delete that! //TODO: Delete that!
case Keys.S: case Keys.S:
if (!_SearchActive && CSongs.NumVisibleSongs > 0) if (!_SearchActive && CSongs.NumVisibleSongs > 0 && !_sso.Selection.PartyMode)
{ {
StartMedleySong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong()); StartMedleySong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong());
} }
@@ -385,7 +392,7 @@ namespace Vocaluxe.Screens
return true; return true;
} }
if (CSongs.Category < 0) if (CSongs.Category < 0 && !_sso.Selection.PartyMode)
{ {
CGraphics.FadeTo(EScreens.ScreenMain); CGraphics.FadeTo(EScreens.ScreenMain);
return true; return true;
@@ -409,7 +416,7 @@ namespace Vocaluxe.Screens
} }
} }
if (MouseEvent.LD) if (MouseEvent.LD && !_sso.Selection.PartyMode)
{ {
if (CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1) if (CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1)
{ {
@@ -418,7 +425,7 @@ namespace Vocaluxe.Screens
} }
} }
SongMenus[htSongMenus(SongMenu)].HandleMouse(ref MouseEvent); SongMenus[htSongMenus(SongMenu)].HandleMouse(ref MouseEvent, _sso);
if (MouseEvent.LB) if (MouseEvent.LB)
{ {
@@ -494,7 +501,10 @@ namespace Vocaluxe.Screens
{ {
if (SongMenus[htSongMenus(SongMenu)].GetSelectedSong() != -1 && !_SongOptionsActive) if (SongMenus[htSongMenus(SongMenu)].GetSelectedSong() != -1 && !_SongOptionsActive)
{ {
ToggleSongOptions(ESongOptionsView.Song); if (!_sso.Selection.PartyMode)
ToggleSongOptions(ESongOptionsView.Song);
else
HandlePartySongSelection(SongMenus[htSongMenus(SongMenu)].GetSelectedSong());
return true; return true;
} }
else else
@@ -533,12 +543,19 @@ namespace Vocaluxe.Screens
base.OnShow(); base.OnShow();
_sso = CParty.GetSongSelectionOptions(); _sso = CParty.GetSongSelectionOptions();
CSongs.Sort(_sso.SongSorting.SongSorting, _sso.SongSorting.Tabs, _sso.SongSorting.IgnoreArticles, _sso.SongSorting.SearchString); CSongs.Sort(_sso.Sorting.SongSorting, _sso.Sorting.Tabs, _sso.Sorting.IgnoreArticles, _sso.Sorting.SearchString);
_SearchActive = _sso.SongSorting.SearchStringVisible; _SearchActive = _sso.Sorting.SearchStringVisible;
_SearchText = _sso.SongSorting.SearchString; _SearchText = _sso.Sorting.SearchString;
CGame.EnterNormalGame(); CGame.EnterNormalGame();
SongMenus[htSongMenus(SongMenu)].OnShow(); SongMenus[htSongMenus(SongMenu)].OnShow();
if (_sso.Selection.PartyMode)
_PlaylistActive = false;
if (_sso.Selection.PartyMode)
ToggleSongOptions(ESongOptionsView.None);
SongMenus[htSongMenus(SongMenu)].SetActive(!_PlaylistActive); SongMenus[htSongMenus(SongMenu)].SetActive(!_PlaylistActive);
SongMenus[htSongMenus(SongMenu)].SetSmallView(Playlists[htPlaylists(Playlist)].Visible); SongMenus[htSongMenus(SongMenu)].SetSmallView(Playlists[htPlaylists(Playlist)].Visible);
@@ -619,6 +636,11 @@ namespace Vocaluxe.Screens
SongMenus[htSongMenus(SongMenu)].ApplyVolume(CConfig.PreviewMusicVolume); SongMenus[htSongMenus(SongMenu)].ApplyVolume(CConfig.PreviewMusicVolume);
} }
private void HandlePartySongSelection(int SongNr)
{
}
private void StartSong(int SongNr) private void StartSong(int SongNr)
{ {
if ((CSongs.Category >= 0) && (SongNr >= 0)) if ((CSongs.Category >= 0) && (SongNr >= 0))