mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-22 22:22:26 +01:00
added arcade
This commit is contained in:
parent
372776c94e
commit
30776e5aca
43
src/Arcade/ui/ArcadeRoot.tsx
Normal file
43
src/Arcade/ui/ArcadeRoot.tsx
Normal file
@ -0,0 +1,43 @@
|
||||
import React, { useState } from "react";
|
||||
import { BBCabinetRoot } from "./BBCabinet";
|
||||
|
||||
import Button from "@mui/material/Button";
|
||||
import { use } from "../../ui/Context";
|
||||
import { AlertEvents } from "../../ui/React/AlertManager";
|
||||
|
||||
enum Page {
|
||||
None,
|
||||
Megabyteburner2000,
|
||||
}
|
||||
|
||||
export function ArcadeRoot(): React.ReactElement {
|
||||
const player = use.Player();
|
||||
const [page, setPage] = useState(Page.None);
|
||||
|
||||
function mbBurner2000(): void {
|
||||
if (player.sourceFileLvl(1) === 0) {
|
||||
AlertEvents.emit("This machine is broken.");
|
||||
} else {
|
||||
setPage(Page.Megabyteburner2000);
|
||||
}
|
||||
}
|
||||
|
||||
if (page === Page.None) {
|
||||
return (
|
||||
<>
|
||||
<Button onClick={mbBurner2000}>Megabyte burner 2000</Button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
let currentGame = <></>;
|
||||
switch (page) {
|
||||
case Page.Megabyteburner2000:
|
||||
currentGame = <BBCabinetRoot />;
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<Button onClick={() => setPage(Page.None)}>Back</Button>
|
||||
{currentGame}
|
||||
</>
|
||||
);
|
||||
}
|
52
src/Arcade/ui/BBCabinet.tsx
Normal file
52
src/Arcade/ui/BBCabinet.tsx
Normal file
@ -0,0 +1,52 @@
|
||||
import React from "react";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
const metaBB = "https://bitburner-official.github.io/bitburner-legacy/";
|
||||
|
||||
const style = {
|
||||
width: "1060px",
|
||||
height: "800px",
|
||||
border: "0px",
|
||||
} as any;
|
||||
|
||||
export function BBCabinetRoot(): React.ReactElement {
|
||||
// prettier-ignore
|
||||
const joystick =
|
||||
<>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> ,'" "', .-. </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> / \ ( ) </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> | | .-. '-' .-. </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> \ / ( ) ( )</Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> '.___.' '-' .-. '-'</Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> ||| ( ) </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> ||| '-' </Typography>
|
||||
</>;
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
style={{
|
||||
width: "1060px",
|
||||
height: "800px",
|
||||
padding: "0",
|
||||
overflow: "hidden",
|
||||
borderColor: "white",
|
||||
borderStyle: "solid",
|
||||
borderWidth: "5px",
|
||||
}}
|
||||
>
|
||||
<iframe src={metaBB} style={style} />
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
width: "1060px",
|
||||
borderColor: "white",
|
||||
borderStyle: "solid",
|
||||
borderWidth: "5px",
|
||||
}}
|
||||
>
|
||||
{joystick}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
@ -127,10 +127,10 @@ Cities[CityName.NewTokyo].asciiArt = `
|
||||
|
||||
o
|
||||
\\
|
||||
\\ [defcomm]
|
||||
[arcade] E [defcomm]
|
||||
\\
|
||||
o--x---A--x--o [travel agency]
|
||||
7 8 10 G
|
||||
7 8 10 H
|
||||
[vitalife] o 12 [global pharmaceuticals]
|
||||
|
|
||||
o--D-x----x-------x-C-+--------x--x-B-x---x-o
|
||||
@ -141,14 +141,14 @@ Cities[CityName.NewTokyo].asciiArt = `
|
||||
\\
|
||||
[hospital] o 15 [world stock exchange]
|
||||
|
|
||||
o--x--E--x-----x-----x---+---x----x--H--x-o
|
||||
o--x--F--x-----x-----x---+---x----x--I--x-o
|
||||
|
|
||||
|
|
||||
o 17
|
||||
|
||||
|
||||
|
||||
F [the slums]
|
||||
G [the slums]
|
||||
`;
|
||||
Cities[CityName.Sector12].asciiArt = `
|
||||
78 o 97
|
||||
|
@ -54,6 +54,7 @@ export enum LocationName {
|
||||
NewTokyoGlobalPharmaceuticals = "Global Pharmaceuticals",
|
||||
NewTokyoNoodleBar = "Noodle Bar",
|
||||
NewTokyoVitaLife = "VitaLife",
|
||||
NewTokyoArcade = "Arcade",
|
||||
|
||||
// Ishima
|
||||
IshimaNovaMedical = "Nova Medical",
|
||||
|
@ -215,6 +215,11 @@ export const LocationsMetadata: IConstructorParams[] = [
|
||||
name: LocationName.NewTokyoVitaLife,
|
||||
types: [LocationType.Company, LocationType.Special],
|
||||
},
|
||||
{
|
||||
city: CityName.NewTokyo,
|
||||
name: LocationName.NewTokyoArcade,
|
||||
types: [LocationType.Special],
|
||||
},
|
||||
{
|
||||
city: CityName.Sector12,
|
||||
infiltrationData: {
|
||||
|
@ -34,10 +34,9 @@ const useStyles = makeStyles((theme: Theme) =>
|
||||
padding: "0px",
|
||||
cursor: "pointer",
|
||||
},
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
function toLocation(router: IRouter, location: Location): void {
|
||||
if (location.name === LocationName.TravelAgency) {
|
||||
router.toTravel();
|
||||
@ -132,12 +131,14 @@ function ASCIICity(props: IProps): React.ReactElement {
|
||||
|
||||
const elems: JSX.Element[] = [];
|
||||
const lines = props.city.asciiArt.split("\n");
|
||||
let i = 0;
|
||||
for (const line of lines) {
|
||||
elems.push(
|
||||
<Typography key={line} sx={{ lineHeight: "1em", whiteSpace: "pre" }}>
|
||||
<Typography key={i} sx={{ lineHeight: "1em", whiteSpace: "pre" }}>
|
||||
{lineElems(line)}
|
||||
</Typography>,
|
||||
);
|
||||
i++;
|
||||
}
|
||||
|
||||
return <>{elems}</>;
|
||||
|
@ -32,6 +32,7 @@ import { CorruptableText } from "../../ui/React/CorruptableText";
|
||||
import { HacknetNode } from "../../Hacknet/HacknetNode";
|
||||
import { HacknetServer } from "../../Hacknet/HacknetServer";
|
||||
import { GetServer } from "../../Server/AllServers";
|
||||
import { ArcadeRoot } from "../../Arcade/ui/ArcadeRoot";
|
||||
|
||||
type IProps = {
|
||||
loc: Location;
|
||||
@ -81,7 +82,12 @@ export function SpecialLocation(props: IProps): React.ReactElement {
|
||||
return <></>;
|
||||
}
|
||||
const text = inBladeburner ? "Enter Bladeburner Headquarters" : "Apply to Bladeburner Division";
|
||||
return <><br/><Button onClick={handleBladeburner}>{text}</Button></>;
|
||||
return (
|
||||
<>
|
||||
<br />
|
||||
<Button onClick={handleBladeburner}>{text}</Button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function renderNoodleBar(): React.ReactElement {
|
||||
@ -311,6 +317,9 @@ export function SpecialLocation(props: IProps): React.ReactElement {
|
||||
case LocationName.IshimaGlitch: {
|
||||
return renderGlitch();
|
||||
}
|
||||
case LocationName.NewTokyoArcade: {
|
||||
return <ArcadeRoot />;
|
||||
}
|
||||
default:
|
||||
console.error(`Location ${props.loc.name} doesn't have any special properties`);
|
||||
return <></>;
|
||||
|
@ -110,107 +110,45 @@ const useStyles = makeStyles((theme: Theme) =>
|
||||
}),
|
||||
);
|
||||
|
||||
const uninitialized = (): any => {
|
||||
throw new Error("Router called before initialization");
|
||||
};
|
||||
|
||||
export let Router: IRouter = {
|
||||
isInitialized: false,
|
||||
page: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
allowRouting: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toActiveScripts: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toAugmentations: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toBitVerse: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toBladeburner: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toStats: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toCity: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toCorporation: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toCreateProgram: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toDevMenu: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toFaction: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toFactions: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toGameOptions: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toGang: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toHacknetNodes: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toInfiltration: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toJob: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toMilestones: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toResleeves: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toScriptEditor: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toSleeves: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toStockMarket: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toTerminal: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toTravel: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toTutorial: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toWork: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toBladeburnerCinematic: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toLocation: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toStaneksGift: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toAchievements: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toThemeBrowser: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
toImportSave: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
page: uninitialized,
|
||||
allowRouting: uninitialized,
|
||||
toActiveScripts: uninitialized,
|
||||
toAugmentations: uninitialized,
|
||||
toBitVerse: uninitialized,
|
||||
toBladeburner: uninitialized,
|
||||
toStats: uninitialized,
|
||||
toCity: uninitialized,
|
||||
toCorporation: uninitialized,
|
||||
toCreateProgram: uninitialized,
|
||||
toDevMenu: uninitialized,
|
||||
toFaction: uninitialized,
|
||||
toFactions: uninitialized,
|
||||
toGameOptions: uninitialized,
|
||||
toGang: uninitialized,
|
||||
toHacknetNodes: uninitialized,
|
||||
toInfiltration: uninitialized,
|
||||
toJob: uninitialized,
|
||||
toMilestones: uninitialized,
|
||||
toResleeves: uninitialized,
|
||||
toScriptEditor: uninitialized,
|
||||
toSleeves: uninitialized,
|
||||
toStockMarket: uninitialized,
|
||||
toTerminal: uninitialized,
|
||||
toTravel: uninitialized,
|
||||
toTutorial: uninitialized,
|
||||
toWork: uninitialized,
|
||||
toBladeburnerCinematic: uninitialized,
|
||||
toLocation: uninitialized,
|
||||
toStaneksGift: uninitialized,
|
||||
toAchievements: uninitialized,
|
||||
toThemeBrowser: uninitialized,
|
||||
toImportSave: uninitialized,
|
||||
};
|
||||
|
||||
function determineStartPage(player: IPlayer): Page {
|
||||
@ -346,12 +284,11 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
// Wrap Router navigate functions to be able to disable the execution
|
||||
_functions(Router).
|
||||
filter((fnName) => fnName.startsWith('to')).
|
||||
forEach((fnName) => {
|
||||
_functions(Router)
|
||||
.filter((fnName) => fnName.startsWith("to"))
|
||||
.forEach((fnName) => {
|
||||
// @ts-ignore - tslint does not like this, couldn't find a way to make it cooperate
|
||||
Router[fnName] = _wrap(Router[fnName], (func, ...args) => {
|
||||
if (!allowRoutingCalls) {
|
||||
@ -568,13 +505,7 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
|
||||
break;
|
||||
}
|
||||
case Page.ImportSave: {
|
||||
mainPage = (
|
||||
<ImportSaveRoot
|
||||
importString={importString}
|
||||
automatic={importAutomatic}
|
||||
router={Router}
|
||||
/>
|
||||
);
|
||||
mainPage = <ImportSaveRoot importString={importString} automatic={importAutomatic} router={Router} />;
|
||||
withSidebar = false;
|
||||
withPopups = false;
|
||||
bypassGame = true;
|
||||
|
Loading…
Reference in New Issue
Block a user