mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-20 05:05:47 +01:00
Merge pull request #3634 from Dane-Horn/2741-shift-in-typing-infiltration
UI: FIX #2741 Allow using modifier keys inside the typing infiltration
This commit is contained in:
commit
4024f6e10f
@ -37,9 +37,13 @@ export function BackwardGame(props: IMinigameProps): React.ReactElement {
|
||||
const [guess, setGuess] = useState("");
|
||||
const hasAugment = Player.hasAugmentation(AugmentationNames.ChaosOfDionysus, true);
|
||||
|
||||
function ignorableKeyboardEvent(event: KeyboardEvent): boolean {
|
||||
return event.key === KEY.BACKSPACE || (event.shiftKey && event.key === "Shift") || event.ctrlKey || event.altKey;
|
||||
}
|
||||
|
||||
function press(this: Document, event: KeyboardEvent): void {
|
||||
event.preventDefault();
|
||||
if (event.key === KEY.BACKSPACE) return;
|
||||
if (ignorableKeyboardEvent(event)) return;
|
||||
const nextGuess = guess + event.key.toUpperCase();
|
||||
if (!answer.startsWith(nextGuess)) props.onFailure();
|
||||
else if (answer === nextGuess) props.onSuccess();
|
||||
|
Loading…
Reference in New Issue
Block a user