public override bool HandleInput(SKeyEvent keyEvent) { if (keyEvent.KeyPressed) { } else { switch (keyEvent.Key) { case Keys.Escape: case Keys.Back: case Keys.Enter: _LeaveScreen(); break; case Keys.Left: _ChangeRound(-1); break; case Keys.Right: _ChangeRound(1); break; } } return(true); }
public override bool HandleInput(SKeyEvent keyEvent) { _UpdateSlides(); if (keyEvent.ModShift || keyEvent.Sender == ESender.WiiMote) { if (keyEvent.Key == Keys.Add || keyEvent.Key == Keys.PageUp) { _SelectSlides[_SelectSlideVolume].Selection++; } else if (keyEvent.Key == Keys.Subtract || keyEvent.Key == Keys.PageDown) { _SelectSlides[_SelectSlideVolume].Selection--; } else { return(false); } } else { return(false); } _SaveConfig(); return(true); }
private void _Add(bool alt, bool shift, bool ctrl, bool pressed, char unicode, Keys key) { bool keyRepeat = false; if ((_Char == unicode) && _KeyPressed) { keyRepeat = true; } else if (_Keys == key) { keyRepeat = true; } if (!_Timer.IsRunning || (_Timer.ElapsedMilliseconds > 75) || !keyRepeat) { var pool = new SKeyEvent(ESender.Keyboard, alt, shift, ctrl, pressed && (unicode != Char.MinValue), unicode, key); lock (_CopyLock) { try { _KeysPool.Add(pool); } catch (Exception) {} } _Timer.Reset(); _Timer.Start(); } }
public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); switch (keyEvent.Key) { case Keys.Back: case Keys.Escape: Back(); break; case Keys.Enter: if (_Buttons[_ButtonNext].Selected) { Next(); } else if (_Buttons[_ButtonBack].Selected) { Back(); } break; case Keys.Left: case Keys.Right: _GetSelectedOptions(); _UpdateSelectSlideVisibility(); break; } return(true); }
public override bool HandleInput(SKeyEvent keyEvent) { if (keyEvent.KeyPressed && !Char.IsControl(keyEvent.Unicode)) { } else { switch (keyEvent.Key) { case Keys.Escape: case Keys.Back: case Keys.Enter: _LeaveScreen(); break; case Keys.Down: _ChangePos(1); break; case Keys.Up: _ChangePos(-1); break; case Keys.Left: _ChangeRound(-1); break; case Keys.Right: _ChangeRound(1); break; } } return(true); }
public override bool HandleInput(SKeyEvent keyEvent) { if (keyEvent.KeyPressed && !Char.IsControl(keyEvent.Unicode)) { } else { switch (keyEvent.Key) { case Keys.Escape: case Keys.Back: CGraphics.FadeTo(EScreen.Main); break; case Keys.Enter: CGraphics.FadeTo(EScreen.Main); break; case Keys.F: //FadeAndPause(); break; case Keys.S: //PlayFile(); break; case Keys.P: //PauseFile(); break; } } return(true); }
public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); if (keyEvent.KeyPressed) { } else { switch (keyEvent.Key) { case Keys.Escape: case Keys.Back: _SaveConfig(); CGraphics.FadeTo(EScreen.OptionsVideo); break; case Keys.S: CParty.SetNormalGameMode(); _SaveConfig(); CGraphics.FadeTo(EScreen.Song); break; case Keys.Enter: if (_Buttons[_ButtonExit].Selected) { _SaveConfig(); CGraphics.FadeTo(EScreen.OptionsVideo); } break; } } return(true); }
public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); if (keyEvent.KeyPressed) { } else { switch (keyEvent.Key) { case Keys.Escape: case Keys.Back: CGraphics.FadeTo(EScreen.Main); break; case Keys.S: CParty.SetNormalGameMode(); CGraphics.FadeTo(EScreen.Song); break; case Keys.Enter: if (_Buttons[_ButtonOptionsGame].Selected) { CGraphics.FadeTo(EScreen.OptionsGame); } if (_Buttons[_ButtonOptionsSound].Selected) { CGraphics.FadeTo(EScreen.OptionsSound); } if (_Buttons[_ButtonOptionsRecord].Selected) { CGraphics.FadeTo(EScreen.OptionsRecord); } if (_Buttons[_ButtonOptionsVideo].Selected) { CGraphics.FadeTo(EScreen.OptionsVideo); } if (_Buttons[_ButtonOptionsLyrics].Selected) { CGraphics.FadeTo(EScreen.OptionsLyrics); } if (_Buttons[_ButtonOptionsTheme].Selected) { CGraphics.FadeTo(EScreen.OptionsTheme); } break; } } return(true); }
public static bool PollKeyEvent(ref SKeyEvent keyEvent) { if (_KeysPool.Count > 0) { keyEvent = _KeysPool[0]; _KeysPool.RemoveAt(0); return(true); } return(false); }
public bool PollEvent(ref SKeyEvent keyEvent) { if (_ActualPool.Count > 0) { keyEvent = _ActualPool[0]; _Del(0); return(true); } return(false); }
public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); if (keyEvent.KeyPressed && !Char.IsControl(keyEvent.Unicode)) { } else { switch (keyEvent.Key) { case Keys.Escape: case Keys.Back: CGraphics.HidePopup(EPopupScreens.PopupPlayerControl); return(false); case Keys.Enter: if (_Buttons[_ButtonNext].Selected) { CBackgroundMusic.Next(); } if (_Buttons[_ButtonPrevious].Selected) { CBackgroundMusic.Previous(); } if (_Buttons[_ButtonPlay].Selected) { CBackgroundMusic.Play(); } if (_Buttons[_ButtonPause].Selected) { CBackgroundMusic.Pause(); } if (_Buttons[_ButtonRepeat].Selected) { CBackgroundMusic.RepeatSong = !CBackgroundMusic.RepeatSong; } if (_Buttons[_ButtonShowVideo].Selected) { _VideoPreview = !_VideoPreview; } if (_Buttons[_ButtonSing].Selected) { _StartSong(CBackgroundMusic.SongID); } if (_Buttons[_ButtonToBackgroundVideo].Selected) { _VideoBackground = !_VideoBackground; } break; } } return(true); }
public override bool HandleInput(SKeyEvent keyEvent) { switch (keyEvent.Key) { case Keys.Escape: case Keys.Back: CGraphics.HidePopup(EPopupScreens.PopupServerQR); return(true); } return(base.HandleInput(keyEvent)); }
public void AddKeyEvent(SKeyEvent keyEvent) { if (!_Initialized) { return; } lock (_KeysPool) { _KeysPool.Add(keyEvent); } }
public virtual bool PollKeyEvent(ref SKeyEvent keyEvent) { if (!_Initialized) { return(false); } if (_CurrentKeysPool.Count > 0) { keyEvent = _CurrentKeysPool[0]; _CurrentKeysPool.RemoveAt(0); return(true); } return(false); }
public override bool HandleInput(SKeyEvent keyEvent) { if (!keyEvent.KeyPressed || Char.IsControl(keyEvent.Unicode)) { switch (keyEvent.Key) { case Keys.Escape: case Keys.Back: case Keys.Enter: CGraphics.FadeTo(EScreen.Main); break; } } return(true); }
// ReSharper restore MemberCanBeProtected.Global // ReSharper restore UnusedMember.Global #endregion Create Elements public override bool HandleInputThemeEditor(SKeyEvent keyEvent) { if (!keyEvent.KeyPressed) { switch (keyEvent.Key) { case Keys.S: CBase.Graphics.SaveTheme(); return(true); case Keys.R: _ReloadThemeEditMode(); return(true); } } return(base.HandleInputThemeEditor(keyEvent)); }
/// <summary> /// Selects the next best element in a menu. /// </summary> /// <param name="key"></param> /// <returns></returns> private bool _NextElement(SKeyEvent key) { int element; switch (key.Key) { case Keys.Up: element = _GetNextElement(EDirection.Up); break; case Keys.Right: element = _GetNextElement(EDirection.Right); break; case Keys.Down: element = _GetNextElement(EDirection.Down); break; case Keys.Left: element = _GetNextElement(EDirection.Left); break; case Keys.Tab: if (key.Mod == EModifier.Shift) { PrevElement(); } else { NextElement(); } return(true); default: return(false); } if (element < 0) { return(false); } // select the new element _SetSelected(element); return(true); }
public static void Update() { foreach (IController controller in _Controller) { controller.Update(); var ke = new SKeyEvent(); while (controller.PollKeyEvent(ref ke)) { _KeysPool.Add(ke); } var me = new SMouseEvent(); while (controller.PollMouseEvent(ref me)) { _MousePool.Add(me); } } }
public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); if (!keyEvent.KeyPressed) { switch (keyEvent.Key) { case Keys.Escape: case Keys.Back: _SaveConfig(); CGraphics.FadeTo(EScreen.Options); break; case Keys.S: CParty.SetNormalGameMode(); _SaveConfig(); CGraphics.FadeTo(EScreen.Song); break; case Keys.Enter: if (_Buttons[_ButtonExit].Selected) { _SaveConfig(); CGraphics.FadeTo(EScreen.Options); } else if (_Buttons[_ButtonServer].Selected) { CGraphics.ShowPopup(EPopupScreens.PopupServerQR); } break; case Keys.Left: _SaveConfig(); break; case Keys.Right: _SaveConfig(); break; } } return(true); }
public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); if (keyEvent.KeyPressed) { } else { switch (keyEvent.Key) { case Keys.Back: case Keys.Escape: _PartyMode.Back(); break; case Keys.Enter: _UpdateSlides(); if (_Buttons[_ButtonBack].Selected) { _PartyMode.Back(); } if (_Buttons[_ButtonNext].Selected) { _PartyMode.Next(); } break; case Keys.Left: _UpdateSlides(); break; case Keys.Right: _UpdateSlides(); break; } } return(true); }
public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); if (keyEvent.KeyPressed) { } else { switch (keyEvent.Key) { case Keys.Enter: case Keys.Escape: case Keys.Space: case Keys.Back: _SkipIntro = true; break; } } return(true); }
private static bool _HandleInputThemeEditor(CKeys keys, CMouse mouse) { SKeyEvent keyEvent = new SKeyEvent(); SMouseEvent mouseEvent = new SMouseEvent(); while (keys.PollEvent(ref keyEvent)) { if (keyEvent.ModShift && (keyEvent.Key == Keys.F1)) { CSettings.ProgramState = EProgramState.Normal; CurrentScreen.NextElement(); } else if (keyEvent.ModAlt && (keyEvent.Key == Keys.Enter)) { CConfig.Config.Graphics.FullScreen = (CConfig.Config.Graphics.FullScreen == EOffOn.TR_CONFIG_ON) ? EOffOn.TR_CONFIG_OFF : EOffOn.TR_CONFIG_ON; } else if (keyEvent.ModAlt && (keyEvent.Key == Keys.P)) { CDraw.MakeScreenShot(); } else { if (_Fading == null) { CurrentScreen.HandleInputThemeEditor(keyEvent); } } } while (mouse.PollEvent(ref mouseEvent)) { if (_Fading == null) { CurrentScreen.HandleMouseThemeEditor(mouseEvent); } _UpdateMousePosition(mouseEvent.X, mouseEvent.Y); } return(true); }
public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); if (keyEvent.KeyPressed) { } else { switch (keyEvent.Key) { case Keys.Back: case Keys.Escape: CGraphics.FadeTo(EScreen.Main); break; case Keys.Enter: if (_Buttons[_ButtonStart].Selected) { _StartPartyMode(); } if (_Buttons[_ButtonExit].Selected) { CGraphics.FadeTo(EScreen.Main); } break; case Keys.Left: case Keys.Right: if (_SelectSlides[_SelectSlideModes].Selected) { _UpdateSelection(); } break; } } return(true); }
public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); if (keyEvent.KeyPressed) { } else { switch (keyEvent.Key) { case Keys.Escape: case Keys.Back: _SaveConfig(); CGraphics.FadeTo(EScreen.Options); break; case Keys.S: CParty.SetNormalGameMode(); _SaveConfig(); CGraphics.FadeTo(EScreen.Song); break; case Keys.Enter: if (_Buttons[_ButtonExit].Selected) { _SaveConfig(); CGraphics.FadeTo(EScreen.Options); } else if (_Buttons[_ButtonScreenAdjustments].Selected) { _SaveConfig(); CGraphics.FadeTo(EScreen.OptionsVideoAdjustments); } break; case Keys.Left: if (_SelectSlides[_SelectSlideWebcamDevices].Selected) { _OnDeviceEvent(); } if (_SelectSlides[_SelectSlideWebcamCapabilities].Selected) { _OnCapabilitiesEvent(); } _SaveConfig(); break; case Keys.Right: if (_SelectSlides[_SelectSlideWebcamDevices].Selected) { _OnDeviceEvent(); } if (_SelectSlides[_SelectSlideWebcamCapabilities].Selected) { _OnCapabilitiesEvent(); } _SaveConfig(); break; } } return(true); }
public override bool HandleInput(SKeyEvent keyEvent) { if ((keyEvent.Key == Keys.Up || keyEvent.Key == Keys.Down) && _EditMode == EEditMode.PlayerName) { _EditMode = EEditMode.None; } if (_EditMode == EEditMode.None) { base.HandleInput(keyEvent); } if (keyEvent.KeyPressed && !Char.IsControl(keyEvent.Unicode)) { switch (_EditMode) { case EEditMode.None: break; case EEditMode.PlayerName: CProfiles.AddGetPlayerName(_NewProfileID, keyEvent.Unicode); _ProfilesChanged = true; break; } } else { switch (keyEvent.Key) { case Keys.Escape: _DeleteProfile(); _ClosePopup(); break; case Keys.Enter: if (_Buttons[_ButtonCancel].Selected) { _DeleteProfile(); _ClosePopup(); } else if (_Buttons[_ButtonSave].Selected) { _SaveProfiles(); _ClosePopup(); } /*else if (_Buttons[_ButtonNew].Selected) * _NewProfile();*/ else if (_Buttons[_ButtonPlayerName].Selected) { if (CProfiles.NumProfiles > 0 && _EditMode != EEditMode.PlayerName) { _EditMode = EEditMode.PlayerName; } else { _EditMode = EEditMode.None; } } /*else if (_Buttons[_ButtonDelete].Selected) * _DeleteProfile();*/ break; case Keys.Back: if (_EditMode == EEditMode.PlayerName) { CProfiles.GetDeleteCharInPlayerName(_NewProfileID); _ProfilesChanged = true; } else { _ClosePopup(); } break; case Keys.Delete: _DeleteProfile(); break; } if (_SelectSlides[_SelectSlideDifficulty].Selected) { CProfiles.SetDifficulty(_NewProfileID, (EGameDifficulty)_SelectSlides[_SelectSlideDifficulty].Selection); } else if (_SelectSlides[_SelectSlideAvatars].Selected) { CProfiles.SetAvatar(_NewProfileID, _SelectSlides[_SelectSlideAvatars].SelectedTag); } /*else if (_SelectSlides[_SelectSlideUserRole].Selected) * { * CProfiles.SetUserRoleProfile(_NewProfileID, * (EUserRole)_SelectSlides[_SelectSlideUserRole].Selection); * } * else if (_SelectSlides[_SelectSlideActive].Selected) * { * CProfiles.SetActive(_NewProfileID, * (EOffOn)_SelectSlides[_SelectSlideActive].Selection); * }*/ } return(true); }
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 virtual bool HandleInputThemeEditor(SKeyEvent keyEvent) { int dx = 0; int dy = 0; if (!keyEvent.KeyPressed) { switch (keyEvent.Key) { case Keys.Up: dy = -1; break; case Keys.Down: dy = 1; break; case Keys.Right: dx = 1; break; case Keys.Left: dx = -1; break; case Keys.Tab: _NextElement(keyEvent); return(true); default: return(false); } } else { return(false); } if ((keyEvent.Mod & EModifier.Ctrl) != EModifier.Ctrl) { dx *= 5; dy *= 5; } if ((keyEvent.Mod & EModifier.Alt) == EModifier.Alt) { _MoveElement(dx, dy); } else if ((keyEvent.Mod & EModifier.Shift) == EModifier.Shift) { _ResizeElement(dx, dy); } else { if (_IsSelectionValid()) { _GetElement(_Selection).Highlighted = false; } if (_NextElement(keyEvent)) { _GetElement(_Selection).Highlighted = true; } } return(true); }
public virtual bool HandleInput(SKeyEvent keyEvent) { if (!CBase.Settings.IsTabNavigation()) { if (keyEvent.Key == Keys.Left) { if (_IsSelectionValid() && _Elements[_Selection].Type == EType.SelectSlide && keyEvent.Mod != EModifier.Shift) { keyEvent.Handled = PrevValue(); } else { keyEvent.Handled = _NextElement(keyEvent); } return(true); } else if (keyEvent.Key == Keys.Right) { if (_IsSelectionValid() && _Elements[_Selection].Type == EType.SelectSlide && keyEvent.Mod != EModifier.Shift) { keyEvent.Handled = NextValue(); } else { keyEvent.Handled = _NextElement(keyEvent); } return(true); } else if (keyEvent.Key == Keys.Up || keyEvent.Key == Keys.Down) { keyEvent.Handled = _NextElement(keyEvent); return(true); } } else { if (keyEvent.Key == Keys.Tab) { if (keyEvent.Mod == EModifier.Shift) { PrevElement(); } else { NextElement(); } return(true); } if (keyEvent.Key == Keys.Left) { PrevValue(); return(true); } else if (keyEvent.Key == Keys.Right) { NextValue(); return(true); } } return(false); }
public override bool HandleInput(SKeyEvent keyEvent) { switch (keyEvent.Key) { case Keys.Add: if (CConfig.Config.Game.NumPlayers + 1 <= CSettings.MaxNumPlayer) { _SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.Config.Game.NumPlayers; _UpdatePlayerNumber(); //Update Tiles-List _NameSelections[_NameSelection].UpdateList(); } break; case Keys.Subtract: if (CConfig.Config.Game.NumPlayers - 1 > 0) { _SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.Config.Game.NumPlayers - 2; _UpdatePlayerNumber(); //Update Tiles-List _NameSelections[_NameSelection].UpdateList(); } break; case Keys.P: if (!_SelectingKeyboardActive) { _SelectingFastPlayerNr = 1; _SelectingFast = true; _ResetPlayerSelections(); } else { if (_SelectingFastPlayerNr + 1 <= CGame.NumPlayers) { _SelectingFastPlayerNr++; } else { _SelectingFastPlayerNr = 1; } _NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr); } break; case Keys.N: CGraphics.ShowPopup(EPopupScreens.PopupNewPlayer); break; } //Check if selecting with keyboard is active if (_SelectingKeyboardActive) { //Handle left/right/up/down _NameSelections[_NameSelection].HandleInput(keyEvent); int numberPressed = -1; bool resetSelection = false; switch (keyEvent.Key) { case Keys.Enter: //Check, if a player is selected if (_NameSelections[_NameSelection].SelectedID != Guid.Empty) { _SelectedProfileID = _NameSelections[_NameSelection].SelectedID; if (!CProfiles.IsProfileIDValid(_SelectedProfileID)) { return(true); } _UpdateSelectedProfile(_SelectingFastPlayerNr - 1, _SelectedProfileID); } //Started selecting with 'P' if (_SelectingFast) { if (_SelectingFastPlayerNr == CGame.NumPlayers) { resetSelection = true; _SelectElement(_Buttons[_ButtonStart]); } else { _SelectingFastPlayerNr++; _NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr); } } else { resetSelection = true; } break; case Keys.D1: case Keys.NumPad1: numberPressed = 1; break; case Keys.D2: case Keys.NumPad2: numberPressed = 2; break; case Keys.D3: case Keys.NumPad3: numberPressed = 3; break; case Keys.D4: case Keys.NumPad4: numberPressed = 4; break; case Keys.D5: case Keys.NumPad5: numberPressed = 5; break; case Keys.D6: case Keys.NumPad6: numberPressed = 6; break; case Keys.Escape: resetSelection = true; _SelectElement(_SelectSlides[_SelectSlidePlayerNumber]); break; case Keys.Delete: //Delete profile-selection _ResetPlayerSelection(_SelectingFastPlayerNr - 1); //Reset all values _SelectingFastPlayerNr = 0; _SelectingKeyboardActive = false; _NameSelections[_NameSelection].FastSelection(false, -1); //Update Tiles-List _NameSelections[_NameSelection].UpdateList(); break; case Keys.F10: if (CGame.GetNumSongs() == 1 && CGame.GetSong(0).IsDuet) { CSelectSlide selectSlideDuetPart = _SelectSlides[_PlayerSelectSlideDuet[_SelectingFastPlayerNr - 1]]; selectSlideDuetPart.Selection = (selectSlideDuetPart.Selection + 1) % 2; //Reset all values _SelectingFastPlayerNr = 0; _SelectingKeyboardActive = false; _SelectingFast = false; _NameSelections[_NameSelection].FastSelection(false, -1); _SelectElement(_Buttons[_ButtonStart]); } break; } if (numberPressed > 0 || resetSelection) { if (numberPressed == _SelectingFastPlayerNr || resetSelection) { //Reset all values _SelectingFastPlayerNr = 0; _SelectingKeyboardActive = false; _SelectElement(_SelectSlides[_SelectSlidePlayerNumber]); _NameSelections[_NameSelection].FastSelection(false, -1); } else if (numberPressed <= CConfig.Config.Game.NumPlayers) { _SelectingFastPlayerNr = numberPressed; _NameSelections[_NameSelection].FastSelection(true, numberPressed); } _SelectingFast = false; if (_PreviousPlayerSelection > -1) { _SelectElement(_Buttons[_PlayerButton[_PreviousPlayerSelection]]); _PreviousPlayerSelection = -1; } } } //Normal Keyboard handling else { base.HandleInput(keyEvent); switch (keyEvent.Key) { case Keys.Escape: case Keys.Back: CGraphics.FadeTo(EScreen.Song); break; case Keys.Enter: if (_Buttons[_ButtonBack].Selected) { CGraphics.FadeTo(EScreen.Song); } else if (_Buttons[_ButtonStart].Selected) { _StartSong(); } else if (_Buttons[_ButtonNewProfile].Selected) { CGraphics.ShowPopup(EPopupScreens.PopupNewPlayer); } for (int p = 0; p < CGame.NumPlayers; p++) { if (_Buttons[_PlayerButton[p]].Selected) { _PreviousPlayerSelection = p; _SelectingFastPlayerNr = p + 1; } } break; case Keys.D1: case Keys.NumPad1: _SelectingFastPlayerNr = 1; break; case Keys.D2: case Keys.NumPad2: _SelectingFastPlayerNr = 2; break; case Keys.D3: case Keys.NumPad3: _SelectingFastPlayerNr = 3; break; case Keys.D4: case Keys.NumPad4: _SelectingFastPlayerNr = 4; break; case Keys.D5: case Keys.NumPad5: _SelectingFastPlayerNr = 5; break; case Keys.D6: case Keys.NumPad6: _SelectingFastPlayerNr = 6; break; default: _UpdatePlayerNumber(); break; } if (_SelectingFastPlayerNr > 0 && _SelectingFastPlayerNr <= CConfig.Config.Game.NumPlayers) { _SelectingKeyboardActive = true; _NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr); } if (_NameSelections[_NameSelection].Selected && !_SelectingKeyboardActive) { _SelectingKeyboardActive = true; _SelectingFast = true; _SelectingFastPlayerNr = 1; _SelectingKeyboardActive = true; _NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr); } } return(true); }
public void HandleInput(SKeyEvent kevent) { switch (kevent.Key) { case Keys.Right: if (_ActualSelection + 1 < _Tiles.Count) { if (_Tiles[_ActualSelection + 1].ProfileID != -1) { _ActualSelection++; } } else { int offset = Offset; UpdateList(Offset + 1); if (offset != Offset) { _ActualSelection = 0; } } break; case Keys.Left: if (_ActualSelection - 1 > -1) { _ActualSelection--; } else if (Offset > 0) { UpdateList(Offset - 1); _ActualSelection = _Tiles.Count - 1; } break; case Keys.Up: if (_ActualSelection - _Theme.Tiles.NumW > -1) { _ActualSelection -= _Theme.Tiles.NumW; } else if (Offset > 0) { UpdateList(Offset - 1); _ActualSelection += _Tiles.Count - _Theme.Tiles.NumW; } break; case Keys.Down: if (_ActualSelection + _Theme.Tiles.NumW < _Tiles.Count) { if (_Tiles[_ActualSelection + _Theme.Tiles.NumW].ProfileID != -1) { _ActualSelection += _Theme.Tiles.NumW; } } else { int offset = Offset; UpdateList(Offset + 1); if (offset != Offset) { _ActualSelection = _ActualSelection - _Tiles.Count + _Theme.Tiles.NumW; if (_Tiles[_ActualSelection].ProfileID == -1) { for (int i = _Tiles.Count - 1; i >= 0; i--) { if (_Tiles[i].ProfileID != -1) { _ActualSelection = i; break; } } } } } break; } if (Offset * _Tiles.Count + _ActualSelection < _VisibleProfiles.Count) { Selection = _VisibleProfiles[Offset * _Tiles.Count + _ActualSelection]; } else { Selection = -1; } }