UI: Make minor changes in buttons and error messages of tutorial (#1837)

* UI: Make minor changes in buttons and error messages of tutorial

* Update

* Change "Skip Tutorial" to "Exit Tutorial"
This commit is contained in:
catloversg 2024-12-18 17:46:37 +07:00 committed by GitHub
parent 28da81f3f1
commit 9c4b0c004c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 17 deletions

@ -636,12 +636,14 @@ export class Terminal {
if (n00dlesServ == null) { if (n00dlesServ == null) {
throw new Error("Could not get n00dles server"); throw new Error("Could not get n00dles server");
} }
const errorMessageForBadCommand =
"Bad command. Please follow the tutorial or click 'Exit Tutorial' if you'd like to skip it.";
switch (ITutorial.currStep) { switch (ITutorial.currStep) {
case iTutorialSteps.TerminalHelp: case iTutorialSteps.TerminalHelp:
if (commandArray.length === 1 && commandArray[0] == "help") { if (commandArray.length === 1 && commandArray[0] == "help") {
iTutorialNextStep(); iTutorialNextStep();
} else { } else {
this.error("Bad command. Please follow the tutorial"); this.error(errorMessageForBadCommand);
return; return;
} }
break; break;
@ -649,7 +651,7 @@ export class Terminal {
if (commandArray.length === 1 && commandArray[0] == "ls") { if (commandArray.length === 1 && commandArray[0] == "ls") {
iTutorialNextStep(); iTutorialNextStep();
} else { } else {
this.error("Bad command. Please follow the tutorial"); this.error(errorMessageForBadCommand);
return; return;
} }
break; break;
@ -657,7 +659,7 @@ export class Terminal {
if (commandArray.length === 1 && commandArray[0] == "scan") { if (commandArray.length === 1 && commandArray[0] == "scan") {
iTutorialNextStep(); iTutorialNextStep();
} else { } else {
this.error("Bad command. Please follow the tutorial"); this.error(errorMessageForBadCommand);
return; return;
} }
break; break;
@ -665,7 +667,7 @@ export class Terminal {
if (commandArray.length == 1 && commandArray[0] == "scan-analyze") { if (commandArray.length == 1 && commandArray[0] == "scan-analyze") {
iTutorialNextStep(); iTutorialNextStep();
} else { } else {
this.error("Bad command. Please follow the tutorial"); this.error(errorMessageForBadCommand);
return; return;
} }
break; break;
@ -673,7 +675,7 @@ export class Terminal {
if (commandArray.length == 2 && commandArray[0] == "scan-analyze" && commandArray[1] === 2) { if (commandArray.length == 2 && commandArray[0] == "scan-analyze" && commandArray[1] === 2) {
iTutorialNextStep(); iTutorialNextStep();
} else { } else {
this.error("Bad command. Please follow the tutorial"); this.error(errorMessageForBadCommand);
return; return;
} }
break; break;
@ -689,7 +691,7 @@ export class Terminal {
return; return;
} }
} else { } else {
this.error("Bad command. Please follow the tutorial"); this.error(errorMessageForBadCommand);
return; return;
} }
break; break;
@ -697,7 +699,7 @@ export class Terminal {
if (commandArray.length === 1 && commandArray[0] === "analyze") { if (commandArray.length === 1 && commandArray[0] === "analyze") {
iTutorialNextStep(); iTutorialNextStep();
} else { } else {
this.error("Bad command. Please follow the tutorial"); this.error(errorMessageForBadCommand);
return; return;
} }
break; break;
@ -705,7 +707,7 @@ export class Terminal {
if (commandArray.length == 2 && commandArray[0] == "run" && commandArray[1] == "NUKE.exe") { if (commandArray.length == 2 && commandArray[0] == "run" && commandArray[1] == "NUKE.exe") {
iTutorialNextStep(); iTutorialNextStep();
} else { } else {
this.error("Bad command. Please follow the tutorial"); this.error(errorMessageForBadCommand);
return; return;
} }
break; break;
@ -713,13 +715,13 @@ export class Terminal {
if (commandArray.length == 1 && commandArray[0] == "hack") { if (commandArray.length == 1 && commandArray[0] == "hack") {
iTutorialNextStep(); iTutorialNextStep();
} else { } else {
this.error("Bad command. Please follow the tutorial"); this.error(errorMessageForBadCommand);
return; return;
} }
break; break;
case iTutorialSteps.TerminalHackingMechanics: case iTutorialSteps.TerminalHackingMechanics:
if (commandArray.length !== 1 || !["grow", "weaken", "hack"].includes(commandArray[0] + "")) { if (commandArray.length !== 1 || !["grow", "weaken", "hack"].includes(commandArray[0] + "")) {
this.error("Bad command. Please follow the tutorial"); this.error(errorMessageForBadCommand);
return; return;
} }
break; break;
@ -727,7 +729,7 @@ export class Terminal {
if (commandArray.length == 1 && commandArray[0] == "home") { if (commandArray.length == 1 && commandArray[0] == "home") {
iTutorialNextStep(); iTutorialNextStep();
} else { } else {
this.error("Bad command. Please follow the tutorial"); this.error(errorMessageForBadCommand);
return; return;
} }
break; break;
@ -739,7 +741,7 @@ export class Terminal {
) { ) {
iTutorialNextStep(); iTutorialNextStep();
} else { } else {
this.error("Bad command. Please follow the tutorial"); this.error(errorMessageForBadCommand);
return; return;
} }
break; break;
@ -747,7 +749,7 @@ export class Terminal {
if (commandArray.length == 1 && commandArray[0] == "free") { if (commandArray.length == 1 && commandArray[0] == "free") {
iTutorialNextStep(); iTutorialNextStep();
} else { } else {
this.error("Bad command. Please follow the tutorial"); this.error(errorMessageForBadCommand);
return; return;
} }
break; break;
@ -759,7 +761,7 @@ export class Terminal {
) { ) {
iTutorialNextStep(); iTutorialNextStep();
} else { } else {
this.error("Bad command. Please follow the tutorial"); this.error(errorMessageForBadCommand);
return; return;
} }
break; break;
@ -771,12 +773,12 @@ export class Terminal {
) { ) {
iTutorialNextStep(); iTutorialNextStep();
} else { } else {
this.error("Bad command. Please follow the tutorial"); this.error(errorMessageForBadCommand);
return; return;
} }
break; break;
default: default:
this.error("Please follow the tutorial, or click 'EXIT' if you'd like to skip it"); this.error("Please follow the tutorial or click 'Exit Tutorial' if you'd like to skip it");
return; return;
} }
} }

@ -60,6 +60,9 @@ export function InteractiveTutorialRoot(): React.ReactElement {
This tutorial will show you the basics of the game. You may skip the tutorial at any time. This tutorial will show you the basics of the game. You may skip the tutorial at any time.
<br /> <br />
<br /> <br />
You can replay this tutorial by going to the Options tab and pressing "Reset tutorial".
<br />
<br />
You can also collapse this panel to temporarily hide this tutorial. You can also collapse this panel to temporarily hide this tutorial.
</Typography> </Typography>
</> </>
@ -593,7 +596,7 @@ export async function main(ns) {
<br /> <br />
<br /> <br />
<Button onClick={iTutorialEnd}> <Button onClick={iTutorialEnd}>
{step !== iTutorialSteps.DocumentationPageInfo ? "SKIP TUTORIAL" : "FINISH TUTORIAL"} {step !== iTutorialSteps.DocumentationPageInfo ? "Exit Tutorial" : "Finish Tutorial"}
</Button> </Button>
</Paper> </Paper>
</> </>