In the middle of work for simplifying UI

This commit is contained in:
danielyxie 2017-09-01 15:35:14 -05:00
parent 78ca383ee2
commit 9614d6ee4f
6 changed files with 96 additions and 243 deletions

262
dist/bundle.js vendored

@ -4478,52 +4478,26 @@ 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 */])(offlineProductionFromHacknetNodes, 2));
//Close main menu accordions for loaded game
Engine.closeMainMenuHeader(
var visibleMenuTabs = [terminal, createScript, activeScripts, stats,
hacknetnodes, city, tutorial, options];
if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].firstFacInvRecvd) {visibleMenuTabs.push(factions);}
else {factions.style.display = "none";}
if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].firstAugPurchased) {visibleMenuTabs.push(augmentations);}
else {augmentations.style.display = "none";}
if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].firstJobRecvd) {visibleMenuTabs.push(job);}
else {job.style.display = "none";}
if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].firstTimeTraveled) {visibleMenuTabs.push(travel);}
else {travel.style.display = "none";}
if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].firstProgramAvailable) {visibleMenuTabs.push(createProgram);}
else {createProgram.style.display = "none";}
Engine.closeMainMenuHeader(visibleMenuTabs
/*
[terminal, createScript, activeScripts, createProgram, stats,
factions, augmentations, hacknetnodes, city, travel, job,
tutorial, options]
*/
);
/*
terminal.style.maxHeight = null;
terminal.style.opacity = 0;
terminal.style.pointerEvents = "none";
createScript.style.maxHeight = null;
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 {
//No save found, start new game
console.log("Initializing new game");
@ -4554,39 +4528,24 @@ let Engine = {
worldHdr.classList.toggle("opened");
var helpHdr = document.getElementById("help-menu-header");
helpHdr.classList.toggle("opened");
//Hide tabs that wont be revealed until later
factions.style.display = "none";
augmentations.style.display = "none";
job.style.display = "none";
travel.style.display = "none";
createProgram.style.display = "none";
Engine.openMainMenuHeader(
/*
[terminal, createScript, activeScripts, createProgram, stats,
factions, augmentations, hacknetnodes, city, travel, job,
tutorial, options]
*/
[terminal, createScript, activeScripts, stats,
hacknetnodes, city,
tutorial, options]
);
/*
terminal.style.maxHeight = terminal.scrollHeight + "px";
terminal.style.display = "block";
createScript.style.maxHeight = createScript.scrollHeight + "px";
createScript.style.display = "block";
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
Object(__WEBPACK_IMPORTED_MODULE_16__InteractiveTutorial_js__["d" /* iTutorialStart */])();
@ -4754,31 +4713,6 @@ let Engine = {
[terminal, createScript, activeScripts, createProgram],
[terminalLink, createScriptLink, activeScriptsLink, createProgramLink]
);
/*
terminal.style.opacity = 0;
terminal.style.maxHeight = null;
terminalLink.style.opacity = 0;
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";
} else {
@ -4786,31 +4720,7 @@ let Engine = {
[terminal, createScript, activeScripts, createProgram],
[terminalLink, createScriptLink, activeScriptsLink, createProgramLink]
);
/*
terminal.style.maxHeight = terminal.scrollHeight + "px";
terminal.style.opacity = 1;
terminalLink.style.maxHeight = terminalLink.scrollHeight + "px";
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"
}
}
@ -4830,61 +4740,11 @@ let Engine = {
[stats, factions, augmentations, hacknetnodes],
[statsLink, factionsLink, augmentationsLink, hacknetnodesLink]
);
/*
stats.style.opacity = 0;
stats.style.maxHeight = null;
statsLink.style.opacity = 0;
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 {
Engine.toggleMainMenuHeader(true,
[stats, factions, augmentations, hacknetnodes],
[statsLink, factionsLink, augmentationsLink, hacknetnodesLink]
);
/*
stats.style.maxHeight = stats.scrollHeight + "px";
stats.style.opacity = 1;
statsLink.style.maxHeight = statsLink.scrollHeight + "px";
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";
*/
}
}
@ -4901,49 +4761,11 @@ let Engine = {
[city, travel, job],
[cityLink, travelLink, jobLink]
);
/*
city.style.opacity = 0;
city.style.maxHeight = null;
cityLink.style.opacity = 0;
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 {
Engine.toggleMainMenuHeader(true,
[city, travel, job],
[cityLink, travelLink, jobLink]
);
/*
city.style.maxHeight = city.scrollHeight + "px";
city.style.opacity = 1;
cityLink.style.maxHeight = cityLink.scrollHeight + "px";
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";
*/
}
}
@ -4958,37 +4780,11 @@ let Engine = {
[tutorial, options],
[tutorialLink, optionsLink]
);
/*
tutorial.style.opacity = 0;
tutorial.style.maxHeight = null;
tutorialLink.style.opacity = 0;
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 {
Engine.toggleMainMenuHeader(true,
[tutorial, options],
[tutorialLink, optionsLink]
);
/*
tutorial.style.maxHeight = tutorial.scrollHeight + "px";
tutorial.style.opacity = 1;
tutorialLink.style.maxHeight = tutorialLink.scrollHeight + "px";
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";
*/
}
}

