private void KeyUp(object source, LaunchpadKeyEventArgs e) { if (!AcceptInput) { return; } int x, y; x = e.GetX(); y = e.GetY(); switch (State) { case GameState.Menu: var menu = KeyInMenuObject(x, y); switch (menu) { case MenuKey.LeftArrow: _lArrowHeld = false; break; case MenuKey.RightArrow: _rArrowHeld = false; break; } break; case GameState.Game: var pad = Pads[GetCoordFromButton(x, y)]; pad.RegisterRelease(); break; } }
private void keyReleasedEvent(object sender, LaunchpadKeyEventArgs e) { if (e.GetY() >= num_colourRows || e.GetX() == 8 || e.GetY() == -1) { // if it's not a colour selection key, release the playback int oscX = e.GetX() + 2; if (oscX == 10) { oscX = 1; // shift the end circle buttons to the front } else { oscX++; // otherwise shift +1 to ignore the soft pallete } int oscY = e.GetY() + 1; osc.Send(new OscMessage($"/exec/{textBox_execPage.Text}/{oscX + oscY * 10}", 0)); lInt.setLED(e.GetX(), e.GetY(), ColourExecRow.colours[0].lowlight); } }
private void keyPressedEvent(object sender, LaunchpadKeyEventArgs e) { if (e.GetY() < num_colourRows && e.GetY() >= 0) { if (e.GetX() < 8) { // this is a coloured exec row, assuming row -1 and column 8 are not part of the selection ColourExecRow.writeLowlightToRow(lInt, ColourExecRow.colours, e.GetY()); // write low_light to entire row } else { // end group selection button } lInt.setLED(e.GetX(), e.GetY(), ColourExecRow.colours[e.GetX()].highlight); } else { lInt.setLED(e.GetX(), e.GetY(), ColourExecRow.colours[0].highlight); // white for non-colour rows } if (e.GetX() == 8) { osc.Send(new OscMessage($"/rpc", "3H")); } int oscX = e.GetX() + 2; if (oscX == 10) { oscX = 1; // shift the end circle buttons to the front } else { oscX++; // otherwise shift +1 to ignore the soft pallete } int oscY = e.GetY() + 1; osc.Send(new OscMessage($"/exec/{textBox_execPage.Text}/{oscX + oscY * 10}", 1)); // updated to increments of 10 }
private void KeyDown(object sender, LaunchpadKeyEventArgs e) { if (!AcceptInput) { return; } int x, y; x = e.GetX(); y = e.GetY(); switch (State) { case GameState.Title: if (KeyInMenuObject(x, y) == MenuKey.Confim) { State = GameState.ReturnToMenu; } break; case GameState.Menu: var menu = KeyInMenuObject(x, y); switch (menu) { case MenuKey.LeftArrow: if (velo == 0) { velo = 127; } else { velo--; } ChangeMenuColour(velo); _lArrowHeld = true; PaintLArrowHeld(); if (MenuState == MenuState.SongSelect && SongSelectActive) { SetPrevSong(); } else if (MenuState == MenuState.DifficultySelect) { DecreaseDifficulty(); } break; case MenuKey.RightArrow: if (velo == 127) { velo = 0; } else { velo++; } ChangeMenuColour(velo); _rArrowHeld = true; PaintRArrowHeld(); if (MenuState == MenuState.SongSelect && SongSelectActive) { SetNextSong(); } else if (MenuState == MenuState.DifficultySelect) { IncreaseDifficulty(); } break; case MenuKey.Confim: if (MenuState == MenuState.SongSelect) { MenuState = MenuState.DifficultySelect; OnMenuStateChange?.Invoke(MenuState, MenuState.SongSelect); SetDefaultDifficulty(); } else if (MenuState == MenuState.DifficultySelect) { State = GameState.Setup; } break; case MenuKey.Cancel: if (MenuState == MenuState.DifficultySelect) { MenuState = MenuState.SongSelect; OnMenuStateChange?.Invoke(MenuState, MenuState.DifficultySelect); } else if (MenuState == MenuState.SongSelect) { State = GameState.ReturnToTitle; } break; } break; case GameState.Game: var pad = Pads[GetCoordFromButton(x, y)]; pad.RegisterHit(); break; case GameState.GameOver: NewHighScore = ResolveHighScore(); if (NewHighScore) { State = GameState.HighScoreEntryHold; } else { SaveCombo(); State = GameState.ReturnToMenuHold; } break; case GameState.HighScoreEntry: var menuKey = KeyInMenuObject(x, y); switch (menuKey) { case MenuKey.LeftArrow: if (String.IsNullOrWhiteSpace(HighScoreName)) { HighScoreName = "Z"; } else { char currChar = HighScoreName[HighScoreName.Length - 1]; HighScoreName = HighScoreName.Remove(HighScoreName.Length - 1); HighScoreName = HighScoreName.Insert(HighScoreName.Length, ((char)(currChar - (char)1)).ToString()); if (HighScoreName.EndsWith("@")) { HighScoreName = HighScoreName.Remove(HighScoreName.Length - 1); HighScoreName = HighScoreName.Insert(HighScoreName.Length, "["); //go to the "END" character } } break; case MenuKey.RightArrow: if (String.IsNullOrWhiteSpace(HighScoreName)) { HighScoreName = "A"; } else { char currChar = HighScoreName[HighScoreName.Length - 1]; HighScoreName = HighScoreName.Remove(HighScoreName.Length - 1); HighScoreName = HighScoreName.Insert(HighScoreName.Length, ((char)(currChar + (char)1)).ToString()); if (HighScoreName.EndsWith("[")) { //this maps to end } else if (HighScoreName.EndsWith("\\")) { HighScoreName = HighScoreName.Remove(HighScoreName.Length - 1); HighScoreName = HighScoreName.Insert(HighScoreName.Length, "A"); //loop } } break; case MenuKey.Confim: if (HighScoreName.EndsWith("[")) { HighScoreName = HighScoreName.Remove(HighScoreName.Length - 1); SaveHighScore(); State = GameState.ReturnToMenuHold; } else { HighScoreName = String.Concat(HighScoreName, "A"); //insert new character. } break; case MenuKey.Cancel: HighScoreName = HighScoreName.Remove(HighScoreName.Length - 1); break; } break; } }