mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-02-16 18:12:24 +01:00
background primary/secondary and fix securtiy with grow
This commit is contained in:
18
dist/vendor.bundle.js
vendored
18
dist/vendor.bundle.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -89,7 +89,7 @@ export function processSingleServerGrowth(server: Server, threads: number, p: IP
|
|||||||
if (oldMoneyAvailable !== server.moneyAvailable) {
|
if (oldMoneyAvailable !== server.moneyAvailable) {
|
||||||
//Growing increases server security twice as much as hacking
|
//Growing increases server security twice as much as hacking
|
||||||
let usedCycles = numCycleForGrowth(server, server.moneyAvailable / oldMoneyAvailable, p, cores);
|
let usedCycles = numCycleForGrowth(server, server.moneyAvailable / oldMoneyAvailable, p, cores);
|
||||||
usedCycles = Math.max(0, usedCycles);
|
usedCycles = Math.min(Math.max(0, usedCycles), threads);
|
||||||
server.fortify(2 * CONSTANTS.ServerFortifyAmount * Math.ceil(usedCycles));
|
server.fortify(2 * CONSTANTS.ServerFortifyAmount * Math.ceil(usedCycles));
|
||||||
}
|
}
|
||||||
return server.moneyAvailable / oldMoneyAvailable;
|
return server.moneyAvailable / oldMoneyAvailable;
|
||||||
|
@ -135,6 +135,8 @@ interface IDefaultSettings {
|
|||||||
int: string;
|
int: string;
|
||||||
rep: string;
|
rep: string;
|
||||||
disabled: string;
|
disabled: string;
|
||||||
|
backgroundprimary: string;
|
||||||
|
backgroundsecondary: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,6 +211,8 @@ export const defaultSettings: IDefaultSettings = {
|
|||||||
int: "#6495ed",
|
int: "#6495ed",
|
||||||
rep: "#faffdf",
|
rep: "#faffdf",
|
||||||
disabled: "#66cfbc",
|
disabled: "#66cfbc",
|
||||||
|
backgroundprimary: "#000",
|
||||||
|
backgroundsecondary: "#000",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -271,11 +275,17 @@ export const Settings: ISettings & ISelfInitializer & ISelfLoading = {
|
|||||||
int: defaultSettings.theme.int,
|
int: defaultSettings.theme.int,
|
||||||
rep: defaultSettings.theme.rep,
|
rep: defaultSettings.theme.rep,
|
||||||
disabled: defaultSettings.theme.disabled,
|
disabled: defaultSettings.theme.disabled,
|
||||||
|
backgroundprimary: defaultSettings.theme.backgroundprimary,
|
||||||
|
backgroundsecondary: defaultSettings.theme.backgroundsecondary,
|
||||||
},
|
},
|
||||||
init() {
|
init() {
|
||||||
Object.assign(Settings, defaultSettings);
|
Object.assign(Settings, defaultSettings);
|
||||||
},
|
},
|
||||||
load(saveString: string) {
|
load(saveString: string) {
|
||||||
Object.assign(Settings, JSON.parse(saveString));
|
const save = JSON.parse(saveString);
|
||||||
|
Object.assign(Settings.theme, save.theme);
|
||||||
|
delete save.theme;
|
||||||
|
Object.assign(Settings, save);
|
||||||
|
console.log(Settings);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -2,6 +2,10 @@ import React, { useState, useEffect } from "react";
|
|||||||
import CircularProgress from "@mui/material/CircularProgress";
|
import CircularProgress from "@mui/material/CircularProgress";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import Grid from "@mui/material/Grid";
|
import Grid from "@mui/material/Grid";
|
||||||
|
import Box from "@mui/material/Box";
|
||||||
|
import { Theme } from "@mui/material/styles";
|
||||||
|
import makeStyles from "@mui/styles/makeStyles";
|
||||||
|
import createStyles from "@mui/styles/createStyles";
|
||||||
|
|
||||||
import { Terminal } from "../Terminal";
|
import { Terminal } from "../Terminal";
|
||||||
import { load } from "../db";
|
import { load } from "../db";
|
||||||
@ -11,7 +15,16 @@ import { GameRoot } from "./GameRoot";
|
|||||||
|
|
||||||
import { CONSTANTS } from "../Constants";
|
import { CONSTANTS } from "../Constants";
|
||||||
|
|
||||||
|
const useStyles = makeStyles((theme: Theme) =>
|
||||||
|
createStyles({
|
||||||
|
root: {
|
||||||
|
backgroundColor: theme.colors.backgroundprimary,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
export function LoadingScreen(): React.ReactElement {
|
export function LoadingScreen(): React.ReactElement {
|
||||||
|
const classes = useStyles();
|
||||||
const [show, setShow] = useState(false);
|
const [show, setShow] = useState(false);
|
||||||
const [loaded, setLoaded] = useState(false);
|
const [loaded, setLoaded] = useState(false);
|
||||||
|
|
||||||
@ -38,25 +51,27 @@ export function LoadingScreen(): React.ReactElement {
|
|||||||
doLoad();
|
doLoad();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
if (loaded) {
|
|
||||||
return <GameRoot terminal={Terminal} engine={Engine} player={Player} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid container direction="column" justifyContent="center" alignItems="center" style={{ minHeight: "100vh" }}>
|
<Box className={classes.root}>
|
||||||
<Grid item>
|
{loaded ? (
|
||||||
<CircularProgress size={150} color="primary" />
|
<GameRoot terminal={Terminal} engine={Engine} player={Player} />
|
||||||
</Grid>
|
) : (
|
||||||
<Grid item>
|
<Grid container direction="column" justifyContent="center" alignItems="center" style={{ minHeight: "100vh" }}>
|
||||||
<Typography variant="h3">Loading Bitburner v{CONSTANTS.Version}</Typography>
|
<Grid item>
|
||||||
</Grid>
|
<CircularProgress size={150} color="primary" />
|
||||||
{show && (
|
</Grid>
|
||||||
<Grid item>
|
<Grid item>
|
||||||
<Typography>
|
<Typography variant="h3">Loading Bitburner v{CONSTANTS.Version}</Typography>
|
||||||
If the game fails to load, consider <a href="?noScripts">killing all scripts</a>
|
</Grid>
|
||||||
</Typography>
|
{show && (
|
||||||
|
<Grid item>
|
||||||
|
<Typography>
|
||||||
|
If the game fails to load, consider <a href="?noScripts">killing all scripts</a>
|
||||||
|
</Typography>
|
||||||
|
</Grid>
|
||||||
|
)}
|
||||||
</Grid>
|
</Grid>
|
||||||
)}
|
)}
|
||||||
</Grid>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@ declare module "@mui/material/styles" {
|
|||||||
cha: React.CSSProperties["color"];
|
cha: React.CSSProperties["color"];
|
||||||
int: React.CSSProperties["color"];
|
int: React.CSSProperties["color"];
|
||||||
rep: React.CSSProperties["color"];
|
rep: React.CSSProperties["color"];
|
||||||
|
backgroundprimary: React.CSSProperties["color"];
|
||||||
|
backgroundsecondary: React.CSSProperties["color"];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
interface ThemeOptions {
|
interface ThemeOptions {
|
||||||
@ -26,6 +28,8 @@ declare module "@mui/material/styles" {
|
|||||||
cha: React.CSSProperties["color"];
|
cha: React.CSSProperties["color"];
|
||||||
int: React.CSSProperties["color"];
|
int: React.CSSProperties["color"];
|
||||||
rep: React.CSSProperties["color"];
|
rep: React.CSSProperties["color"];
|
||||||
|
backgroundprimary: React.CSSProperties["color"];
|
||||||
|
backgroundsecondary: React.CSSProperties["color"];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -42,6 +46,8 @@ export function refreshTheme(): void {
|
|||||||
cha: Settings.theme.cha,
|
cha: Settings.theme.cha,
|
||||||
int: Settings.theme.int,
|
int: Settings.theme.int,
|
||||||
rep: Settings.theme.rep,
|
rep: Settings.theme.rep,
|
||||||
|
backgroundprimary: Settings.theme.backgroundprimary,
|
||||||
|
backgroundsecondary: Settings.theme.backgroundsecondary,
|
||||||
},
|
},
|
||||||
palette: {
|
palette: {
|
||||||
primary: {
|
primary: {
|
||||||
@ -70,7 +76,7 @@ export function refreshTheme(): void {
|
|||||||
dark: Settings.theme.warningdark,
|
dark: Settings.theme.warningdark,
|
||||||
},
|
},
|
||||||
background: {
|
background: {
|
||||||
default: Settings.theme.black,
|
default: Settings.theme.backgroundprimary,
|
||||||
paper: Settings.theme.well,
|
paper: Settings.theme.well,
|
||||||
},
|
},
|
||||||
action: {
|
action: {
|
||||||
@ -138,7 +144,7 @@ export function refreshTheme(): void {
|
|||||||
border: "1px solid " + Settings.theme.well,
|
border: "1px solid " + Settings.theme.well,
|
||||||
// color: Settings.theme.primary,
|
// color: Settings.theme.primary,
|
||||||
"&:hover": {
|
"&:hover": {
|
||||||
backgroundColor: Settings.theme.black,
|
backgroundColor: Settings.theme.backgroundsecondary,
|
||||||
},
|
},
|
||||||
|
|
||||||
borderRadius: 0,
|
borderRadius: 0,
|
||||||
@ -189,7 +195,7 @@ export function refreshTheme(): void {
|
|||||||
MuiAccordionDetails: {
|
MuiAccordionDetails: {
|
||||||
styleOverrides: {
|
styleOverrides: {
|
||||||
root: {
|
root: {
|
||||||
backgroundColor: Settings.theme.black,
|
backgroundColor: Settings.theme.backgroundsecondary,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -231,7 +237,7 @@ export function refreshTheme(): void {
|
|||||||
display: "none",
|
display: "none",
|
||||||
},
|
},
|
||||||
scrollbarWidth: "none", // firefox
|
scrollbarWidth: "none", // firefox
|
||||||
backgroundColor: Settings.theme.black,
|
backgroundColor: Settings.theme.backgroundsecondary,
|
||||||
},
|
},
|
||||||
paperAnchorDockedLeft: {
|
paperAnchorDockedLeft: {
|
||||||
borderRight: "1px solid " + Settings.theme.welllight,
|
borderRight: "1px solid " + Settings.theme.welllight,
|
||||||
@ -266,7 +272,7 @@ export function refreshTheme(): void {
|
|||||||
styleOverrides: {
|
styleOverrides: {
|
||||||
root: {
|
root: {
|
||||||
borderRadius: 0,
|
borderRadius: 0,
|
||||||
backgroundColor: Settings.theme.black,
|
backgroundColor: Settings.theme.backgroundsecondary,
|
||||||
border: "1px solid " + Settings.theme.welllight,
|
border: "1px solid " + Settings.theme.welllight,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -229,6 +229,18 @@ export function ThemeEditorModal(props: IProps): React.ReactElement {
|
|||||||
color={customTheme["black"]}
|
color={customTheme["black"]}
|
||||||
defaultColor={defaultSettings.theme["black"]}
|
defaultColor={defaultSettings.theme["black"]}
|
||||||
/>
|
/>
|
||||||
|
<ColorEditor
|
||||||
|
name="backgroundprimary"
|
||||||
|
onColorChange={onColorChange}
|
||||||
|
color={customTheme["backgroundprimary"]}
|
||||||
|
defaultColor={defaultSettings.theme["backgroundprimary"]}
|
||||||
|
/>
|
||||||
|
<ColorEditor
|
||||||
|
name="backgroundsecondary"
|
||||||
|
onColorChange={onColorChange}
|
||||||
|
color={customTheme["backgroundsecondary"]}
|
||||||
|
defaultColor={defaultSettings.theme["backgroundsecondary"]}
|
||||||
|
/>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
<ColorEditor
|
<ColorEditor
|
||||||
|
Reference in New Issue
Block a user