@ -134,7 +134,10 @@ function getNumAvailableCreateProgram() {
if (!Player.hasProgram(Programs.AutoLink) && Player.hacking_skill >= 25) {
++count;
}
if (count > 0) {Player.firstProgramAvailable = true;}
if (Player.firstProgramAvailable === false && count > 0) {
Player.firstProgramAvailable = true;
document.getElementById("create-program-tab").style.display = "list-item";
}
return count;
}

@ -908,7 +908,10 @@ function purchaseAugmentation(aug, fac, sing=false) {
var txt = "You must first install the Bionic Arms augmentation before installing this upgrade";
if (sing) {return txt;} else {dialogBoxCreate(txt);}
} else if (Player.money.gte(aug.baseCost * fac.augmentationPriceMult)) {
Player.firstAugPurchased = true;
if (Player.firstAugPurchased === false) {
Player.firstAugPurchased = true;
document.getElementById("augmentations-tab").style.display = "list-item";
}
var queuedAugmentation = new PlayerOwnedAugmentation(aug.name);
if (aug.name == AugmentationNames.NeuroFluxGovernor) {

@ -1840,7 +1840,11 @@ function initLocationButtons() {
}
function travelToCity(destCityName, cost) {
Player.firstTimeTraveled = true;
if (Player.firstTimeTraveled === false) {
Player.firstTimeTraveled = true;
document.getElementById("travel-tab").style.display = "list-item";
}
if (Player.money.lt(cost)) {
dialogBoxCreate("You cannot afford to travel to " + destCityName);
return;

@ -1614,7 +1614,10 @@ PlayerObject.prototype.applyForJob = function(entryPosType, sing=false) {
this.companyName = company.companyName;
this.companyPosition = pos;
Player.firstJobRecvd = true;
if (Player.firstJobRecvd === false) {
Player.firstJobRecvd = true;
document.getElementById("job-tab").style.display = "list-item";
}
if (leaveCompany) {
if (sing) {return true;}
@ -1718,7 +1721,10 @@ PlayerObject.prototype.applyForAgentJob = function(sing=false) {
PlayerObject.prototype.applyForEmployeeJob = function(sing=false) {
var company = Companies[this.location]; //Company being applied to
if (this.isQualified(company, CompanyPositions.Employee)) {
Player.firstJobRecvd = true;
if (Player.firstJobRecvd === false) {
Player.firstJobRecvd = true;
document.getElementById("job-tab").style.display = "list-item";
}
this.companyName = company.companyName;
this.companyPosition = CompanyPositions.Employee;
if (sing) {return true;}
@ -1733,7 +1739,10 @@ PlayerObject.prototype.applyForEmployeeJob = function(sing=false) {
PlayerObject.prototype.applyForPartTimeEmployeeJob = function(sing=false) {
var company = Companies[this.location]; //Company being applied to
if (this.isQualified(company, CompanyPositions.PartTimeEmployee)) {
Player.firstJobRecvd = true;
if (Player.firstJobRecvd === false) {
Player.firstJobRecvd = true;
document.getElementById("job-tab").style.display = "list-item";
}
this.companyName = company.companyName;
this.companyPosition = CompanyPositions.PartTimeEmployee;
if (sing) {return true;}
@ -1748,7 +1757,10 @@ PlayerObject.prototype.applyForPartTimeEmployeeJob = function(sing=false) {
PlayerObject.prototype.applyForWaiterJob = function(sing=false) {
var company = Companies[this.location]; //Company being applied to
if (this.isQualified(company, CompanyPositions.Waiter)) {
Player.firstJobRecvd = true;
if (Player.firstJobRecvd === false) {
Player.firstJobRecvd = true;
document.getElementById("job-tab").style.display = "list-item";
}
this.companyName = company.companyName;
this.companyPosition = CompanyPositions.Waiter;
if (sing) {return true;}
@ -1763,7 +1775,10 @@ PlayerObject.prototype.applyForWaiterJob = function(sing=false) {
PlayerObject.prototype.applyForPartTimeWaiterJob = function(sing=false) {
var company = Companies[this.location]; //Company being applied to
if (this.isQualified(company, CompanyPositions.PartTimeWaiter)) {
Player.firstJobRecvd = true;
if (Player.firstJobRecvd === false) {
Player.firstJobRecvd = true;
document.getElementById("job-tab").style.display = "list-item";
}
this.companyName = company.companyName;
this.companyPosition = CompanyPositions.PartTimeWaiter;
if (sing) {return true;}

@ -915,7 +915,11 @@ let Engine = {
if (Engine.Counters.checkFactionInvitations <= 0) {
var invitedFactions = Player.checkForFactionInvitations();
if (invitedFactions.length > 0) {
Player.firstFacInvRecvd = true;
if (Player.firstFacInvRecvd === false) {
Player.firstFacInvRecvd = true;
document.getElementById("factions-tab").style.display = "list-item";
}
var randFaction = invitedFactions[Math.floor(Math.random() * invitedFactions.length)];
inviteToFaction(randFaction);
}
@ -1155,10 +1159,25 @@ let Engine = {
formatNumber(offlineProductionFromScripts, 2) + " and your Hacknet Nodes generated $" +
formatNumber(offlineProductionFromHacknetNodes, 2));
//Close main menu accordions for loaded game
Engine.closeMainMenuHeader(
var visibleMenuTabs = [terminal, createScript, activeScripts, stats,
hacknetnodes, city, tutorial, options];
if (Player.firstFacInvRecvd) {visibleMenuTabs.push(factions);}
else {factions.style.display = "none";}
if (Player.firstAugPurchased) {visibleMenuTabs.push(augmentations);}
else {augmentations.style.display = "none";}
if (Player.firstJobRecvd) {visibleMenuTabs.push(job);}
else {job.style.display = "none";}
if (Player.firstTimeTraveled) {visibleMenuTabs.push(travel);}
else {travel.style.display = "none";}
if (Player.firstProgramAvailable) {visibleMenuTabs.push(createProgram);}
else {createProgram.style.display = "none";}
Engine.closeMainMenuHeader(visibleMenuTabs
/*
[terminal, createScript, activeScripts, createProgram, stats,
factions, augmentations, hacknetnodes, city, travel, job,
tutorial, options]
*/
);
} else {
//No save found, start new game
@ -1190,10 +1209,23 @@ let Engine = {
worldHdr.classList.toggle("opened");
var helpHdr = document.getElementById("help-menu-header");
helpHdr.classList.toggle("opened");
//Hide tabs that wont be revealed until later
factions.style.display = "none";
augmentations.style.display = "none";
job.style.display = "none";
travel.style.display = "none";
createProgram.style.display = "none";
Engine.openMainMenuHeader(
/*
[terminal, createScript, activeScripts, createProgram, stats,
factions, augmentations, hacknetnodes, city, travel, job,
tutorial, options]
*/
[terminal, createScript, activeScripts, stats,
hacknetnodes, city,
tutorial, options]
);
//Start interactive tutorial