bitburner-src/src/CotMG/ui/StaneksGiftRoot.tsx

37 lines
1.4 KiB
TypeScript
Raw Normal View History

2021-10-08 09:16:51 +02:00
import React, { useState, useEffect } from "react";
import { convertTimeMsToTimeElapsedString } from "../../utils/StringHelperFunctions";
import { CONSTANTS } from "../../Constants";
import { StaneksGiftEvents } from "../StaneksGiftEvents";
2021-10-16 23:12:04 +02:00
import { MainBoard } from "./MainBoard";
2021-09-25 23:21:50 +02:00
import { IStaneksGift } from "../IStaneksGift";
2021-10-04 02:34:36 +02:00
import Typography from "@mui/material/Typography";
2021-09-25 23:21:50 +02:00
type IProps = {
staneksGift: IStaneksGift;
};
export function StaneksGiftRoot({ staneksGift }: IProps): React.ReactElement {
2021-10-08 09:16:51 +02:00
const setRerender = useState(true)[1];
function rerender(): void {
setRerender((o) => !o);
}
useEffect(() => StaneksGiftEvents.subscribe(rerender), []);
2021-09-25 23:21:50 +02:00
return (
<>
2021-10-04 02:34:36 +02:00
<Typography variant="h4">Stanek's Gift</Typography>
<Typography>
The gift is a grid on which you can place upgrades called fragments. The main type of fragment increases a stat,
like your hacking skill or agility exp. Once a stat fragment is placed it then needs to be charged via scripts
2021-12-12 18:46:56 +01:00
in order to become useful. The other kind of fragments are called booster fragments. They increase the
efficiency of neighboring fragments them (no diagonal). Q/E to rotate fragments.
2021-10-04 02:34:36 +02:00
</Typography>
2021-10-08 09:16:51 +02:00
{staneksGift.storedCycles > 5 && (
<Typography>
Bonus time: {convertTimeMsToTimeElapsedString(CONSTANTS._idleSpeed * staneksGift.storedCycles)}
</Typography>
)}
2021-10-16 23:12:04 +02:00
<MainBoard gift={staneksGift} />
2021-09-25 23:21:50 +02:00
</>
);
}