mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-29 19:13:49 +01:00
Merge pull request #1612 from danielyxie/dev
background primary and secondary are different colors, fix bug with growth security
This commit is contained in:
commit
2c41877717
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,8 +89,8 @@ export function processSingleServerGrowth(server: Server, threads: number, p: IP
|
||||
if (oldMoneyAvailable !== server.moneyAvailable) {
|
||||
//Growing increases server security twice as much as hacking
|
||||
let usedCycles = numCycleForGrowth(server, server.moneyAvailable / oldMoneyAvailable, p, cores);
|
||||
usedCycles = Math.max(0, usedCycles);
|
||||
server.fortify(2 * CONSTANTS.ServerFortifyAmount * Math.ceil(usedCycles));
|
||||
usedCycles = Math.min(Math.max(0, Math.ceil(usedCycles)), threads);
|
||||
server.fortify(2 * CONSTANTS.ServerFortifyAmount * usedCycles);
|
||||
}
|
||||
return server.moneyAvailable / oldMoneyAvailable;
|
||||
}
|
||||
|
@ -135,6 +135,8 @@ interface IDefaultSettings {
|
||||
int: string;
|
||||
rep: string;
|
||||
disabled: string;
|
||||
backgroundprimary: string;
|
||||
backgroundsecondary: string;
|
||||
};
|
||||
}
|
||||
|
||||
@ -209,6 +211,8 @@ export const defaultSettings: IDefaultSettings = {
|
||||
int: "#6495ed",
|
||||
rep: "#faffdf",
|
||||
disabled: "#66cfbc",
|
||||
backgroundprimary: "#000",
|
||||
backgroundsecondary: "#000",
|
||||
},
|
||||
};
|
||||
|
||||
@ -271,11 +275,17 @@ export const Settings: ISettings & ISelfInitializer & ISelfLoading = {
|
||||
int: defaultSettings.theme.int,
|
||||
rep: defaultSettings.theme.rep,
|
||||
disabled: defaultSettings.theme.disabled,
|
||||
backgroundprimary: defaultSettings.theme.backgroundprimary,
|
||||
backgroundsecondary: defaultSettings.theme.backgroundsecondary,
|
||||
},
|
||||
init() {
|
||||
Object.assign(Settings, defaultSettings);
|
||||
},
|
||||
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 Typography from "@mui/material/Typography";
|
||||
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 { load } from "../db";
|
||||
@ -11,7 +15,16 @@ import { GameRoot } from "./GameRoot";
|
||||
|
||||
import { CONSTANTS } from "../Constants";
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) =>
|
||||
createStyles({
|
||||
root: {
|
||||
backgroundColor: theme.colors.backgroundprimary,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
export function LoadingScreen(): React.ReactElement {
|
||||
const classes = useStyles();
|
||||
const [show, setShow] = useState(false);
|
||||
const [loaded, setLoaded] = useState(false);
|
||||
|
||||
@ -38,11 +51,11 @@ export function LoadingScreen(): React.ReactElement {
|
||||
doLoad();
|
||||
}, []);
|
||||
|
||||
if (loaded) {
|
||||
return <GameRoot terminal={Terminal} engine={Engine} player={Player} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<Box className={classes.root}>
|
||||
{loaded ? (
|
||||
<GameRoot terminal={Terminal} engine={Engine} player={Player} />
|
||||
) : (
|
||||
<Grid container direction="column" justifyContent="center" alignItems="center" style={{ minHeight: "100vh" }}>
|
||||
<Grid item>
|
||||
<CircularProgress size={150} color="primary" />
|
||||
@ -58,5 +71,7 @@ export function LoadingScreen(): React.ReactElement {
|
||||
</Grid>
|
||||
)}
|
||||
</Grid>
|
||||
)}
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
@ -15,6 +15,8 @@ declare module "@mui/material/styles" {
|
||||
cha: React.CSSProperties["color"];
|
||||
int: React.CSSProperties["color"];
|
||||
rep: React.CSSProperties["color"];
|
||||
backgroundprimary: React.CSSProperties["color"];
|
||||
backgroundsecondary: React.CSSProperties["color"];
|
||||
};
|
||||
}
|
||||
interface ThemeOptions {
|
||||
@ -26,6 +28,8 @@ declare module "@mui/material/styles" {
|
||||
cha: React.CSSProperties["color"];
|
||||
int: 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,
|
||||
int: Settings.theme.int,
|
||||
rep: Settings.theme.rep,
|
||||
backgroundprimary: Settings.theme.backgroundprimary,
|
||||
backgroundsecondary: Settings.theme.backgroundsecondary,
|
||||
},
|
||||
palette: {
|
||||
primary: {
|
||||
@ -70,7 +76,7 @@ export function refreshTheme(): void {
|
||||
dark: Settings.theme.warningdark,
|
||||
},
|
||||
background: {
|
||||
default: Settings.theme.black,
|
||||
default: Settings.theme.backgroundprimary,
|
||||
paper: Settings.theme.well,
|
||||
},
|
||||
action: {
|
||||
@ -138,7 +144,7 @@ export function refreshTheme(): void {
|
||||
border: "1px solid " + Settings.theme.well,
|
||||
// color: Settings.theme.primary,
|
||||
"&:hover": {
|
||||
backgroundColor: Settings.theme.black,
|
||||
backgroundColor: Settings.theme.backgroundsecondary,
|
||||
},
|
||||
|
||||
borderRadius: 0,
|
||||
@ -189,7 +195,7 @@ export function refreshTheme(): void {
|
||||
MuiAccordionDetails: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
backgroundColor: Settings.theme.black,
|
||||
backgroundColor: Settings.theme.backgroundsecondary,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -231,7 +237,7 @@ export function refreshTheme(): void {
|
||||
display: "none",
|
||||
},
|
||||
scrollbarWidth: "none", // firefox
|
||||
backgroundColor: Settings.theme.black,
|
||||
backgroundColor: Settings.theme.backgroundsecondary,
|
||||
},
|
||||
paperAnchorDockedLeft: {
|
||||
borderRight: "1px solid " + Settings.theme.welllight,
|
||||
@ -266,7 +272,7 @@ export function refreshTheme(): void {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
borderRadius: 0,
|
||||
backgroundColor: Settings.theme.black,
|
||||
backgroundColor: Settings.theme.backgroundsecondary,
|
||||
border: "1px solid " + Settings.theme.welllight,
|
||||
},
|
||||
},
|
||||
|
@ -229,6 +229,18 @@ export function ThemeEditorModal(props: IProps): React.ReactElement {
|
||||
color={customTheme["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 />
|
||||
<ColorEditor
|
||||
|
Loading…
Reference in New Issue
Block a user