mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 12:15:44 +01:00
Refactored code that initializes main menu buttons/header/panels
This commit is contained in:
parent
9b96e2537d
commit
78ca383ee2
113
dist/bundle.js
vendored
113
dist/bundle.js
vendored
@ -4341,6 +4341,53 @@ let Engine = {
|
|||||||
document.getElementById("entire-game-container").style.visibility = "visible";
|
document.getElementById("entire-game-container").style.visibility = "visible";
|
||||||
},
|
},
|
||||||
|
|
||||||
|
//Used when initializing a game
|
||||||
|
//elems should be an array of all DOM elements under the header
|
||||||
|
closeMainMenuHeader: function(elems) {
|
||||||
|
for (var i = 0; i < elems.length; ++i) {
|
||||||
|
elems[i].style.maxHeight = null;
|
||||||
|
elems[i].style.opacity = 0;
|
||||||
|
elems[i].style.pointerEvents = "none";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
//Used when initializing the game
|
||||||
|
//elems should be an array of all DOM elements under the header
|
||||||
|
openMainMenuHeader: function(elems) {
|
||||||
|
for (var i = 0; i < elems.length; ++i) {
|
||||||
|
elems[i].style.maxHeight = elems[i].scrollHeight + "px";
|
||||||
|
elems[i].style.display = "block";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
//Used in game when clicking on a main menu header (NOT FOR INITIALIZATION)
|
||||||
|
//open is a boolean specifying whether its being opened or closed
|
||||||
|
//elems is an array of DOM elements for main menu tabs (li)
|
||||||
|
//links is an array of DOM elements for main menu links (a)
|
||||||
|
toggleMainMenuHeader: function(open, elems, links) {
|
||||||
|
for (var i = 0; i < elems.length; ++i) {
|
||||||
|
if (open) {
|
||||||
|
elems[i].style.opacity = 1;
|
||||||
|
elems[i].style.maxHeight = elems[i].scrollHeight + "px";
|
||||||
|
} else {
|
||||||
|
elems[i].style.opacity = 0;
|
||||||
|
elems[i].style.maxHeight = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < links.length; ++i) {
|
||||||
|
if (open) {
|
||||||
|
links[i].style.opacity = 1;
|
||||||
|
links[i].style.maxHeight = links[i].scrollHeight + "px";
|
||||||
|
links[i].style.pointerEvents = "auto";
|
||||||
|
} else {
|
||||||
|
links[i].style.opacity = 0;
|
||||||
|
links[i].style.maxHeight = null;
|
||||||
|
links[i].style.pointerEvents = "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
load: function() {
|
load: function() {
|
||||||
//Load script editor
|
//Load script editor
|
||||||
var editor = ace.edit('javascript-editor');
|
var editor = ace.edit('javascript-editor');
|
||||||
@ -4431,6 +4478,12 @@ let Engine = {
|
|||||||
Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineProductionFromScripts, 2) + " and your Hacknet Nodes generated $" +
|
Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineProductionFromScripts, 2) + " and your Hacknet Nodes generated $" +
|
||||||
Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineProductionFromHacknetNodes, 2));
|
Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineProductionFromHacknetNodes, 2));
|
||||||
//Close main menu accordions for loaded game
|
//Close main menu accordions for loaded game
|
||||||
|
Engine.closeMainMenuHeader(
|
||||||
|
[terminal, createScript, activeScripts, createProgram, stats,
|
||||||
|
factions, augmentations, hacknetnodes, city, travel, job,
|
||||||
|
tutorial, options]
|
||||||
|
);
|
||||||
|
/*
|
||||||
terminal.style.maxHeight = null;
|
terminal.style.maxHeight = null;
|
||||||
terminal.style.opacity = 0;
|
terminal.style.opacity = 0;
|
||||||
terminal.style.pointerEvents = "none";
|
terminal.style.pointerEvents = "none";
|
||||||
@ -4470,6 +4523,7 @@ let Engine = {
|
|||||||
options.style.maxHeight = null;
|
options.style.maxHeight = null;
|
||||||
options.style.opacity = 0;
|
options.style.opacity = 0;
|
||||||
options.style.pointerEvents = "none";
|
options.style.pointerEvents = "none";
|
||||||
|
*/
|
||||||
} else {
|
} else {
|
||||||
//No save found, start new game
|
//No save found, start new game
|
||||||
console.log("Initializing new game");
|
console.log("Initializing new game");
|
||||||
@ -4500,6 +4554,12 @@ let Engine = {
|
|||||||
worldHdr.classList.toggle("opened");
|
worldHdr.classList.toggle("opened");
|
||||||
var helpHdr = document.getElementById("help-menu-header");
|
var helpHdr = document.getElementById("help-menu-header");
|
||||||
helpHdr.classList.toggle("opened");
|
helpHdr.classList.toggle("opened");
|
||||||
|
Engine.openMainMenuHeader(
|
||||||
|
[terminal, createScript, activeScripts, createProgram, stats,
|
||||||
|
factions, augmentations, hacknetnodes, city, travel, job,
|
||||||
|
tutorial, options]
|
||||||
|
);
|
||||||
|
/*
|
||||||
terminal.style.maxHeight = terminal.scrollHeight + "px";
|
terminal.style.maxHeight = terminal.scrollHeight + "px";
|
||||||
terminal.style.display = "block";
|
terminal.style.display = "block";
|
||||||
createScript.style.maxHeight = createScript.scrollHeight + "px";
|
createScript.style.maxHeight = createScript.scrollHeight + "px";
|
||||||
@ -4526,6 +4586,7 @@ let Engine = {
|
|||||||
tutorial.style.display = "block";
|
tutorial.style.display = "block";
|
||||||
options.style.maxHeight = options.scrollHeight + "px";
|
options.style.maxHeight = options.scrollHeight + "px";
|
||||||
options.style.display = "block";
|
options.style.display = "block";
|
||||||
|
*/
|
||||||
|
|
||||||
//Start interactive tutorial
|
//Start interactive tutorial
|
||||||
Object(__WEBPACK_IMPORTED_MODULE_16__InteractiveTutorial_js__["d" /* iTutorialStart */])();
|
Object(__WEBPACK_IMPORTED_MODULE_16__InteractiveTutorial_js__["d" /* iTutorialStart */])();
|
||||||
@ -4673,13 +4734,9 @@ let Engine = {
|
|||||||
|
|
||||||
//Main menu accordions
|
//Main menu accordions
|
||||||
var hackingHdr = document.getElementById("hacking-menu-header");
|
var hackingHdr = document.getElementById("hacking-menu-header");
|
||||||
//hackingHdr.classList.toggle("opened");
|
|
||||||
var characterHdr = document.getElementById("character-menu-header");
|
var characterHdr = document.getElementById("character-menu-header");
|
||||||
//characterHdr.classList.toggle("opened");
|
|
||||||
var worldHdr = document.getElementById("world-menu-header");
|
var worldHdr = document.getElementById("world-menu-header");
|
||||||
//worldHdr.classList.toggle("opened");
|
|
||||||
var helpHdr = document.getElementById("help-menu-header");
|
var helpHdr = document.getElementById("help-menu-header");
|
||||||
//helpHdr.classList.toggle("opened");
|
|
||||||
|
|
||||||
hackingHdr.onclick = function() {
|
hackingHdr.onclick = function() {
|
||||||
var terminal = document.getElementById("terminal-tab");
|
var terminal = document.getElementById("terminal-tab");
|
||||||
@ -4693,6 +4750,11 @@ let Engine = {
|
|||||||
var createProgramNot = document.getElementById("create-program-notification");
|
var createProgramNot = document.getElementById("create-program-notification");
|
||||||
this.classList.toggle("opened");
|
this.classList.toggle("opened");
|
||||||
if (terminal.style.maxHeight) {
|
if (terminal.style.maxHeight) {
|
||||||
|
Engine.toggleMainMenuHeader(false,
|
||||||
|
[terminal, createScript, activeScripts, createProgram],
|
||||||
|
[terminalLink, createScriptLink, activeScriptsLink, createProgramLink]
|
||||||
|
);
|
||||||
|
/*
|
||||||
terminal.style.opacity = 0;
|
terminal.style.opacity = 0;
|
||||||
terminal.style.maxHeight = null;
|
terminal.style.maxHeight = null;
|
||||||
terminalLink.style.opacity = 0;
|
terminalLink.style.opacity = 0;
|
||||||
@ -4716,9 +4778,15 @@ let Engine = {
|
|||||||
createProgramLink.style.opacity = 0;
|
createProgramLink.style.opacity = 0;
|
||||||
createProgramLink.style.maxHeight = null;
|
createProgramLink.style.maxHeight = null;
|
||||||
createProgramLink.style.pointerEvents = "none";
|
createProgramLink.style.pointerEvents = "none";
|
||||||
|
*/
|
||||||
|
|
||||||
createProgramNot.style.display = "none";
|
createProgramNot.style.display = "none";
|
||||||
} else {
|
} else {
|
||||||
|
Engine.toggleMainMenuHeader(true,
|
||||||
|
[terminal, createScript, activeScripts, createProgram],
|
||||||
|
[terminalLink, createScriptLink, activeScriptsLink, createProgramLink]
|
||||||
|
);
|
||||||
|
/*
|
||||||
terminal.style.maxHeight = terminal.scrollHeight + "px";
|
terminal.style.maxHeight = terminal.scrollHeight + "px";
|
||||||
terminal.style.opacity = 1;
|
terminal.style.opacity = 1;
|
||||||
terminalLink.style.maxHeight = terminalLink.scrollHeight + "px";
|
terminalLink.style.maxHeight = terminalLink.scrollHeight + "px";
|
||||||
@ -4742,6 +4810,7 @@ let Engine = {
|
|||||||
createProgramLink.style.maxHeight = createProgramLink.scrollHeight + "px";
|
createProgramLink.style.maxHeight = createProgramLink.scrollHeight + "px";
|
||||||
createProgramLink.style.opacity = 1;
|
createProgramLink.style.opacity = 1;
|
||||||
createProgramLink.style.pointerEvents = "auto";
|
createProgramLink.style.pointerEvents = "auto";
|
||||||
|
*/
|
||||||
createProgramNot.style.display = "block"
|
createProgramNot.style.display = "block"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4757,6 +4826,11 @@ let Engine = {
|
|||||||
var hacknetnodesLink = document.getElementById("hacknet-nodes-menu-link");
|
var hacknetnodesLink = document.getElementById("hacknet-nodes-menu-link");
|
||||||
this.classList.toggle("opened");
|
this.classList.toggle("opened");
|
||||||
if (stats.style.maxHeight) {
|
if (stats.style.maxHeight) {
|
||||||
|
Engine.toggleMainMenuHeader(false,
|
||||||
|
[stats, factions, augmentations, hacknetnodes],
|
||||||
|
[statsLink, factionsLink, augmentationsLink, hacknetnodesLink]
|
||||||
|
);
|
||||||
|
/*
|
||||||
stats.style.opacity = 0;
|
stats.style.opacity = 0;
|
||||||
stats.style.maxHeight = null;
|
stats.style.maxHeight = null;
|
||||||
statsLink.style.opacity = 0;
|
statsLink.style.opacity = 0;
|
||||||
@ -4780,7 +4854,13 @@ let Engine = {
|
|||||||
hacknetnodesLink.style.opacity = 0;
|
hacknetnodesLink.style.opacity = 0;
|
||||||
hacknetnodesLink.style.maxHeight = null;
|
hacknetnodesLink.style.maxHeight = null;
|
||||||
hacknetnodesLink.style.pointerEvents = "none";
|
hacknetnodesLink.style.pointerEvents = "none";
|
||||||
|
*/
|
||||||
} else {
|
} else {
|
||||||
|
Engine.toggleMainMenuHeader(true,
|
||||||
|
[stats, factions, augmentations, hacknetnodes],
|
||||||
|
[statsLink, factionsLink, augmentationsLink, hacknetnodesLink]
|
||||||
|
);
|
||||||
|
/*
|
||||||
stats.style.maxHeight = stats.scrollHeight + "px";
|
stats.style.maxHeight = stats.scrollHeight + "px";
|
||||||
stats.style.opacity = 1;
|
stats.style.opacity = 1;
|
||||||
statsLink.style.maxHeight = statsLink.scrollHeight + "px";
|
statsLink.style.maxHeight = statsLink.scrollHeight + "px";
|
||||||
@ -4804,6 +4884,7 @@ let Engine = {
|
|||||||
hacknetnodesLink.style.maxHeight = hacknetnodesLink.scrollHeight + "px";
|
hacknetnodesLink.style.maxHeight = hacknetnodesLink.scrollHeight + "px";
|
||||||
hacknetnodesLink.style.opacity = 1;
|
hacknetnodesLink.style.opacity = 1;
|
||||||
hacknetnodesLink.style.pointerEvents = "auto";
|
hacknetnodesLink.style.pointerEvents = "auto";
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4816,6 +4897,11 @@ let Engine = {
|
|||||||
var jobLink = document.getElementById("job-menu-link");
|
var jobLink = document.getElementById("job-menu-link");
|
||||||
this.classList.toggle("opened");
|
this.classList.toggle("opened");
|
||||||
if (city.style.maxHeight) {
|
if (city.style.maxHeight) {
|
||||||
|
Engine.toggleMainMenuHeader(false,
|
||||||
|
[city, travel, job],
|
||||||
|
[cityLink, travelLink, jobLink]
|
||||||
|
);
|
||||||
|
/*
|
||||||
city.style.opacity = 0;
|
city.style.opacity = 0;
|
||||||
city.style.maxHeight = null;
|
city.style.maxHeight = null;
|
||||||
cityLink.style.opacity = 0;
|
cityLink.style.opacity = 0;
|
||||||
@ -4833,7 +4919,13 @@ let Engine = {
|
|||||||
jobLink.style.opacity = 0;
|
jobLink.style.opacity = 0;
|
||||||
jobLink.style.maxHeight = null;
|
jobLink.style.maxHeight = null;
|
||||||
jobLink.style.pointerEvents = "none";
|
jobLink.style.pointerEvents = "none";
|
||||||
|
*/
|
||||||
} else {
|
} else {
|
||||||
|
Engine.toggleMainMenuHeader(true,
|
||||||
|
[city, travel, job],
|
||||||
|
[cityLink, travelLink, jobLink]
|
||||||
|
);
|
||||||
|
/*
|
||||||
city.style.maxHeight = city.scrollHeight + "px";
|
city.style.maxHeight = city.scrollHeight + "px";
|
||||||
city.style.opacity = 1;
|
city.style.opacity = 1;
|
||||||
cityLink.style.maxHeight = cityLink.scrollHeight + "px";
|
cityLink.style.maxHeight = cityLink.scrollHeight + "px";
|
||||||
@ -4851,6 +4943,7 @@ let Engine = {
|
|||||||
jobLink.style.maxHeight = jobLink.scrollHeight + "px";
|
jobLink.style.maxHeight = jobLink.scrollHeight + "px";
|
||||||
jobLink.style.opacity = 1;
|
jobLink.style.opacity = 1;
|
||||||
jobLink.style.pointerEvents = "auto";
|
jobLink.style.pointerEvents = "auto";
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4861,6 +4954,11 @@ let Engine = {
|
|||||||
var optionsLink = document.getElementById("options-menu-link");
|
var optionsLink = document.getElementById("options-menu-link");
|
||||||
this.classList.toggle("opened");
|
this.classList.toggle("opened");
|
||||||
if (tutorial.style.maxHeight) {
|
if (tutorial.style.maxHeight) {
|
||||||
|
Engine.toggleMainMenuHeader(false,
|
||||||
|
[tutorial, options],
|
||||||
|
[tutorialLink, optionsLink]
|
||||||
|
);
|
||||||
|
/*
|
||||||
tutorial.style.opacity = 0;
|
tutorial.style.opacity = 0;
|
||||||
tutorial.style.maxHeight = null;
|
tutorial.style.maxHeight = null;
|
||||||
tutorialLink.style.opacity = 0;
|
tutorialLink.style.opacity = 0;
|
||||||
@ -4872,7 +4970,13 @@ let Engine = {
|
|||||||
optionsLink.style.opacity = 0;
|
optionsLink.style.opacity = 0;
|
||||||
optionsLink.style.maxHeight = null;
|
optionsLink.style.maxHeight = null;
|
||||||
optionsLink.style.pointerEvents = "none";
|
optionsLink.style.pointerEvents = "none";
|
||||||
|
*/
|
||||||
} else {
|
} else {
|
||||||
|
Engine.toggleMainMenuHeader(true,
|
||||||
|
[tutorial, options],
|
||||||
|
[tutorialLink, optionsLink]
|
||||||
|
);
|
||||||
|
/*
|
||||||
tutorial.style.maxHeight = tutorial.scrollHeight + "px";
|
tutorial.style.maxHeight = tutorial.scrollHeight + "px";
|
||||||
tutorial.style.opacity = 1;
|
tutorial.style.opacity = 1;
|
||||||
tutorialLink.style.maxHeight = tutorialLink.scrollHeight + "px";
|
tutorialLink.style.maxHeight = tutorialLink.scrollHeight + "px";
|
||||||
@ -4884,6 +4988,7 @@ let Engine = {
|
|||||||
optionsLink.style.maxHeight = optionsLink.scrollHeight + "px";
|
optionsLink.style.maxHeight = optionsLink.scrollHeight + "px";
|
||||||
optionsLink.style.opacity = 1;
|
optionsLink.style.opacity = 1;
|
||||||
optionsLink.style.pointerEvents = "auto";
|
optionsLink.style.pointerEvents = "auto";
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
305
src/engine.js
305
src/engine.js
@ -1018,6 +1018,53 @@ let Engine = {
|
|||||||
document.getElementById("entire-game-container").style.visibility = "visible";
|
document.getElementById("entire-game-container").style.visibility = "visible";
|
||||||
},
|
},
|
||||||
|
|
||||||
|
//Used when initializing a game
|
||||||
|
//elems should be an array of all DOM elements under the header
|
||||||
|
closeMainMenuHeader: function(elems) {
|
||||||
|
for (var i = 0; i < elems.length; ++i) {
|
||||||
|
elems[i].style.maxHeight = null;
|
||||||
|
elems[i].style.opacity = 0;
|
||||||
|
elems[i].style.pointerEvents = "none";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
//Used when initializing the game
|
||||||
|
//elems should be an array of all DOM elements under the header
|
||||||
|
openMainMenuHeader: function(elems) {
|
||||||
|
for (var i = 0; i < elems.length; ++i) {
|
||||||
|
elems[i].style.maxHeight = elems[i].scrollHeight + "px";
|
||||||
|
elems[i].style.display = "block";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
//Used in game when clicking on a main menu header (NOT FOR INITIALIZATION)
|
||||||
|
//open is a boolean specifying whether its being opened or closed
|
||||||
|
//elems is an array of DOM elements for main menu tabs (li)
|
||||||
|
//links is an array of DOM elements for main menu links (a)
|
||||||
|
toggleMainMenuHeader: function(open, elems, links) {
|
||||||
|
for (var i = 0; i < elems.length; ++i) {
|
||||||
|
if (open) {
|
||||||
|
elems[i].style.opacity = 1;
|
||||||
|
elems[i].style.maxHeight = elems[i].scrollHeight + "px";
|
||||||
|
} else {
|
||||||
|
elems[i].style.opacity = 0;
|
||||||
|
elems[i].style.maxHeight = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < links.length; ++i) {
|
||||||
|
if (open) {
|
||||||
|
links[i].style.opacity = 1;
|
||||||
|
links[i].style.maxHeight = links[i].scrollHeight + "px";
|
||||||
|
links[i].style.pointerEvents = "auto";
|
||||||
|
} else {
|
||||||
|
links[i].style.opacity = 0;
|
||||||
|
links[i].style.maxHeight = null;
|
||||||
|
links[i].style.pointerEvents = "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
load: function() {
|
load: function() {
|
||||||
//Load script editor
|
//Load script editor
|
||||||
var editor = ace.edit('javascript-editor');
|
var editor = ace.edit('javascript-editor');
|
||||||
@ -1108,45 +1155,11 @@ let Engine = {
|
|||||||
formatNumber(offlineProductionFromScripts, 2) + " and your Hacknet Nodes generated $" +
|
formatNumber(offlineProductionFromScripts, 2) + " and your Hacknet Nodes generated $" +
|
||||||
formatNumber(offlineProductionFromHacknetNodes, 2));
|
formatNumber(offlineProductionFromHacknetNodes, 2));
|
||||||
//Close main menu accordions for loaded game
|
//Close main menu accordions for loaded game
|
||||||
terminal.style.maxHeight = null;
|
Engine.closeMainMenuHeader(
|
||||||
terminal.style.opacity = 0;
|
[terminal, createScript, activeScripts, createProgram, stats,
|
||||||
terminal.style.pointerEvents = "none";
|
factions, augmentations, hacknetnodes, city, travel, job,
|
||||||
createScript.style.maxHeight = null;
|
tutorial, options]
|
||||||
createScript.style.opacity = 0;
|
);
|
||||||
createScript.style.pointerEvents = "none";
|
|
||||||
activeScripts.style.maxHeight = null;
|
|
||||||
activeScripts.style.opacity = 0;
|
|
||||||
activeScripts.style.pointerEvents = "none";
|
|
||||||
createProgram.style.maxHeight = null;
|
|
||||||
createProgram.style.opacity = 0;
|
|
||||||
createProgram.style.pointerEvents = "none";
|
|
||||||
stats.style.maxHeight = null;
|
|
||||||
stats.style.opacity = 0;
|
|
||||||
stats.style.pointerEvents = "none";
|
|
||||||
factions.style.maxHeight = null;
|
|
||||||
factions.style.opacity = 0;
|
|
||||||
factions.style.pointerEvents = "none";
|
|
||||||
augmentations.style.maxHeight = null;
|
|
||||||
augmentations.style.opacity = 0;
|
|
||||||
augmentations.style.pointerEvents = "none";
|
|
||||||
hacknetnodes.style.maxHeight = null;
|
|
||||||
hacknetnodes.style.opacity = 0;
|
|
||||||
hacknetnodes.style.pointerEvents = "none";
|
|
||||||
city.style.maxHeight = null;
|
|
||||||
city.style.opacity = 0;
|
|
||||||
city.style.pointerEvents = "none";
|
|
||||||
travel.style.maxHeight = null;
|
|
||||||
travel.style.opacity = 0;
|
|
||||||
travel.style.pointerEvents = "none";
|
|
||||||
job.style.maxHeight = null;
|
|
||||||
job.style.opacity = 0;
|
|
||||||
job.style.pointerEvents = "none";
|
|
||||||
tutorial.style.maxHeight = null;
|
|
||||||
tutorial.style.opacity = 0;
|
|
||||||
tutorial.style.pointerEvents = "none";
|
|
||||||
options.style.maxHeight = null;
|
|
||||||
options.style.opacity = 0;
|
|
||||||
options.style.pointerEvents = "none";
|
|
||||||
} else {
|
} else {
|
||||||
//No save found, start new game
|
//No save found, start new game
|
||||||
console.log("Initializing new game");
|
console.log("Initializing new game");
|
||||||
@ -1177,32 +1190,11 @@ let Engine = {
|
|||||||
worldHdr.classList.toggle("opened");
|
worldHdr.classList.toggle("opened");
|
||||||
var helpHdr = document.getElementById("help-menu-header");
|
var helpHdr = document.getElementById("help-menu-header");
|
||||||
helpHdr.classList.toggle("opened");
|
helpHdr.classList.toggle("opened");
|
||||||
terminal.style.maxHeight = terminal.scrollHeight + "px";
|
Engine.openMainMenuHeader(
|
||||||
terminal.style.display = "block";
|
[terminal, createScript, activeScripts, createProgram, stats,
|
||||||
createScript.style.maxHeight = createScript.scrollHeight + "px";
|
factions, augmentations, hacknetnodes, city, travel, job,
|
||||||
createScript.style.display = "block";
|
tutorial, options]
|
||||||
activeScripts.style.maxHeight = activeScripts.scrollHeight + "px";
|
);
|
||||||
activeScripts.style.display = "block";
|
|
||||||
createProgram.style.maxHeight = createProgram.scrollHeight + "px";
|
|
||||||
createProgram.style.display = "block";
|
|
||||||
stats.style.maxHeight = stats.scrollHeight + "px";
|
|
||||||
stats.style.display = "block";
|
|
||||||
factions.style.maxHeight = factions.scrollHeight + "px";
|
|
||||||
factions.style.display = "block";
|
|
||||||
augmentations.style.maxHeight = augmentations.scrollHeight + "px";
|
|
||||||
augmentations.style.display = "block";
|
|
||||||
hacknetnodes.style.maxHeight = hacknetnodes.scrollHeight + "px";
|
|
||||||
hacknetnodes.style.display = "block";
|
|
||||||
city.style.maxHeight = city.scrollHeight + "px";
|
|
||||||
city.style.display = "block";
|
|
||||||
travel.style.maxHeight = travel.scrollHeight + "px";
|
|
||||||
travel.style.display = "block";
|
|
||||||
job.style.maxHeight = job.scrollHeight + "px";
|
|
||||||
job.style.display = "block";
|
|
||||||
tutorial.style.maxHeight = tutorial.scrollHeight + "px";
|
|
||||||
tutorial.style.display = "block";
|
|
||||||
options.style.maxHeight = options.scrollHeight + "px";
|
|
||||||
options.style.display = "block";
|
|
||||||
|
|
||||||
//Start interactive tutorial
|
//Start interactive tutorial
|
||||||
iTutorialStart();
|
iTutorialStart();
|
||||||
@ -1350,13 +1342,9 @@ let Engine = {
|
|||||||
|
|
||||||
//Main menu accordions
|
//Main menu accordions
|
||||||
var hackingHdr = document.getElementById("hacking-menu-header");
|
var hackingHdr = document.getElementById("hacking-menu-header");
|
||||||
//hackingHdr.classList.toggle("opened");
|
|
||||||
var characterHdr = document.getElementById("character-menu-header");
|
var characterHdr = document.getElementById("character-menu-header");
|
||||||
//characterHdr.classList.toggle("opened");
|
|
||||||
var worldHdr = document.getElementById("world-menu-header");
|
var worldHdr = document.getElementById("world-menu-header");
|
||||||
//worldHdr.classList.toggle("opened");
|
|
||||||
var helpHdr = document.getElementById("help-menu-header");
|
var helpHdr = document.getElementById("help-menu-header");
|
||||||
//helpHdr.classList.toggle("opened");
|
|
||||||
|
|
||||||
hackingHdr.onclick = function() {
|
hackingHdr.onclick = function() {
|
||||||
var terminal = document.getElementById("terminal-tab");
|
var terminal = document.getElementById("terminal-tab");
|
||||||
@ -1370,55 +1358,18 @@ let Engine = {
|
|||||||
var createProgramNot = document.getElementById("create-program-notification");
|
var createProgramNot = document.getElementById("create-program-notification");
|
||||||
this.classList.toggle("opened");
|
this.classList.toggle("opened");
|
||||||
if (terminal.style.maxHeight) {
|
if (terminal.style.maxHeight) {
|
||||||
terminal.style.opacity = 0;
|
Engine.toggleMainMenuHeader(false,
|
||||||
terminal.style.maxHeight = null;
|
[terminal, createScript, activeScripts, createProgram],
|
||||||
terminalLink.style.opacity = 0;
|
[terminalLink, createScriptLink, activeScriptsLink, createProgramLink]
|
||||||
terminalLink.style.maxHeight = null;
|
);
|
||||||
terminalLink.style.pointerEvents = "none";
|
|
||||||
|
|
||||||
createScript.style.opacity = 0;
|
|
||||||
createScript.style.maxHeight = null;
|
|
||||||
createScriptLink.style.opacity = 0;
|
|
||||||
createScriptLink.style.maxHeight = null;
|
|
||||||
createScriptLink.style.pointerEvents = "none";
|
|
||||||
|
|
||||||
activeScripts.style.opacity = 0;
|
|
||||||
activeScripts.style.maxHeight = null;
|
|
||||||
activeScriptsLink.style.opacity = 0;
|
|
||||||
activeScriptsLink.style.maxHeight = null;
|
|
||||||
activeScriptsLink.style.pointerEvents = "none";
|
|
||||||
|
|
||||||
createProgram.style.opacity = 0;
|
|
||||||
createProgram.style.maxHeight = null;
|
|
||||||
createProgramLink.style.opacity = 0;
|
|
||||||
createProgramLink.style.maxHeight = null;
|
|
||||||
createProgramLink.style.pointerEvents = "none";
|
|
||||||
|
|
||||||
createProgramNot.style.display = "none";
|
createProgramNot.style.display = "none";
|
||||||
} else {
|
} else {
|
||||||
terminal.style.maxHeight = terminal.scrollHeight + "px";
|
Engine.toggleMainMenuHeader(true,
|
||||||
terminal.style.opacity = 1;
|
[terminal, createScript, activeScripts, createProgram],
|
||||||
terminalLink.style.maxHeight = terminalLink.scrollHeight + "px";
|
[terminalLink, createScriptLink, activeScriptsLink, createProgramLink]
|
||||||
terminalLink.style.opacity = 1;
|
);
|
||||||
terminalLink.style.pointerEvents = "auto";
|
|
||||||
|
|
||||||
createScript.style.maxHeight = createScript.scrollHeight + "px";
|
|
||||||
createScript.style.opacity = 1;
|
|
||||||
createScriptLink.style.maxHeight = createScriptLink.scrollHeight + "px";
|
|
||||||
createScriptLink.style.opacity = 1;
|
|
||||||
createScriptLink.style.pointerEvents = "auto";
|
|
||||||
|
|
||||||
activeScripts.style.maxHeight = activeScripts.scrollHeight + "px";
|
|
||||||
activeScripts.style.opacity = 1;
|
|
||||||
activeScriptsLink.style.maxHeight = activeScriptsLink.scrollHeight + "px";
|
|
||||||
activeScriptsLink.style.opacity = 1;
|
|
||||||
activeScriptsLink.style.pointerEvents = "auto";
|
|
||||||
|
|
||||||
createProgram.style.maxHeight = createProgram.scrollHeight + "px";
|
|
||||||
createProgram.style.opacity = 1;
|
|
||||||
createProgramLink.style.maxHeight = createProgramLink.scrollHeight + "px";
|
|
||||||
createProgramLink.style.opacity = 1;
|
|
||||||
createProgramLink.style.pointerEvents = "auto";
|
|
||||||
createProgramNot.style.display = "block"
|
createProgramNot.style.display = "block"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1434,53 +1385,15 @@ let Engine = {
|
|||||||
var hacknetnodesLink = document.getElementById("hacknet-nodes-menu-link");
|
var hacknetnodesLink = document.getElementById("hacknet-nodes-menu-link");
|
||||||
this.classList.toggle("opened");
|
this.classList.toggle("opened");
|
||||||
if (stats.style.maxHeight) {
|
if (stats.style.maxHeight) {
|
||||||
stats.style.opacity = 0;
|
Engine.toggleMainMenuHeader(false,
|
||||||
stats.style.maxHeight = null;
|
[stats, factions, augmentations, hacknetnodes],
|
||||||
statsLink.style.opacity = 0;
|
[statsLink, factionsLink, augmentationsLink, hacknetnodesLink]
|
||||||
statsLink.style.maxHeight = null;
|
);
|
||||||
statsLink.style.pointerEvents = "none";
|
|
||||||
|
|
||||||
factions.style.opacity = 0;
|
|
||||||
factions.style.maxHeight = null;
|
|
||||||
factionsLink.style.opacity = 0;
|
|
||||||
factionsLink.style.maxHeight = null;
|
|
||||||
factionsLink.style.pointerEvents = "none";
|
|
||||||
|
|
||||||
augmentations.style.opacity = 0;
|
|
||||||
augmentations.style.maxHeight = null;
|
|
||||||
augmentationsLink.style.opacity = 0;
|
|
||||||
augmentationsLink.style.maxHeight = null;
|
|
||||||
augmentationsLink.style.pointerEvents = "none";
|
|
||||||
|
|
||||||
hacknetnodes.style.opacity = 0;
|
|
||||||
hacknetnodes.style.maxHeight = null;
|
|
||||||
hacknetnodesLink.style.opacity = 0;
|
|
||||||
hacknetnodesLink.style.maxHeight = null;
|
|
||||||
hacknetnodesLink.style.pointerEvents = "none";
|
|
||||||
} else {
|
} else {
|
||||||
stats.style.maxHeight = stats.scrollHeight + "px";
|
Engine.toggleMainMenuHeader(true,
|
||||||
stats.style.opacity = 1;
|
[stats, factions, augmentations, hacknetnodes],
|
||||||
statsLink.style.maxHeight = statsLink.scrollHeight + "px";
|
[statsLink, factionsLink, augmentationsLink, hacknetnodesLink]
|
||||||
statsLink.style.opacity = 1;
|
);
|
||||||
statsLink.style.pointerEvents = "auto";
|
|
||||||
|
|
||||||
factions.style.maxHeight = factions.scrollHeight + "px";
|
|
||||||
factions.style.opacity = 1;
|
|
||||||
factionsLink.style.maxHeight = factionsLink.scrollHeight + "px";
|
|
||||||
factionsLink.style.opacity = 1;
|
|
||||||
factionsLink.style.pointerEvents = "auto";
|
|
||||||
|
|
||||||
augmentations.style.maxHeight = augmentations.scrollHeight + "px";
|
|
||||||
augmentations.style.opacity = 1;
|
|
||||||
augmentationsLink.style.maxHeight = augmentationsLink.scrollHeight + "px";
|
|
||||||
augmentationsLink.style.opacity = 1;
|
|
||||||
augmentationsLink.style.pointerEvents = "auto";
|
|
||||||
|
|
||||||
hacknetnodes.style.maxHeight = hacknetnodes.scrollHeight + "px";
|
|
||||||
hacknetnodes.style.opacity = 1;
|
|
||||||
hacknetnodesLink.style.maxHeight = hacknetnodesLink.scrollHeight + "px";
|
|
||||||
hacknetnodesLink.style.opacity = 1;
|
|
||||||
hacknetnodesLink.style.pointerEvents = "auto";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1493,41 +1406,15 @@ let Engine = {
|
|||||||
var jobLink = document.getElementById("job-menu-link");
|
var jobLink = document.getElementById("job-menu-link");
|
||||||
this.classList.toggle("opened");
|
this.classList.toggle("opened");
|
||||||
if (city.style.maxHeight) {
|
if (city.style.maxHeight) {
|
||||||
city.style.opacity = 0;
|
Engine.toggleMainMenuHeader(false,
|
||||||
city.style.maxHeight = null;
|
[city, travel, job],
|
||||||
cityLink.style.opacity = 0;
|
[cityLink, travelLink, jobLink]
|
||||||
cityLink.style.maxHeight = null;
|
);
|
||||||
cityLink.style.pointerEvents = "none";
|
|
||||||
|
|
||||||
travel.style.opacity = 0;
|
|
||||||
travel.style.maxHeight = null;
|
|
||||||
travelLink.style.opacity = 0;
|
|
||||||
travelLink.style.maxHeight = null;
|
|
||||||
travelLink.style.pointerEvents = "none";
|
|
||||||
|
|
||||||
job.style.opacity = 0;
|
|
||||||
job.style.maxHeight = null;
|
|
||||||
jobLink.style.opacity = 0;
|
|
||||||
jobLink.style.maxHeight = null;
|
|
||||||
jobLink.style.pointerEvents = "none";
|
|
||||||
} else {
|
} else {
|
||||||
city.style.maxHeight = city.scrollHeight + "px";
|
Engine.toggleMainMenuHeader(true,
|
||||||
city.style.opacity = 1;
|
[city, travel, job],
|
||||||
cityLink.style.maxHeight = cityLink.scrollHeight + "px";
|
[cityLink, travelLink, jobLink]
|
||||||
cityLink.style.opacity = 1;
|
);
|
||||||
cityLink.style.pointerEvents = "auto";
|
|
||||||
|
|
||||||
travel.style.maxHeight = travel.scrollHeight + "px";
|
|
||||||
travel.style.opacity = 1;
|
|
||||||
travelLink.style.maxHeight = travelLink.scrollHeight + "px";
|
|
||||||
travelLink.style.opacity = 1;
|
|
||||||
travelLink.style.pointerEvents = "auto";
|
|
||||||
|
|
||||||
job.style.maxHeight = job.scrollHeight + "px";
|
|
||||||
job.style.opacity = 1;
|
|
||||||
jobLink.style.maxHeight = jobLink.scrollHeight + "px";
|
|
||||||
jobLink.style.opacity = 1;
|
|
||||||
jobLink.style.pointerEvents = "auto";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1538,29 +1425,15 @@ let Engine = {
|
|||||||
var optionsLink = document.getElementById("options-menu-link");
|
var optionsLink = document.getElementById("options-menu-link");
|
||||||
this.classList.toggle("opened");
|
this.classList.toggle("opened");
|
||||||
if (tutorial.style.maxHeight) {
|
if (tutorial.style.maxHeight) {
|
||||||
tutorial.style.opacity = 0;
|
Engine.toggleMainMenuHeader(false,
|
||||||
tutorial.style.maxHeight = null;
|
[tutorial, options],
|
||||||
tutorialLink.style.opacity = 0;
|
[tutorialLink, optionsLink]
|
||||||
tutorialLink.style.maxHeight = null;
|
);
|
||||||
tutorialLink.style.pointerEvents = "none";
|
|
||||||
|
|
||||||
options.style.opacity = 0;
|
|
||||||
options.style.maxHeight = null;
|
|
||||||
optionsLink.style.opacity = 0;
|
|
||||||
optionsLink.style.maxHeight = null;
|
|
||||||
optionsLink.style.pointerEvents = "none";
|
|
||||||
} else {
|
} else {
|
||||||
tutorial.style.maxHeight = tutorial.scrollHeight + "px";
|
Engine.toggleMainMenuHeader(true,
|
||||||
tutorial.style.opacity = 1;
|
[tutorial, options],
|
||||||
tutorialLink.style.maxHeight = tutorialLink.scrollHeight + "px";
|
[tutorialLink, optionsLink]
|
||||||
tutorialLink.style.opacity = 1;
|
);
|
||||||
tutorialLink.style.pointerEvents = "auto";
|
|
||||||
|
|
||||||
options.style.maxHeight = options.scrollHeight + "px";
|
|
||||||
options.style.opacity = 1;
|
|
||||||
optionsLink.style.maxHeight = optionsLink.scrollHeight + "px";
|
|
||||||
optionsLink.style.opacity = 1;
|
|
||||||
optionsLink.style.pointerEvents = "auto";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user