bitburner-src/src/DevMenu/ui/SleevesDev.tsx

97 lines
2.7 KiB
TypeScript
Raw Normal View History

2021-09-14 02:37:35 +02:00
import React from "react";
2021-09-17 01:23:03 +02:00
import Accordion from "@mui/material/Accordion";
import AccordionSummary from "@mui/material/AccordionSummary";
import AccordionDetails from "@mui/material/AccordionDetails";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
2021-09-14 02:37:35 +02:00
2021-09-17 01:23:03 +02:00
import Button from "@mui/material/Button";
2021-10-01 02:06:40 +02:00
import Typography from "@mui/material/Typography";
import { Player } from "@player";
import { Adjuster } from "./Adjuster";
2021-09-14 02:37:35 +02:00
export function SleevesDev(): React.ReactElement {
2021-09-14 02:37:35 +02:00
function sleeveMaxAllShock(): void {
2022-09-06 15:07:12 +02:00
for (let i = 0; i < Player.sleeves.length; ++i) {
Player.sleeves[i].shock = 100;
2021-09-14 02:37:35 +02:00
}
}
function sleeveClearAllShock(): void {
2022-09-06 15:07:12 +02:00
for (let i = 0; i < Player.sleeves.length; ++i) {
Player.sleeves[i].shock = 0;
2021-09-14 02:37:35 +02:00
}
}
function sleeveSyncMaxAll(): void {
2022-09-06 15:07:12 +02:00
for (let i = 0; i < Player.sleeves.length; ++i) {
Player.sleeves[i].sync = 100;
2021-09-14 02:37:35 +02:00
}
}
function sleeveSyncClearAll(): void {
2022-09-06 15:07:12 +02:00
for (let i = 0; i < Player.sleeves.length; ++i) {
Player.sleeves[i].sync = 0;
2021-09-14 02:37:35 +02:00
}
}
function sleeveSetStoredCycles(cycles: number): void {
2022-09-06 15:07:12 +02:00
for (let i = 0; i < Player.sleeves.length; ++i) {
Player.sleeves[i].storedCycles = cycles;
}
}
2021-09-14 02:37:35 +02:00
return (
2021-09-18 03:30:02 +02:00
<Accordion TransitionProps={{ unmountOnExit: true }}>
2021-09-14 02:37:35 +02:00
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
2021-10-01 22:22:33 +02:00
<Typography>Sleeves</Typography>
2021-09-14 02:37:35 +02:00
</AccordionSummary>
<AccordionDetails>
<table>
<tbody>
<tr>
<td>
2021-10-01 02:06:40 +02:00
<Typography>Shock:</Typography>
2021-09-14 02:37:35 +02:00
</td>
<td>
<Button onClick={sleeveMaxAllShock}>Max all</Button>
</td>
<td>
<Button onClick={sleeveClearAllShock}>Clear all</Button>
</td>
</tr>
<tr>
<td>
2021-10-01 02:06:40 +02:00
<Typography>Sync:</Typography>
2021-09-14 02:37:35 +02:00
</td>
<td>
<Button onClick={sleeveSyncMaxAll}>Max all</Button>
</td>
<td>
<Button onClick={sleeveSyncClearAll}>Clear all</Button>
</td>
</tr>
<tr>
<td>
<Typography>Total:</Typography>
</td>
</tr>
<tr>
<td colSpan={3}>
<Adjuster
label="Stored Cycles"
placeholder="cycles"
tons={() => sleeveSetStoredCycles(10000000)}
add={sleeveSetStoredCycles}
subtract={sleeveSetStoredCycles}
reset={() => sleeveSetStoredCycles(0)}
/>
</td>
</tr>
2021-09-14 02:37:35 +02:00
</tbody>
</table>
</AccordionDetails>
</Accordion>
);
}