This commit is contained in:
Olivier Gagnon 2021-09-13 22:27:43 -04:00
parent 05fd85002c
commit 2d463b60a0
21 changed files with 82 additions and 199 deletions

@ -1,30 +1,8 @@
import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
import { CodingContractTypes } from "./CodingContracts";
import { generateContract, generateRandomContract, generateRandomContractOnHome } from "./CodingContractGenerator";
import { IPlayer } from "./PersonObjects/IPlayer";
import { Bladeburner } from "./Bladeburner/Bladeburner";
import { IEngine } from "./IEngine";
import { saveObject } from "./SaveObject";
import { dialogBoxCreate } from "../utils/DialogBox";
import { Money } from "./ui/React/Money";
import { TextField } from "./ui/React/TextField";
import { Button } from "./ui/React/Button";
import { Select } from "./ui/React/Select";
import React, { useState } from "react";
import AddIcon from "@material-ui/icons/Add";
import RemoveIcon from "@material-ui/icons/Remove";
import IconButton from "@material-ui/core/IconButton";
import ExposureZeroIcon from "@material-ui/icons/ExposureZero";
import ButtonGroup from "@material-ui/core/ButtonGroup";
import DoubleArrowIcon from "@material-ui/icons/DoubleArrow";
import ReplyAllIcon from "@material-ui/icons/ReplyAll";
import ReplyIcon from "@material-ui/icons/Reply";
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
import MenuItem from "@material-ui/core/MenuItem";
import FormControl from "@material-ui/core/FormControl";
import InputLabel from "@material-ui/core/InputLabel";
import React from "react";
import { Theme } from "./ui/React/Theme";
import { General } from "./DevMenu/ui/General";
@ -59,8 +37,8 @@ export function DevMenuRoot(props: IProps): React.ReactElement {
<Augmentations player={props.player} />
<SourceFiles player={props.player} />
<Programs player={props.player} />
<Servers player={props.player} />
<Companies player={props.player} />
<Servers />
<Companies />
{props.player.bladeburner instanceof Bladeburner && <BladeburnerElem player={props.player} />}
@ -68,9 +46,9 @@ export function DevMenuRoot(props: IProps): React.ReactElement {
{props.player.hasCorporation() && <Corporation player={props.player} />}
<CodingContracts player={props.player} />
<CodingContracts />
{props.player.hasWseAccount && <StockMarket player={props.player} />}
{props.player.hasWseAccount && <StockMarket />}
{props.player.sleeves.length > 0 && <Sleeves player={props.player} />}

@ -4,7 +4,8 @@ import RemoveIcon from "@material-ui/icons/Remove";
import IconButton from "@material-ui/core/IconButton";
import ExposureZeroIcon from "@material-ui/icons/ExposureZero";
import DoubleArrowIcon from "@material-ui/icons/DoubleArrow";
import { TextField } from "../../ui/React/TextField";
import TextField from "@material-ui/core/TextField";
import Tooltip from "@material-ui/core/Tooltip";
interface IProps {
label: string;
@ -35,22 +36,30 @@ export function Adjuster(props: IProps): React.ReactElement {
InputProps={{
startAdornment: (
<>
<IconButton color="primary" onClick={tons}>
<DoubleArrowIcon style={{ transform: "rotate(-90deg)" }} />
</IconButton>
<IconButton color="primary" onClick={() => add(typeof value !== "string" ? value : 0)}>
<AddIcon />
</IconButton>
<Tooltip title="Add a lot">
<IconButton color="primary" onClick={tons}>
<DoubleArrowIcon style={{ transform: "rotate(-90deg)" }} />
</IconButton>
</Tooltip>
<Tooltip title="Add">
<IconButton color="primary" onClick={() => add(typeof value !== "string" ? value : 0)}>
<AddIcon />
</IconButton>
</Tooltip>
</>
),
endAdornment: (
<>
<IconButton color="primary" onClick={() => subtract(typeof value !== "string" ? value : 0)}>
<RemoveIcon />
</IconButton>
<IconButton color="primary" onClick={reset}>
<ExposureZeroIcon />
</IconButton>
<Tooltip title="Remove">
<IconButton color="primary" onClick={() => subtract(typeof value !== "string" ? value : 0)}>
<RemoveIcon />
</IconButton>
</Tooltip>
<Tooltip title="Reset">
<IconButton color="primary" onClick={reset}>
<ExposureZeroIcon />
</IconButton>
</Tooltip>
</>
),
}}

@ -5,8 +5,7 @@ import AccordionSummary from "@material-ui/core/AccordionSummary";
import AccordionDetails from "@material-ui/core/AccordionDetails";
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
import { Button } from "../../ui/React/Button";
import { Select } from "../../ui/React/Select";
import Select from "@material-ui/core/Select";
import { IPlayer } from "../../PersonObjects/IPlayer";
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
import MenuItem from "@material-ui/core/MenuItem";
@ -14,8 +13,6 @@ import IconButton from "@material-ui/core/IconButton";
import ReplyAllIcon from "@material-ui/icons/ReplyAll";
import ReplyIcon from "@material-ui/icons/Reply";
const bigNumber = 1e27;
interface IProps {
player: IPlayer;
}

@ -5,7 +5,6 @@ import AccordionSummary from "@material-ui/core/AccordionSummary";
import AccordionDetails from "@material-ui/core/AccordionDetails";
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
import { Button } from "../../ui/React/Button";
import { Adjuster } from "./Adjuster";
import { IPlayer } from "../../PersonObjects/IPlayer";

@ -5,24 +5,13 @@ import AccordionSummary from "@material-ui/core/AccordionSummary";
import AccordionDetails from "@material-ui/core/AccordionDetails";
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
import { Button } from "../../ui/React/Button";
import { Select } from "../../ui/React/Select";
import { PlayerOwnedSourceFile } from "../../SourceFile/PlayerOwnedSourceFile";
import { IPlayer } from "../../PersonObjects/IPlayer";
import { generateContract, generateRandomContract, generateRandomContractOnHome } from "../../CodingContractGenerator";
import ButtonGroup from "@material-ui/core/ButtonGroup";
import Button from "@material-ui/core/Button";
import Select from "@material-ui/core/Select";
import MenuItem from "@material-ui/core/MenuItem";
import { generateContract, generateRandomContract, generateRandomContractOnHome } from "../../CodingContractGenerator";
import { CodingContractTypes } from "../../CodingContracts";
// Update as additional BitNodes get implemented
const validSFN = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
const bigNumber = 1e27;
interface IProps {
player: IPlayer;
}
export function CodingContracts(props: IProps): React.ReactElement {
export function CodingContracts(): React.ReactElement {
const [codingcontract, setCodingcontract] = useState("Find Largest Prime Factor");
function setCodingcontractDropdown(event: React.ChangeEvent<{ value: unknown }>): void {
setCodingcontract(event.target.value as string);

@ -5,25 +5,15 @@ import AccordionSummary from "@material-ui/core/AccordionSummary";
import AccordionDetails from "@material-ui/core/AccordionDetails";
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
import { Button } from "../../ui/React/Button";
import { Select } from "../../ui/React/Select";
import { IPlayer } from "../../PersonObjects/IPlayer";
import Button from "@material-ui/core/Button";
import Select from "@material-ui/core/Select";
import { Companies as AllCompanies } from "../../Company/Companies";
import FormControl from "@material-ui/core/FormControl";
import MenuItem from "@material-ui/core/MenuItem";
import IconButton from "@material-ui/core/IconButton";
import ReplyAllIcon from "@material-ui/icons/ReplyAll";
import ReplyIcon from "@material-ui/icons/Reply";
import InputLabel from "@material-ui/core/InputLabel";
import { Adjuster } from "./Adjuster";
const bigNumber = 1e12;
interface IProps {
player: IPlayer;
}
export function Companies(props: IProps): React.ReactElement {
export function Companies(): React.ReactElement {
const [company, setCompany] = useState("ECorp");
function setCompanyDropdown(event: React.ChangeEvent<{ value: unknown }>): void {
setCompany(event.target.value as string);

@ -5,7 +5,7 @@ import AccordionSummary from "@material-ui/core/AccordionSummary";
import AccordionDetails from "@material-ui/core/AccordionDetails";
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
import { Button } from "../../ui/React/Button";
import Button from "@material-ui/core/Button";
import { Adjuster } from "./Adjuster";
import { IPlayer } from "../../PersonObjects/IPlayer";

@ -5,8 +5,8 @@ import AccordionSummary from "@material-ui/core/AccordionSummary";
import AccordionDetails from "@material-ui/core/AccordionDetails";
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
import { Button } from "../../ui/React/Button";
import { Select } from "../../ui/React/Select";
import Button from "@material-ui/core/Button";
import Select from "@material-ui/core/Select";
import { Adjuster } from "./Adjuster";
import { IPlayer } from "../../PersonObjects/IPlayer";
import { Factions as AllFaction } from "../../Faction/Factions";

@ -5,7 +5,6 @@ import AccordionSummary from "@material-ui/core/AccordionSummary";
import AccordionDetails from "@material-ui/core/AccordionDetails";
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
import { Button } from "../../ui/React/Button";
import { Adjuster } from "./Adjuster";
import { IPlayer } from "../../PersonObjects/IPlayer";

@ -5,7 +5,7 @@ import AccordionSummary from "@material-ui/core/AccordionSummary";
import AccordionDetails from "@material-ui/core/AccordionDetails";
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
import { Button } from "../../ui/React/Button";
import Button from "@material-ui/core/Button";
import { Money } from "../../ui/React/Money";
import { IPlayer } from "../../PersonObjects/IPlayer";
import { hackWorldDaemon } from "../../RedPill";

@ -5,18 +5,11 @@ import AccordionSummary from "@material-ui/core/AccordionSummary";
import AccordionDetails from "@material-ui/core/AccordionDetails";
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
import { Button } from "../../ui/React/Button";
import { Select } from "../../ui/React/Select";
import Button from "@material-ui/core/Button";
import Select from "@material-ui/core/Select";
import { IPlayer } from "../../PersonObjects/IPlayer";
import { Programs as AllPrograms } from "../../Programs/Programs";
import FormControl from "@material-ui/core/FormControl";
import MenuItem from "@material-ui/core/MenuItem";
import IconButton from "@material-ui/core/IconButton";
import ReplyAllIcon from "@material-ui/icons/ReplyAll";
import ReplyIcon from "@material-ui/icons/Reply";
import InputLabel from "@material-ui/core/InputLabel";
const bigNumber = 1e12;
interface IProps {
player: IPlayer;

@ -5,26 +5,14 @@ import AccordionSummary from "@material-ui/core/AccordionSummary";
import AccordionDetails from "@material-ui/core/AccordionDetails";
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
import { Button } from "../../ui/React/Button";
import { Select } from "../../ui/React/Select";
import { IPlayer } from "../../PersonObjects/IPlayer";
import Button from "@material-ui/core/Button";
import Select from "@material-ui/core/Select";
import { AllServers } from "../../Server/AllServers";
import { HacknetServer } from "../../Hacknet/HacknetServer";
import { GetServerByHostname } from "../../Server/ServerHelpers";
import FormControl from "@material-ui/core/FormControl";
import MenuItem from "@material-ui/core/MenuItem";
import IconButton from "@material-ui/core/IconButton";
import ReplyAllIcon from "@material-ui/icons/ReplyAll";
import ReplyIcon from "@material-ui/icons/Reply";
import InputLabel from "@material-ui/core/InputLabel";
const bigNumber = 1e12;
interface IProps {
player: IPlayer;
}
export function Servers(props: IProps): React.ReactElement {
export function Servers(): React.ReactElement {
const [server, setServer] = useState("home");
function setServerDropdown(event: React.ChangeEvent<{ value: unknown }>): void {
setServer(event.target.value as string);

@ -5,14 +5,8 @@ import AccordionSummary from "@material-ui/core/AccordionSummary";
import AccordionDetails from "@material-ui/core/AccordionDetails";
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
import { Button } from "../../ui/React/Button";
import { PlayerOwnedSourceFile } from "../../SourceFile/PlayerOwnedSourceFile";
import Button from "@material-ui/core/Button";
import { IPlayer } from "../../PersonObjects/IPlayer";
import ButtonGroup from "@material-ui/core/ButtonGroup";
// Update as additional BitNodes get implemented
const validSFN = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
const bigNumber = 1e27;
interface IProps {
player: IPlayer;

@ -5,14 +5,13 @@ import AccordionSummary from "@material-ui/core/AccordionSummary";
import AccordionDetails from "@material-ui/core/AccordionDetails";
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
import { Button } from "../../ui/React/Button";
import Button from "@material-ui/core/Button";
import { PlayerOwnedSourceFile } from "../../SourceFile/PlayerOwnedSourceFile";
import { IPlayer } from "../../PersonObjects/IPlayer";
import ButtonGroup from "@material-ui/core/ButtonGroup";
// Update as additional BitNodes get implemented
const validSFN = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
const bigNumber = 1e27;
interface IProps {
player: IPlayer;

@ -5,7 +5,7 @@ import AccordionSummary from "@material-ui/core/AccordionSummary";
import AccordionDetails from "@material-ui/core/AccordionDetails";
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
import { Button } from "../../ui/React/Button";
import Button from "@material-ui/core/Button";
import { Adjuster } from "./Adjuster";
import { IPlayer } from "../../PersonObjects/IPlayer";

@ -5,22 +5,14 @@ import AccordionSummary from "@material-ui/core/AccordionSummary";
import AccordionDetails from "@material-ui/core/AccordionDetails";
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
import { Button } from "../../ui/React/Button";
import { TextField } from "../../ui/React/TextField";
import Button from "@material-ui/core/Button";
import TextField from "@material-ui/core/TextField";
import { Money } from "../../ui/React/Money";
import { Adjuster } from "./Adjuster";
import { IPlayer } from "../../PersonObjects/IPlayer";
import { dialogBoxCreate } from "../../../utils/DialogBox";
import { StockMarket as SM } from "../../StockMarket/StockMarket";
import { Stock } from "../../StockMarket/Stock";
const bigNumber = 1e27;
interface IProps {
player: IPlayer;
}
export function StockMarket(props: IProps): React.ReactElement {
export function StockMarket(): React.ReactElement {
const [stockPrice, setStockPrice] = useState(0);
const [stockSymbol, setStockSymbol] = useState("");

@ -5,16 +5,12 @@ import AccordionSummary from "@material-ui/core/AccordionSummary";
import AccordionDetails from "@material-ui/core/AccordionDetails";
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
import { Button } from "../../ui/React/Button";
import { PlayerOwnedSourceFile } from "../../SourceFile/PlayerOwnedSourceFile";
import Button from "@material-ui/core/Button";
import { IPlayer } from "../../PersonObjects/IPlayer";
import ButtonGroup from "@material-ui/core/ButtonGroup";
import { saveObject } from "../../SaveObject";
import { IEngine } from "../../IEngine";
// Update as additional BitNodes get implemented
const validSFN = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
const bigNumber = 1e27;
interface IProps {
player: IPlayer;

@ -61,7 +61,7 @@ function ListWorldMap(props: IProps): React.ReactElement {
{Object.values(CityName)
.filter((city: string) => city != props.p.city)
.map((city: string) => {
const match = Object.entries(CityName).find(([key, value]) => value === city);
const match = Object.entries(CityName).find((entry) => entry[1] === city);
if (match === undefined) throw new Error(`could not find key for city '${city}'`);
return (
<StdButton

@ -1,47 +0,0 @@
/**
* Wrapper around material-ui's Button component that styles it with
* Bitburner's UI theme
*/
import React from "react";
import { Button as MuiButton, ButtonProps, makeStyles } from "@material-ui/core";
import { colors } from "./Theme";
const useStyles = makeStyles({
// Tries to emulate StdButton in buttons.scss
root: {
backgroundColor: "#333",
border: "1px solid #000",
color: colors.primary,
margin: "5px",
padding: "3px 5px",
"&:hover": {
backgroundColor: "#000",
},
borderRadius: 0,
},
textPrimary: {
color: "rgb( 144, 202, 249)",
},
textSecondary: {
color: "rgb(244, 143, 177)",
},
disabled: {
backgroundColor: "#333",
color: "#fff",
cursor: "default",
},
});
export const Button: React.FC<ButtonProps> = (props: ButtonProps) => {
return (
<MuiButton
{...props}
classes={{
...useStyles(),
...props.classes,
}}
/>
);
};

@ -1,19 +0,0 @@
/**
* Wrapper around material-ui's Button component that styles it with
* Bitburner's UI colors
*/
import React from "react";
import { TextField as MuiTF, TextFieldProps, makeStyles } from "@material-ui/core";
import { colors } from "./Theme";
export const TextField: React.FC<TextFieldProps> = (props: TextFieldProps) => {
return (
<MuiTF
{...props}
classes={{
...props.classes,
}}
/>
);
};

@ -1,7 +1,5 @@
import React from "react";
import { createMuiTheme } from "@material-ui/core/styles";
import { ThemeProvider } from "@material-ui/core/styles";
import { createMuiTheme, ThemeProvider } from "@material-ui/core/styles";
export const colors = {
primarylight: "#0f0",
@ -41,7 +39,7 @@ export const theme = createMuiTheme({
borderBottomColor: "#fff",
},
underline: {
"&:hover:before": {
"&:hover": {
borderBottomColor: colors.primarydark,
},
"&:before": {
@ -61,6 +59,20 @@ export const theme = createMuiTheme({
},
},
},
MuiButton: {
root: {
backgroundColor: "#333",
border: "1px solid " + colors.well,
color: colors.primary,
margin: "5px",
padding: "3px 5px",
"&:hover": {
backgroundColor: "#000",
},
borderRadius: 0,
},
},
MuiSelect: {
icon: {
color: colors.primary,
@ -86,6 +98,20 @@ export const theme = createMuiTheme({
backgroundColor: "#000",
},
},
MuiIconButton: {
root: {
color: colors.primary,
},
},
MuiTooltip: {
tooltip: {
fontSize: "1em",
color: colors.primary,
backgroundColor: colors.well,
borderRadius: 0,
border: "2px solid white",
},
},
},
});