mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-27 10:03:48 +01:00
Merge pull request #1434 from danielyxie/dev
Script editor filename fix
This commit is contained in:
commit
58d969f01e
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -15,7 +15,7 @@ import { TextFile } from "../../TextFile";
|
||||
import { calculateRamUsage } from "../../Script/RamCalculations";
|
||||
import { RamCalculationErrorCode } from "../../Script/RamCalculationErrorCodes";
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
import { CursorPositions } from "../../ScriptEditor/CursorPositions";
|
||||
import { CursorPositions } from "../CursorPositions";
|
||||
import { libSource } from "../NetscriptDefinitions";
|
||||
import { NetscriptFunctions } from "../../NetscriptFunctions";
|
||||
import { WorkerScript } from "../../Netscript/WorkerScript";
|
||||
@ -201,7 +201,7 @@ export function Root(props: IProps): React.ReactElement {
|
||||
}
|
||||
|
||||
function onFilenameChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
||||
lastFilename = filename;
|
||||
lastFilename = event.target.value;
|
||||
setFilename(event.target.value);
|
||||
}
|
||||
|
||||
@ -296,8 +296,13 @@ export function Root(props: IProps): React.ReactElement {
|
||||
return (
|
||||
<>
|
||||
<Box display="flex" flexDirection="row" alignItems="center">
|
||||
<Typography>Script name: </Typography>
|
||||
<TextField type="text" tabIndex={1} value={filename} onChange={onFilenameChange} />
|
||||
<TextField
|
||||
type="text"
|
||||
tabIndex={1}
|
||||
value={filename}
|
||||
onChange={onFilenameChange}
|
||||
InputProps={{ startAdornment: <Typography>Script name: </Typography> }}
|
||||
/>
|
||||
<IconButton onClick={() => setOptionsOpen(true)}>
|
||||
<>
|
||||
<SettingsIcon />
|
@ -168,7 +168,7 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
if (flashTerminal) iTutorialNextStep();
|
||||
}
|
||||
|
||||
function clickCreateScripts(): void {
|
||||
function clickScriptEditor(): void {
|
||||
props.router.toScriptEditor();
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
clickStats();
|
||||
} else if (event.keyCode === KEY.E && event.altKey) {
|
||||
event.preventDefault();
|
||||
clickCreateScripts();
|
||||
clickScriptEditor();
|
||||
} else if (event.keyCode === KEY.S && event.altKey) {
|
||||
event.preventDefault();
|
||||
clickActiveScripts();
|
||||
@ -367,18 +367,18 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
<ListItem
|
||||
classes={{ root: classes.listitem }}
|
||||
button
|
||||
key={"Create Scripts"}
|
||||
key={"Script Editor"}
|
||||
className={clsx({
|
||||
[classes.active]: props.page === Page.CreateScript,
|
||||
[classes.active]: props.page === Page.ScriptEditor,
|
||||
})}
|
||||
onClick={clickCreateScripts}
|
||||
onClick={clickScriptEditor}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<CreateIcon color={props.page !== Page.CreateScript ? "secondary" : "primary"} />
|
||||
<CreateIcon color={props.page !== Page.ScriptEditor ? "secondary" : "primary"} />
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
<Typography color={props.page !== Page.CreateScript ? "secondary" : "primary"}>
|
||||
Create Script
|
||||
<Typography color={props.page !== Page.ScriptEditor ? "secondary" : "primary"}>
|
||||
Script Editor
|
||||
</Typography>
|
||||
</ListItemText>
|
||||
</ListItem>
|
||||
|
@ -14,7 +14,7 @@ import { CONSTANTS } from "./Constants";
|
||||
import { Factions, initFactions } from "./Faction/Factions";
|
||||
import { processPassiveFactionRepGain, inviteToFaction } from "./Faction/FactionHelpers";
|
||||
import { Router } from "./ui/GameRoot";
|
||||
import { SetupTextEditor } from "./ScriptEditor/ui/Root";
|
||||
import { SetupTextEditor } from "./ScriptEditor/ui/ScriptEditorRoot";
|
||||
|
||||
import {
|
||||
getHackingWorkRepGain,
|
||||
|
@ -50,7 +50,7 @@ import { HacknetRoot } from "../Hacknet/ui/HacknetRoot";
|
||||
import { GenericLocation } from "../Locations/ui/GenericLocation";
|
||||
import { LocationCity } from "../Locations/ui/City";
|
||||
import { ProgramsRoot } from "../Programs/ui/ProgramsRoot";
|
||||
import { Root as ScriptEditorRoot } from "../ScriptEditor/ui/Root";
|
||||
import { Root as ScriptEditorRoot } from "../ScriptEditor/ui/ScriptEditorRoot";
|
||||
import { MilestonesRoot } from "../Milestones/ui/MilestonesRoot";
|
||||
import { TerminalRoot } from "../Terminal/ui/TerminalRoot";
|
||||
import { TutorialRoot } from "../Tutorial/ui/TutorialRoot";
|
||||
@ -232,7 +232,7 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
|
||||
toScriptEditor: (fn: string, c: string) => {
|
||||
filename = fn;
|
||||
code = c;
|
||||
setPage(Page.CreateScript);
|
||||
setPage(Page.ScriptEditor);
|
||||
},
|
||||
toSleeves: () => setPage(Page.Sleeves),
|
||||
toStockMarket: () => setPage(Page.StockMarket),
|
||||
@ -303,7 +303,7 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
|
||||
<SleeveRoot />
|
||||
) : page === Page.Stats ? (
|
||||
<CharacterStats />
|
||||
) : page === Page.CreateScript ? (
|
||||
) : page === Page.ScriptEditor ? (
|
||||
<ScriptEditorRoot filename={filename} code={code} player={player} router={Router} />
|
||||
) : page === Page.ActiveScripts ? (
|
||||
<ActiveScriptsRoot workerScripts={workerScripts} />
|
||||
|
@ -78,7 +78,8 @@ export function refreshTheme(): void {
|
||||
},
|
||||
},
|
||||
typography: {
|
||||
fontFamily: "monospace",
|
||||
fontFamily:
|
||||
"Lucida Console, Lucida Sans Unicode, Fira Mono, Consolas, Courier New, Courier, monospace, Times New Roman",
|
||||
button: {
|
||||
textTransform: "none",
|
||||
},
|
||||
|
@ -13,7 +13,7 @@ export enum Page {
|
||||
City,
|
||||
Corporation,
|
||||
CreateProgram,
|
||||
CreateScript,
|
||||
ScriptEditor,
|
||||
DevMenu,
|
||||
Faction,
|
||||
Factions,
|
||||
|
Loading…
Reference in New Issue
Block a user