mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-06 07:37:56 +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:
@@ -19,7 +19,7 @@ import { Page } from "../../ui/Router";
|
||||
import { Player } from "@player";
|
||||
import { QuitJobModal } from "../../Company/ui/QuitJobModal";
|
||||
import { CompanyWork } from "../../Work/CompanyWork";
|
||||
import { useRerender } from "../../ui/React/hooks";
|
||||
import { useCycleRerender } from "../../ui/React/hooks";
|
||||
import { companyNameAsLocationName } from "../../Company/utils";
|
||||
import { JobSummary } from "../../Company/ui/JobSummary";
|
||||
import { StatsTable } from "../../ui/React/StatsTable";
|
||||
@@ -32,7 +32,7 @@ interface IProps {
|
||||
|
||||
export function CompanyLocation(props: IProps): React.ReactElement {
|
||||
const [quitOpen, setQuitOpen] = useState(false);
|
||||
const rerender = useRerender(200);
|
||||
const rerender = useCycleRerender();
|
||||
|
||||
/**
|
||||
* We'll keep a reference to the Company that this component is being rendered for,
|
||||
|
||||
@@ -12,12 +12,12 @@ import { getHospitalizationCost } from "../../Hospital/Hospital";
|
||||
import { Money } from "../../ui/React/Money";
|
||||
|
||||
import { dialogBoxCreate } from "../../ui/React/DialogBox";
|
||||
import { useRerender } from "../../ui/React/hooks";
|
||||
import { useCycleRerender } from "../../ui/React/hooks";
|
||||
|
||||
export function HospitalLocation(): React.ReactElement {
|
||||
/** Stores button styling that sets them all to block display */
|
||||
const btnStyle = { display: "block" };
|
||||
const rerender = useRerender(200);
|
||||
const rerender = useCycleRerender();
|
||||
|
||||
function getHealed(e: React.MouseEvent<HTMLElement>): void {
|
||||
if (!e.isTrusted) {
|
||||
|
||||
Reference in New Issue
Block a user