mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-18 07:18:38 +02:00
UI: Sync UI updates to game updates. (#1512)
There are a bunch of React components that update at the same rate that the game engine processes cycles. Rather than have each place that does so start its own timer to update that often, add a new react hook that triggers an update shortly after the engine completes a cycle.
This commit is contained in:
@@ -25,12 +25,12 @@ import Typography from "@mui/material/Typography";
|
||||
import Grid from "@mui/material/Grid";
|
||||
import Button from "@mui/material/Button";
|
||||
import { Box } from "@mui/material";
|
||||
import { useRerender } from "../../ui/React/hooks";
|
||||
import { useCycleRerender } from "../../ui/React/hooks";
|
||||
|
||||
/** Root React Component for the Hacknet Node UI */
|
||||
export function HacknetRoot(): React.ReactElement {
|
||||
const [open, setOpen] = useState(false);
|
||||
const rerender = useRerender(200);
|
||||
const rerender = useCycleRerender();
|
||||
const [purchaseMultiplier, setPurchaseMultiplier] = useState<number | "MAX">(PurchaseMultipliers.x1);
|
||||
|
||||
let totalProduction = 0;
|
||||
|
||||
Reference in New Issue
Block a user