From 7b3265346d6b8ab22b4f9fda90bd40e80eb803aa Mon Sep 17 00:00:00 2001 From: muesli4brekkies <110121045+muesli4brekkies@users.noreply.github.com> Date: Mon, 10 Jun 2024 00:49:34 +0100 Subject: [PATCH] ACCESSIBILITY: Wire cutting infil now prints colours of wire along the wire (#1380) --- src/Infiltration/ui/WireCuttingGame.tsx | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/Infiltration/ui/WireCuttingGame.tsx b/src/Infiltration/ui/WireCuttingGame.tsx index f70d82175..425773ea6 100644 --- a/src/Infiltration/ui/WireCuttingGame.tsx +++ b/src/Infiltration/ui/WireCuttingGame.tsx @@ -4,7 +4,6 @@ import { Box, Paper, Typography } from "@mui/material"; import { AugmentationName } from "@enums"; import { Player } from "@player"; import { Settings } from "../../Settings/Settings"; -import { KEY } from "../../utils/helpers/keyCodes"; import { random } from "../utils"; import { interpolate } from "./Difficulty"; import { GameTimer } from "./GameTimer"; @@ -32,19 +31,17 @@ const difficulties: { Impossible: { timer: 4000, wiresmin: 9, wiresmax: 9, rules: 4 }, }; -const types = [KEY.PIPE, KEY.DOT, KEY.FORWARD_SLASH, KEY.HYPHEN, "█", KEY.HASH]; - const colors = ["red", "#FFC107", "blue", "white"]; const colorNames: Record = { - red: "red", - "#FFC107": "yellow", - blue: "blue", - white: "white", + red: "RED", + "#FFC107": "YELLOW", + blue: "BLUE", + white: "WHITE", }; interface Wire { - wireType: string; + wireType: string[]; colors: string[]; } @@ -142,7 +139,7 @@ export function WireCuttingGame({ onSuccess, onFailure, difficulty }: IMinigameP ); })} - {new Array(8).fill(0).map((_, i) => ( + {new Array(11).fill(0).map((_, i) => ( {wires.map((wire, j) => { if ((i === 3 || i === 4) && cutWires[j]) { @@ -153,7 +150,7 @@ export function WireCuttingGame({ onSuccess, onFailure, difficulty }: IMinigameP hasAugment && !isCorrectWire ? Settings.theme.disabled : wire.colors[i % wire.colors.length]; return ( - |{wire.wireType}| + |{wire.wireType[i % wire.wireType.length]}| ); })} @@ -172,7 +169,7 @@ function randomPositionQuestion(wires: Wire[]): Question { toString: (): string => { return `Cut wires number ${index + 1}.`; }, - shouldCut: (wire: Wire, i: number): boolean => { + shouldCut: (_wire: Wire, i: number): boolean => { return index === i; }, }; @@ -209,8 +206,9 @@ function generateWires(difficulty: Difficulty): Wire[] { if (Math.random() < 0.15) { wireColors.push(colors[Math.floor(Math.random() * colors.length)]); } + const wireType = [...wireColors.map((color) => colorNames[color]).join("")]; wires.push({ - wireType: types[Math.floor(Math.random() * types.length)], + wireType, colors: wireColors, }); }