diff --git a/Vocaluxe/Menu/SongMenu/CSongMenu.cs b/Vocaluxe/Menu/SongMenu/CSongMenu.cs index 3163d783..dbb09697 100644 --- a/Vocaluxe/Menu/SongMenu/CSongMenu.cs +++ b/Vocaluxe/Menu/SongMenu/CSongMenu.cs @@ -6,6 +6,7 @@ using System.Xml.XPath; using Vocaluxe.Base; using Vocaluxe.Lib.Draw; +using Vocaluxe.PartyModes; namespace Vocaluxe.Menu.SongMenu { @@ -58,14 +59,14 @@ namespace Vocaluxe.Menu.SongMenu _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() diff --git a/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs b/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs index 7f29d380..deaa6f5c 100644 --- a/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs +++ b/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs @@ -8,6 +8,7 @@ using System.Xml.XPath; using Vocaluxe.Base; using Vocaluxe.Lib.Draw; +using Vocaluxe.PartyModes; namespace Vocaluxe.Menu.SongMenu { @@ -488,13 +489,13 @@ namespace Vocaluxe.Menu.SongMenu _SelectedInternal = _SelectedPending; } - public virtual void HandleInput(ref KeyEvent KeyEvent) + public virtual void HandleInput(ref KeyEvent KeyEvent, ScreenSongOptions SongOptions) { if (!_Initialized) return; } - public virtual void HandleMouse(ref MouseEvent MouseEvent) + public virtual void HandleMouse(ref MouseEvent MouseEvent, ScreenSongOptions SongOptions) { if (!_Initialized) return; diff --git a/Vocaluxe/Menu/SongMenu/CSongMenuTileBoard.cs b/Vocaluxe/Menu/SongMenu/CSongMenuTileBoard.cs index e0342575..69d6f642 100644 --- a/Vocaluxe/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/Vocaluxe/Menu/SongMenu/CSongMenuTileBoard.cs @@ -7,6 +7,7 @@ using System.Windows.Forms; using Vocaluxe.Base; using Vocaluxe.Lib.Draw; using Vocaluxe.Lib.Song; +using Vocaluxe.PartyModes; 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) { @@ -225,7 +226,7 @@ namespace Vocaluxe.Menu.SongMenu break; case Keys.Left: - if (_Locked > 0) + if (_Locked > 0 && !SongOptions.Selection.RandomOnly && !SongOptions.Selection.RandomOnly) { _Locked--; if (CSongs.Category < 0 && _Locked < CSongs.NumCategories - _NumW || @@ -247,7 +248,7 @@ namespace Vocaluxe.Menu.SongMenu } else { - if (_Locked < CSongs.NumVisibleSongs - 1) + if (_Locked < CSongs.NumVisibleSongs - 1 && !SongOptions.Selection.RandomOnly) { _Locked++; if (_Locked < CSongs.NumVisibleSongs - _NumW) @@ -257,13 +258,13 @@ namespace Vocaluxe.Menu.SongMenu break; 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(); break; } - - if (_Locked > _NumW - 1) + + if (_Locked > _NumW - 1 && (!SongOptions.Selection.RandomOnly || CSongs.Category < 0)) { _Locked -= _NumW; UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2))); @@ -271,7 +272,7 @@ namespace Vocaluxe.Menu.SongMenu break; 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(); break; @@ -289,7 +290,7 @@ namespace Vocaluxe.Menu.SongMenu } else { - if (_Locked < CSongs.NumVisibleSongs - _NumW) + if (_Locked < CSongs.NumVisibleSongs - _NumW && !SongOptions.Selection.RandomOnly) { _Locked += _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; bool sel = false; 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) - _Locked = _PreviewSelected; - else + if (MouseEvent.LB || CSongs.Category == -1) { - _PreviewSelected = i + _Offset; - _Locked = -1; + if (_PreviewSelected == i + _Offset) + _Locked = _PreviewSelected; + else + { + _PreviewSelected = i + _Offset; + _Locked = -1; + } } + tile.Selected = true; + _actualSelection = i + _Offset; + sel = true; } - tile.Selected = true; - _actualSelection = i + _Offset; - sel = true; + else + { + tile.Selected = false; + } + i++; } - else - { - tile.Selected = false; - } - i++; } + else + sel = true; if (MouseEvent.Sender == ESender.WiiMote && _actualSelection != lastselection && _actualSelection != -1) CInput.SetRumble(0.050f); @@ -357,11 +364,11 @@ namespace Vocaluxe.Menu.SongMenu ShowCategories(); 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); } - 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)) { @@ -382,7 +389,7 @@ namespace Vocaluxe.Menu.SongMenu 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) || 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 (CHelper.IsInBounds(_ScrollRect, MouseEvent)) + if (CHelper.IsInBounds(_ScrollRect, MouseEvent) && !SongOptions.Selection.PartyMode) { _Offset += _NumW * MouseEvent.Wheel; if (_Offset < 0) diff --git a/Vocaluxe/Menu/SongMenu/ISongMenu.cs b/Vocaluxe/Menu/SongMenu/ISongMenu.cs index 21d0015a..8a63a8cb 100644 --- a/Vocaluxe/Menu/SongMenu/ISongMenu.cs +++ b/Vocaluxe/Menu/SongMenu/ISongMenu.cs @@ -4,6 +4,7 @@ using System.Text; using Vocaluxe.Base; using Vocaluxe.Lib.Draw; +using Vocaluxe.PartyModes; namespace Vocaluxe.Menu.SongMenu { @@ -13,8 +14,8 @@ namespace Vocaluxe.Menu.SongMenu void OnShow(); void OnHide(); - void HandleInput(ref KeyEvent KeyEvent); - void HandleMouse(ref MouseEvent MouseEvent); + void HandleInput(ref KeyEvent KeyEvent, ScreenSongOptions SongOptions); + void HandleMouse(ref MouseEvent MouseEvent, ScreenSongOptions SongOptions); void Draw(); void ApplyVolume(float VolumeMax); diff --git a/Vocaluxe/PartyModes/CPartyModeNone.cs b/Vocaluxe/PartyModes/CPartyModeNone.cs index 5e3e20cd..77e0fd09 100644 --- a/Vocaluxe/PartyModes/CPartyModeNone.cs +++ b/Vocaluxe/PartyModes/CPartyModeNone.cs @@ -14,30 +14,31 @@ namespace Vocaluxe.PartyModes public CPartyModeNone() { _ScreenSongOptions = new ScreenSongOptions(); - _ScreenSongOptions.SongSelection = new SongSelectionOptions(); - _ScreenSongOptions.SongSorting = new SongSortingOptions(); + _ScreenSongOptions.Selection = new SelectionOptions(); + _ScreenSongOptions.Sorting = new SortingOptions(); - _ScreenSongOptions.SongSelection.RandomOnly = false; - _ScreenSongOptions.SongSelection.NumJokers = 0; - _ScreenSongOptions.SongSelection.NumTeams = 0; + _ScreenSongOptions.Selection.RandomOnly = false; + _ScreenSongOptions.Selection.PartyMode = false; + _ScreenSongOptions.Selection.NumJokers = 0; + _ScreenSongOptions.Selection.NumTeams = 0; - _ScreenSongOptions.SongSorting.SearchString = String.Empty; - _ScreenSongOptions.SongSorting.SearchStringVisible = false; + _ScreenSongOptions.Sorting.SearchString = String.Empty; + _ScreenSongOptions.Sorting.SearchStringVisible = false; } public override ScreenSongOptions GetScreenSongOptions() { - _ScreenSongOptions.SongSorting.SongSorting = CConfig.SongSorting; - _ScreenSongOptions.SongSorting.Tabs = CConfig.Tabs; - _ScreenSongOptions.SongSorting.IgnoreArticles = CConfig.IgnoreArticles; + _ScreenSongOptions.Sorting.SongSorting = CConfig.SongSorting; + _ScreenSongOptions.Sorting.Tabs = CConfig.Tabs; + _ScreenSongOptions.Sorting.IgnoreArticles = CConfig.IgnoreArticles; return _ScreenSongOptions; } public override void SetSearchString(string SearchString, bool Visible) { - _ScreenSongOptions.SongSorting.SearchString = SearchString; - _ScreenSongOptions.SongSorting.SearchStringVisible = Visible; + _ScreenSongOptions.Sorting.SearchString = SearchString; + _ScreenSongOptions.Sorting.SearchStringVisible = Visible; } } } diff --git a/Vocaluxe/PartyModes/IPartyMode.cs b/Vocaluxe/PartyModes/IPartyMode.cs index d9dda2f4..5426a8bf 100644 --- a/Vocaluxe/PartyModes/IPartyMode.cs +++ b/Vocaluxe/PartyModes/IPartyMode.cs @@ -10,11 +10,11 @@ namespace Vocaluxe.PartyModes #region Structs public struct ScreenSongOptions { - public SongSortingOptions SongSorting; - public SongSelectionOptions SongSelection; + public SortingOptions Sorting; + public SelectionOptions Selection; } - public struct SongSortingOptions + public struct SortingOptions { public ESongSorting SongSorting; public EOffOn Tabs; @@ -23,9 +23,10 @@ namespace Vocaluxe.PartyModes public bool SearchStringVisible; } - public struct SongSelectionOptions + public struct SelectionOptions { public bool RandomOnly; + public bool PartyMode; public int NumJokers; public int NumTeams; } diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index 56d703c9..b018626c 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -153,14 +153,14 @@ namespace Vocaluxe.Screens } else { - SongMenus[htSongMenus(SongMenu)].HandleInput(ref KeyEvent); + SongMenus[htSongMenus(SongMenu)].HandleInput(ref KeyEvent, _sso); if (KeyEvent.Handled) return true; switch (KeyEvent.Key) { 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); break; @@ -168,7 +168,12 @@ namespace Vocaluxe.Screens if (CSongs.NumVisibleSongs > 0) { if (SongMenus[htSongMenus(SongMenu)].GetSelectedSong() != -1 && !_SongOptionsActive) - ToggleSongOptions(ESongOptionsView.Song); + { + if (!_sso.Selection.PartyMode) + ToggleSongOptions(ESongOptionsView.Song); + else + HandlePartySongSelection(SongMenus[htSongMenus(SongMenu)].GetSelectedSong()); + } } break; @@ -187,13 +192,15 @@ namespace Vocaluxe.Screens ApplyNewSearchFilter(_SearchText.Remove(_SearchText.Length - 1)); } - if (!_SearchActive && CSongs.Category < 0) + if (!_SearchActive && (CSongs.Category < 0) && !_sso.Selection.PartyMode) + { CGraphics.FadeTo(EScreens.ScreenMain); + } break; case Keys.Space: - if (!_SearchActive) + if (!_SearchActive && !_sso.Selection.PartyMode) ToggleSongOptions(ESongOptionsView.General); break; @@ -204,7 +211,7 @@ namespace Vocaluxe.Screens _SearchText = String.Empty; ApplyNewSearchFilter(_SearchText); } - else + else if (!_sso.Selection.PartyMode) { _SearchActive = true; } @@ -212,11 +219,11 @@ namespace Vocaluxe.Screens //TODO: Delete it! ??? Shouldn't we keep this as shortcut? case Keys.A: - if (!_SearchActive && KeyEvent.Mod == EModifier.None) + if (!_SearchActive && KeyEvent.Mod == EModifier.None && !_sso.Selection.PartyMode) { StartRandomAllSongs(); } - if (KeyEvent.Mod == EModifier.Ctrl) + if (KeyEvent.Mod == EModifier.Ctrl && !_sso.Selection.PartyMode) { StartRandomVisibleSongs(); } @@ -232,7 +239,7 @@ namespace Vocaluxe.Screens _SearchText = String.Empty; ApplyNewSearchFilter(_SearchText); } - else + else if (!_sso.Selection.PartyMode) { _SearchActive = true; } @@ -253,7 +260,7 @@ namespace Vocaluxe.Screens //TODO: Delete that! case Keys.S: - if (!_SearchActive && CSongs.NumVisibleSongs > 0) + if (!_SearchActive && CSongs.NumVisibleSongs > 0 && !_sso.Selection.PartyMode) { StartMedleySong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong()); } @@ -385,7 +392,7 @@ namespace Vocaluxe.Screens return true; } - if (CSongs.Category < 0) + if (CSongs.Category < 0 && !_sso.Selection.PartyMode) { CGraphics.FadeTo(EScreens.ScreenMain); 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) { @@ -418,7 +425,7 @@ namespace Vocaluxe.Screens } } - SongMenus[htSongMenus(SongMenu)].HandleMouse(ref MouseEvent); + SongMenus[htSongMenus(SongMenu)].HandleMouse(ref MouseEvent, _sso); if (MouseEvent.LB) { @@ -494,7 +501,10 @@ namespace Vocaluxe.Screens { 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; } else @@ -504,7 +514,7 @@ namespace Vocaluxe.Screens } } } - + if (MouseEvent.LBH) { if (!DragAndDropActive && Playlists[htPlaylists(Playlist)].Visible && CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1) @@ -533,12 +543,19 @@ namespace Vocaluxe.Screens base.OnShow(); _sso = CParty.GetSongSelectionOptions(); - CSongs.Sort(_sso.SongSorting.SongSorting, _sso.SongSorting.Tabs, _sso.SongSorting.IgnoreArticles, _sso.SongSorting.SearchString); - _SearchActive = _sso.SongSorting.SearchStringVisible; - _SearchText = _sso.SongSorting.SearchString; + CSongs.Sort(_sso.Sorting.SongSorting, _sso.Sorting.Tabs, _sso.Sorting.IgnoreArticles, _sso.Sorting.SearchString); + _SearchActive = _sso.Sorting.SearchStringVisible; + _SearchText = _sso.Sorting.SearchString; CGame.EnterNormalGame(); 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)].SetSmallView(Playlists[htPlaylists(Playlist)].Visible); @@ -619,6 +636,11 @@ namespace Vocaluxe.Screens SongMenus[htSongMenus(SongMenu)].ApplyVolume(CConfig.PreviewMusicVolume); } + private void HandlePartySongSelection(int SongNr) + { + + } + private void StartSong(int SongNr) { if ((CSongs.Category >= 0) && (SongNr >= 0))