// ReSharper disable RedundantAssignment public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) // ReSharper restore RedundantAssignment { if (GameData.CatSongIndices != null && categoryIndex != -1) { if (GameData.CatSongIndices[categoryIndex] == -1) { _ScreenSongOptions.Selection.SelectNextRandomSong = true; } else { _ScreenSongOptions.Selection.SongIndex = GameData.CatSongIndices[categoryIndex]; } } if (GameData.CatSongIndices == null && categoryIndex != -1) { _ScreenSongOptions.Selection.SelectNextRandomSong = true; } if (categoryIndex == -1) { _ScreenSongOptions.Selection.RandomOnly = false; } if (_ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF || categoryIndex != -1) { _ScreenSongOptions.Selection.RandomOnly = true; } screenSongOptions = _ScreenSongOptions; }
public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) { if (_ScreenSongOptions.Selection.SelectNextRandomSong && songIndex != -1) { _ScreenSongOptions.Selection.SelectNextRandomSong = false; } _ScreenSongOptions.Selection.SongIndex = songIndex; screenSongOptions = _ScreenSongOptions; }
public override void Update(SScreenSongOptions songOptions) { if (songOptions.Selection.RandomOnly) { _PreviewSelectedSong(); } if (_Length < 0 && CBase.Songs.IsInCategory() && CBase.BackgroundMusic.GetLength() > 0) { _UpdateLength(CBase.Songs.GetVisibleSong(_PreviewNr)); } }
public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) { if (categoryIndex != -1 || CBase.Config.GetTabs() == EOffOn.TR_CONFIG_OFF) { //If category is selected or tabs off: only random song selection _ScreenSongOptions.Selection.SelectNextRandomSong = true; _ScreenSongOptions.Selection.RandomOnly = true; } else { //If no category is selected: let user choose category _ScreenSongOptions.Selection.SongIndex = -1; _ScreenSongOptions.Selection.RandomOnly = false; } _ScreenSongOptions.Selection.CategoryIndex = categoryIndex; screenSongOptions = _ScreenSongOptions; }
// ReSharper disable RedundantAssignment public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) // ReSharper restore RedundantAssignment { _ScreenSongOptions.Selection.SongIndex = -1; if (_ScreenSongOptions.Selection.SelectNextRandomSong && songIndex != -1) { _ScreenSongOptions.Selection.SelectNextRandomSong = false; _CreateCatSongIndices(); if (GameData.CatSongIndices != null) { if (GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] == -1) { GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] = songIndex; } } } screenSongOptions = _ScreenSongOptions; }
public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) { throw new ArgumentException("Not required!"); }
public static void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) { _CurrentPartyMode.OnCategoryChange(categoryIndex, ref screenSongOptions); }
public static void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) { _CurrentPartyMode.OnSongChange(songIndex, ref screenSongOptions); }
public override bool HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions) { if (!songOptions.Selection.RandomOnly || (!CBase.Songs.IsInCategory() && songOptions.Selection.CategoryChangeAllowed)) { if (mouseEvent.Wheel != 0 && CHelper.IsInBounds(_ScrollRect, mouseEvent)) { _UpdateList(_Offset + _NumW * mouseEvent.Wheel); } int lastSelection = _SelectionNr; int i = 0; bool somethingSelected = false; foreach (CStatic tile in _Tiles) { if (tile.Texture != _CoverBGTexture && CHelper.IsInBounds(tile.Rect, mouseEvent)) { somethingSelected = true; _SelectionNr = i + _Offset; if (!CBase.Songs.IsInCategory()) { _PreviewNr = i + _Offset; } break; } i++; } //Reset selection only if we moved out of the rect to avoid loosing it when selecting random songs if (_MouseWasInRect && !somethingSelected) { _SelectionNr = -1; } if (mouseEvent.Sender == ESender.WiiMote && _SelectionNr != lastSelection && _SelectionNr != -1) { CBase.Controller.SetRumble(0.050f); } } _MouseWasInRect = CHelper.IsInBounds(Rect, mouseEvent); if (mouseEvent.RB) { if (CBase.Songs.IsInCategory() && CBase.Songs.GetNumCategories() > 0 && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && songOptions.Selection.CategoryChangeAllowed) { _LeaveCategory(); return(true); } if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !songOptions.Selection.PartyMode) { CBase.Graphics.FadeTo(EScreen.Main); return(true); } } else if (mouseEvent.LB) { if (_SelectionNr >= 0 && _MouseWasInRect) { if (CBase.Songs.IsInCategory()) { if (_PreviewNr == _SelectionNr) { return(false); } _PreviewSelectedSong(); } else { EnterSelectedCategory(); } return(true); } } return(false); }
public override bool HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions options) { if (keyEvent.KeyPressed) { return(false); } bool moveAllowed = !options.Selection.RandomOnly || (options.Selection.CategoryChangeAllowed && !CBase.Songs.IsInCategory()); bool catChangePossible = CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && options.Selection.CategoryChangeAllowed; //If nothing selected set a reasonable default value if (keyEvent.IsArrowKey() && moveAllowed && _SelectionNr < 0) { _SelectionNr = (_PreviewNr < 0) ? _Offset : _PreviewNr; } switch (keyEvent.Key) { case Keys.Enter: if (CBase.Songs.IsInCategory()) { if (_SelectionNr >= 0 && _PreviewNr != _SelectionNr) { _PreviewSelectedSong(); keyEvent.Handled = true; } } else { _EnterCategory(_PreviewNr); keyEvent.Handled = true; } break; case Keys.Escape: case Keys.Back: if (CBase.Songs.IsInCategory() && catChangePossible) { _LeaveCategory(); keyEvent.Handled = true; } break; case Keys.PageUp: if (catChangePossible && CBase.Songs.IsInCategory() && (keyEvent.Mod == EModifier.Ctrl || keyEvent.Mod == EModifier.Alt)) { _PrevCategory(); keyEvent.Handled = true; } else if (moveAllowed) { int numSongsPerPage = _NumH * _NumW; if ((_SelectionNr - numSongsPerPage) <= 0) { _SelectionNr = 0; } else { _SelectionNr = _SelectionNr - numSongsPerPage; } keyEvent.Handled = true; } break; case Keys.PageDown: if (catChangePossible && CBase.Songs.IsInCategory() && (keyEvent.Mod == EModifier.Ctrl || keyEvent.Mod == EModifier.Alt)) { _NextCategory(); keyEvent.Handled = true; } else if (moveAllowed) { int numSongsPerPage = _NumH * _NumW; int maxCount_PageDown = (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && !CBase.Songs.IsInCategory() ? CBase.Songs.GetNumCategories() : CBase.Songs.GetNumSongsVisible()); if ((_SelectionNr + numSongsPerPage) >= maxCount_PageDown) { _SelectionNr = maxCount_PageDown - 1; } else { _SelectionNr = _SelectionNr + numSongsPerPage; } keyEvent.Handled = true; } break; case Keys.Home: if (moveAllowed) { _SelectionNr = 0; keyEvent.Handled = true; } break; case Keys.End: int maxCount_End = (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && !CBase.Songs.IsInCategory() ? CBase.Songs.GetNumCategories() : CBase.Songs.GetNumSongsVisible()); if (moveAllowed) { _SelectionNr = maxCount_End - 1; keyEvent.Handled = true; } break; case Keys.Left: //Check for >0 so we do not allow selection of nothing (-1) if (_SelectionNr > 0 && moveAllowed) { _SelectionNr--; _AutoplayPreviewIfEnabled(); keyEvent.Handled = true; } break; case Keys.Right: if (moveAllowed) { _SelectionNr++; _AutoplayPreviewIfEnabled(); keyEvent.Handled = true; } break; case Keys.Up: if (keyEvent.ModShift) { if (catChangePossible) { _PrevCategory(); keyEvent.Handled = true; } } else if (_SelectionNr >= _NumW && moveAllowed) { _SelectionNr -= _NumW; _AutoplayPreviewIfEnabled(); keyEvent.Handled = true; } break; case Keys.Down: if (keyEvent.ModShift) { if (catChangePossible) { _NextCategory(); keyEvent.Handled = true; } } else if (moveAllowed) { _SelectionNr += _NumW; _AutoplayPreviewIfEnabled(); keyEvent.Handled = true; } break; } if (!CBase.Songs.IsInCategory()) { _PreviewSelectedSong(); } return(keyEvent.Handled); }
public override bool HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions options) { if (keyEvent.KeyPressed) { return(false); } bool moveAllowed = !options.Selection.RandomOnly || (options.Selection.CategoryChangeAllowed && !CBase.Songs.IsInCategory()); bool catChangePossible = CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && options.Selection.CategoryChangeAllowed; //If nothing selected set a reasonable default value if (keyEvent.IsArrowKey() && moveAllowed && _SelectionNr < 0) { _SelectionNr = (_PreviewNr < 0) ? _Offset : _PreviewNr; } switch (keyEvent.Key) { case Keys.Enter: if (CBase.Songs.IsInCategory()) { if (_SelectionNr >= 0 && _PreviewNr != _SelectionNr) { _PreviewNr = _SelectionNr; keyEvent.Handled = true; } } else { _EnterCategory(_PreviewNr); keyEvent.Handled = true; } break; case Keys.Escape: case Keys.Back: if (CBase.Songs.IsInCategory() && catChangePossible) { _LeaveCategory(); keyEvent.Handled = true; } break; case Keys.PageUp: if (catChangePossible) { _PrevCategory(); keyEvent.Handled = true; } break; case Keys.PageDown: if (catChangePossible) { _NextCategory(); keyEvent.Handled = true; } break; case Keys.Left: //Check for >0 so we do not allow selection of nothing (-1) if (_SelectionNr > 0 && moveAllowed) { _SelectionNr--; keyEvent.Handled = true; } break; case Keys.Right: if (moveAllowed) { _SelectionNr++; keyEvent.Handled = true; } break; case Keys.Up: if (keyEvent.ModShift) { if (catChangePossible) { _PrevCategory(); keyEvent.Handled = true; } } else if (_SelectionNr >= _NumW && moveAllowed) { _SelectionNr -= _NumW; keyEvent.Handled = true; } break; case Keys.Down: if (keyEvent.ModShift) { if (catChangePossible) { _NextCategory(); keyEvent.Handled = true; } } else if (moveAllowed) { _SelectionNr += _NumW; keyEvent.Handled = true; } break; } if (!CBase.Songs.IsInCategory()) { _PreviewNr = _SelectionNr; } return(keyEvent.Handled); }
public abstract bool HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions);
public abstract bool HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions options);
public abstract void Update(SScreenSongOptions songOptions);
public override bool HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions) { if (!songOptions.Selection.RandomOnly || (!CBase.Songs.IsInCategory() && songOptions.Selection.CategoryChangeAllowed)) { if (mouseEvent.Wheel != 0 && CHelper.IsInBounds(_ScrollRect, mouseEvent)) { _UpdateList(_Offset + mouseEvent.Wheel); _UpdateTileSelection(); } int lastSelection = _SelectionNr; } _MouseWasInRect = CHelper.IsInBounds(Rect, mouseEvent); if (mouseEvent.LB && !_DragTimer.IsRunning && (CHelper.IsInBounds(_ScrollRect, mouseEvent) || CHelper.IsInBounds(_ScrollBar.Rect, mouseEvent))) { _DragTimer.Start(); _OldMouseY = mouseEvent.Y; _DragActive = true; return(true); } else if (mouseEvent.RB) { if (CBase.Songs.IsInCategory() && CBase.Songs.GetNumCategories() > 0 && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && songOptions.Selection.CategoryChangeAllowed) { _LeaveCategory(); return(true); } if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !songOptions.Selection.PartyMode) { CBase.Graphics.FadeTo(EScreen.Main); return(true); } } if (mouseEvent.LBH && _DragActive && CHelper.IsInBounds(_ScrollBar.Rect, mouseEvent)) { float ebarpos = mouseEvent.Y - _ScrollBar.Y - (_ScrollBarPointer.H / 2); float offset = ((ebarpos / (_ScrollBar.H - _ScrollBarPointer.H)) * (CBase.Songs.GetNumSongsVisible() - _ListLength)); _UpdateList((int)offset); _UpdateTileSelection(); } else if (mouseEvent.LBH && _DragActive && CHelper.IsInBounds(_ScrollRect, mouseEvent)) { _ListDragDiffY = _OldListDragDiffY + _OldMouseY - mouseEvent.Y; while (_ListDragDiffY > _Tile.H / 2) { _UpdateList(_Offset + 1); _UpdateTileSelection(); _ListDragDiffY -= _Tile.H; _OldMouseY -= (int)_Tile.H; } while (_ListDragDiffY < -_Tile.H / 2) { _UpdateList(_Offset - 1); _UpdateTileSelection(); _ListDragDiffY += _Tile.H; _OldMouseY += (int)_Tile.H; } return(true); } else if (_DragActive && _DragTimer.ElapsedMilliseconds >= 300) { if (_DragTimer.IsRunning) { _DragTimer.Reset(); } //_ListDragDiffY = 0; _OldListDragDiffY = _ListDragDiffY; _DragActive = false; return(true); } else if (_DragActive && _ListDragDiffY - _OldListDragDiffY < 25 && _DragTimer.ElapsedMilliseconds < 200 && CHelper.IsInBounds(_ScrollRect, mouseEvent)) { if (_DragTimer.IsRunning) { _DragTimer.Reset(); } //_ListDragDiffY = 0; _OldListDragDiffY = _ListDragDiffY; _DragActive = false; int i = 0; foreach (CStatic tile in _Tiles) { //create a rect including the cover and text of the song. //(this way mouse over text should make a selection as well) SRectF songRect = new SRectF(tile.Rect.X, tile.Rect.Y, Rect.W, tile.Rect.H, tile.Rect.Z); if (tile.Visible && CHelper.IsInBounds(songRect, mouseEvent)) { _SelectionNr = i - _LAdj + _Offset; if (!CBase.Songs.IsInCategory()) { _PreviewNr = i - _LAdj + _Offset; } if (_SelectionNr >= _Offset + _Tiles.Count - 2 * _LAdj - 1 || _SelectionNr <= _Offset) { _OldListDragDiffY = _ListDragDiffY = 0; } break; } i++; } if (_SelectionNr >= 0 && _MouseWasInRect) { if (CBase.Songs.IsInCategory()) { if (_PreviewNr != _SelectionNr) { _PreviewNr = _SelectionNr; return(true); } else { return(false); } } else { EnterSelectedCategory(); return(true); } } } else { if (_DragTimer.IsRunning) { _DragTimer.Reset(); } //_ListDragDiffY = 0; _OldListDragDiffY = _ListDragDiffY; _DragActive = false; return(true); } return(false); }