bitburner-src/src/Infiltration/ui/Intro.tsx

100 lines
3.0 KiB
TypeScript
Raw Normal View History

2021-09-05 01:09:30 +02:00
import React from "react";
2021-09-18 10:01:07 +02:00
import { Location } from "../../Locations/Location";
2021-09-17 01:23:03 +02:00
import Grid from "@mui/material/Grid";
2021-10-01 19:08:37 +02:00
import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button";
interface IProps {
2021-09-18 10:01:07 +02:00
Location: Location;
2021-09-05 01:09:30 +02:00
Difficulty: number;
MaxLevel: number;
start: () => void;
cancel: () => void;
}
2021-08-11 02:54:43 +02:00
function arrowPart(color: string, length: number): JSX.Element {
2021-09-05 01:09:30 +02:00
let arrow = "";
if (length <= 0) length = 0;
else if (length > 13) length = 13;
else {
length--;
arrow = ">";
}
return (
<span style={{ color: color }}>
{"=".repeat(length)}
{arrow}
{" ".repeat(13 - arrow.length - length)}
</span>
);
2021-08-11 02:54:43 +02:00
}
function coloredArrow(difficulty: number): JSX.Element {
2021-09-05 01:09:30 +02:00
if (difficulty === 0) {
return (
<span style={{ color: "white" }}>
{">"}
{" ".repeat(38)}
</span>
);
} else {
return (
<>
{arrowPart("white", difficulty * 13)}
{arrowPart("orange", (difficulty - 1) * 13)}
{arrowPart("red", (difficulty - 2) * 13)}
</>
);
}
2021-08-11 02:54:43 +02:00
}
export function Intro(props: IProps): React.ReactElement {
2021-09-05 01:09:30 +02:00
return (
<>
<Grid container spacing={3}>
<Grid item xs={10}>
2021-10-01 19:08:37 +02:00
<Typography variant="h4">Infiltrating {props.Location.name}</Typography>
</Grid>
2021-09-05 01:09:30 +02:00
<Grid item xs={10}>
2021-10-01 19:08:37 +02:00
<Typography variant="h5" color="primary">
Maximum level: {props.MaxLevel}
</Typography>
2021-09-05 01:09:30 +02:00
</Grid>
<Grid item xs={10}>
2021-10-01 19:08:37 +02:00
<Typography sx={{ lineHeight: "1em", whiteSpace: "pre" }}>[{coloredArrow(props.Difficulty)}]</Typography>
<Typography
sx={{ lineHeight: "1em", whiteSpace: "pre" }}
>{` ^ ^ ^ ^`}</Typography>
<Typography
sx={{ lineHeight: "1em", whiteSpace: "pre" }}
>{` Trivial Normal Hard Impossible`}</Typography>
2021-09-05 01:09:30 +02:00
</Grid>
<Grid item xs={10}>
2021-10-01 19:08:37 +02:00
<Typography>
2021-09-09 05:47:34 +02:00
Infiltration is a series of short minigames that get progressively harder. You take damage for failing them.
Reaching the maximum level rewards you with intel you can trade for money or reputation.
2021-10-01 19:08:37 +02:00
</Typography>
2021-09-05 01:09:30 +02:00
<br />
2021-10-01 19:08:37 +02:00
<Typography>
The minigames you play are randomly selected. It might take you few tries to get used to them.
</Typography>
2021-09-05 01:09:30 +02:00
<br />
2021-10-01 19:08:37 +02:00
<Typography>No game require use of the mouse.</Typography>
2021-09-05 01:09:30 +02:00
<br />
2021-10-01 19:08:37 +02:00
<Typography>Spacebar is the default action/confirm button.</Typography>
2021-09-05 01:09:30 +02:00
<br />
2021-10-01 19:08:37 +02:00
<Typography>Everything that uses arrow can also use WASD</Typography>
2021-09-05 01:09:30 +02:00
<br />
2021-10-01 19:08:37 +02:00
<Typography>Sometimes the rest of the keyboard is used.</Typography>
2021-09-05 01:09:30 +02:00
</Grid>
<Grid item xs={3}>
2021-10-01 19:08:37 +02:00
<Button onClick={props.start}>Start</Button>
2021-09-05 01:09:30 +02:00
</Grid>
<Grid item xs={3}>
2021-10-01 19:08:37 +02:00
<Button onClick={props.cancel}>Cancel</Button>
2021-09-05 01:09:30 +02:00
</Grid>
</Grid>
</>
);
}