void FillNotesKeyboardControlsBurstMode(LaneInfo laneInfo) { int keysPressed = 0; int laneCount = laneInfo.laneCount; bool isTyping = Services.IsTyping; if (isTyping) { return; } for (int i = 0; i < laneCount + 1; ++i) { int index = i; bool isOpenInput = index >= laneCount; if (isOpenInput && keysPressed > 0) // Prevents open notes while holding other keys { continue; } int inputOnKeyboard = index + 1; if (Input.GetKey(NumToStringLUT[inputOnKeyboard]) && !inputBlock[index]) { ++keysPressed; int notePos = index; if (isOpenInput) { notePos = allPlaceableNotes.IndexOf(openNote); } LeftyFlipReflectionCheck(ref notePos, laneCount); allPlaceableNotes[notePos].ExplicitUpdate(); int pos = SongObjectHelper.FindObjectPosition(allPlaceableNotes[notePos].note, editor.currentChart.notes); if (currentPlacementMode == KeysPlacementMode.None) { currentPlacementMode = pos == SongObjectHelper.NOTFOUND ? KeysPlacementMode.Adding : KeysPlacementMode.Deleting; } if (currentPlacementMode == KeysPlacementMode.Adding && pos == SongObjectHelper.NOTFOUND) { Debug.Log("Adding note"); currentlyAddingNotes.Add(allPlaceableNotes[notePos].note.Clone()); } else if (Input.GetKeyDown(NumToStringLUT[inputOnKeyboard]) && currentPlacementMode == KeysPlacementMode.Deleting) { Debug.Log("Removed " + editor.currentChart.notes[pos].rawNote + " note at position " + editor.currentChart.notes[pos].tick + " using keyboard controls"); currentlyAddingNotes.Add(editor.currentChart.notes[pos]); inputBlock[index] = true; } } else if (!Input.GetKey(NumToStringLUT[(index + 1)])) { inputBlock[index] = false; } } }
void KeysControlsInit() { currentPlacementMode = KeysPlacementMode.None; // Make sure the notes have been initialised foreach (PlaceNote placeableNotes in allPlaceableNotes) { placeableNotes.gameObject.SetActive(true); placeableNotes.gameObject.SetActive(false); } }
void ResetNoteAdding() { currentlyAddingNotes.Clear(); currentPlacementMode = KeysPlacementMode.None; keyControlsCommands.Clear(); }
void FillNotesKeyboardControlsSustainMode(LaneInfo laneInfo) { int laneCount = laneInfo.laneCount; bool isTyping = Services.IsTyping; // Tell the system to stop updating the sustain length for (int i = 0; i < heldNotes.Length; ++i) { if (isTyping || Input.GetKeyUp(NumToStringLUT[(i + 1)])) { ClearHeldNotes(i); } } // Guard to prevent users from pressing keys while dragging out sustains if (!GameSettings.extendedSustainsEnabled) { foreach (Note heldNote in heldNotes) { if (heldNote != null && heldNote.length > 0) { return; } } } if (isTyping) { return; } bool openNotesBanned, nonOpenNotesBanned; CheckBannedInputsForSustainHolds(out openNotesBanned, out nonOpenNotesBanned); if (nonOpenNotesBanned) { return; } for (int i = 0; i < laneCount + 1; ++i) // Start at 1 to ignore the multinote { // Need to make sure the note is at it's correct tick position if (Input.GetKeyDown(NumToStringLUT[(i + 1)])) { int notePos = i; if (Input.GetKeyDown(GetOpenNoteInputKey(laneCount))) { if (openNotesBanned) // Ban conflicting inputs as the command stack REALLY doesn't like this. { continue; } notePos = allPlaceableNotes.IndexOf(openNote); } LeftyFlipReflectionCheck(ref notePos, laneCount); allPlaceableNotes[notePos].ExplicitUpdate(); int pos = SongObjectHelper.FindObjectPosition(allPlaceableNotes[notePos].note, editor.currentChart.notes); if (currentPlacementMode == KeysPlacementMode.None) { currentPlacementMode = pos == SongObjectHelper.NOTFOUND ? KeysPlacementMode.Adding : KeysPlacementMode.Deleting; } if (currentPlacementMode == KeysPlacementMode.Adding && pos == SongObjectHelper.NOTFOUND) { heldNotes[i] = allPlaceableNotes[notePos].note.CloneAs <Note>(); heldNotes[i].length = 0; currentlyAddingNotes.Add(heldNotes[i]); Debug.Log("Added " + allPlaceableNotes[notePos].note.rawNote + " note at position " + allPlaceableNotes[notePos].note.tick + " using keyboard controls"); } else if (currentPlacementMode == KeysPlacementMode.Deleting) { currentlyAddingNotes.Add(editor.currentChart.notes[pos]); Debug.Log("Removed " + editor.currentChart.notes[pos].rawNote + " note at position " + editor.currentChart.notes[pos].tick + " using keyboard controls"); } } } }
void ResetNoteAdding() { currentlyAddingNotes.Clear(); currentPlacementMode = KeysPlacementMode.None; }