Fixed page tabs so all menu pages are working now

This commit is contained in:
Daniel Xie 2017-01-27 21:10:16 -06:00
parent f1ada52074
commit bf893926b7
6 changed files with 126 additions and 32 deletions

@ -90,7 +90,45 @@
text-decoration: none;
}
/* World */
#world-container {
position: fixed;
padding-top: 10px;
padding-left: 10px;
height: 100%;
margin-left: 10%;
width: 99%;
}
/* Create program */
#create-program-container {
position: fixed;
padding-top: 10px;
padding-left: 10px;
height: 100%;
margin-left: 10%;
width: 99%;
}
/* Factions */
#factions-container {
position: fixed;
padding-top: 10px;
padding-left: 10px;
height: 100%;
margin-left: 10%;
width: 99%;
}
#faction-container {
position: fixed;
padding-top: 10px;
padding-left: 10px;
height: 100%;
margin-left: 10%;
width: 90%;
}
#faction-hack-button-div, #faction-hack-text-div {
display:inline-block;
}
@ -101,4 +139,25 @@
#faction-securitywork-button-div, #faction-securitywork-text-div {
display:inline-block;
}
/* Augmentations */
#augmentations-container {
position: fixed;
padding-top: 10px;
padding-left: 10px;
height: 100%;
margin-left: 10%;
width: 99%;
}
/* Tutorial */
#tutorial-container {
position: fixed;
padding-top: 10px;
padding-left: 10px;
height: 100%;
margin-left: 10%;
width: 99%;
}

@ -112,8 +112,7 @@
<p id="script-editor-status"> </p>
</div>
<br><br>
<textarea id="script-editor-text" style="border: none" autofocus>
</textarea>
<textarea id="script-editor-text" style="border: none" autofocus> </textarea>
</div>
<!-- Active scripts info page -->
@ -287,7 +286,7 @@
<li id="volhaven-milleniumfitnessgym-li">
<a href="#" id="volhaven-milleniumfitnessgym">Millenium Fitness Gym</a>
<li>
<ul>
</ul>
</div>
<!-- Create a program(executable) -->
@ -342,6 +341,7 @@
<!-- Tutorial content -->
<div id="tutorial-container">
</div>
</div>-
</body>
</html>

@ -15,13 +15,13 @@ function Company() {
};
Company.prototype.init = function(name, salaryMult, expMult) {
this.companyName = name;
this.salaryMult = salaryMult;
this.expMult = expMult;
this.companyName = name;
this.salaryMultiplier = salaryMult;
this.expMultiplier = expMult;
}
Company.prototype.addPosition = function(pos) {
this.companyPositions.push(pos.name); //Company object holds only name of positions
this.companyPositions.push(pos.positionName); //Company object holds only name of positions
}
Company.prototype.addPositions = function(positions) {
@ -133,15 +133,15 @@ CompanyPositions = {
//Non-tech/management jobs
Waiter: new CompanyPosition("Waiter", 1, 1, 1, 1, 1, 1, 0, .5),
Employee: new CompanyPosition("Employee", 1, 1, 1, 1, 1, 1, 0, .5);
Employee: new CompanyPosition("Employee", 1, 1, 1, 1, 1, 1, 0, .5),
SecurityGuard: new CompanyPosition("Security Guard", 1, 50, 50, 50, 50, 0, 3),
PoliceOfficer: new CompanyPosition("Police Officer", 10, 100, 100, 100, 100, 9000, 4),
SecurityOfficer: new CompanyPosition("Security Officer", 25, 150, 150, 150, 150, 9000, 6),
SecuritySupervisor: new CompanyPosition("Security Supervisor", 25, 250, 250, 250, 250, 36000, 12),
HeadOfSecurity: new CompanyPosition("Head of Security", 50, 500, 500, 500, 500, 72000, 20),
FieldAgent: new CompanyPosition("Field Agent", 100, 100, 100, 100, 100, 9000, 4),
SecretAgent: new CompanyPosition("Secret Agent", 200, 250, 250, 250, 250, 36000, 10);
SpecialOperative: new CompanyPosition("Special Operative", 250, 500, 500, 500, 500, 108000, 20);
SecretAgent: new CompanyPosition("Secret Agent", 200, 250, 250, 250, 250, 36000, 10),
SpecialOperative: new CompanyPosition("Special Operative", 250, 500, 500, 500, 500, 108000, 20),
init: function() {
//Argument order: hack, str, def, dex, agi, cha
@ -530,7 +530,7 @@ initCompanies = function() {
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,
CompanyPositions.HeadOfEngineering, CompanyPositions.SecurityGuard, CompanyPositions, SecurityOfficer,
CompanyPositions.HeadOfEngineering, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,
CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity, CompanyPositions.FieldAgent,
CompanyPositions.SecretAgent, CompanyPositions.SpecialOperative]);
AddToCompanies(CIA);
@ -542,7 +542,7 @@ initCompanies = function() {
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,
CompanyPositions.HeadOfEngineering, CompanyPositions.SecurityGuard, CompanyPositions, SecurityOfficer,
CompanyPositions.HeadOfEngineering, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,
CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity, CompanyPositions.FieldAgent,
CompanyPositions.SecretAgent, CompanyPositions.SpecialOperative]);
AddToCompanies(NSA);
@ -554,7 +554,7 @@ initCompanies = function() {
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,
CompanyPositions.HeadOfEngineering, CompanyPositions.SecurityGuard, CompanyPositions, SecurityOfficer,
CompanyPositions.HeadOfEngineering, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,
CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity, CompanyPositions.FieldAgent,
CompanyPositions.SecretAgent, CompanyPositions.SpecialOperative]);
AddToCompanies(WatchdogSecurity);
@ -632,7 +632,7 @@ initCompanies = function() {
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,
CompanyPositions.HeadOfEngineering, CompanyPositions.SecurityGuard, CompanyPositions, SecurityOfficer,
CompanyPositions.HeadOfEngineering, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,
CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity, CompanyPositions.FieldAgent,
CompanyPositions.SecretAgent, CompanyPositions.SpecialOperative]);
AddToCompanies(CarmichaelSecurity);
@ -640,7 +640,7 @@ initCompanies = function() {
//"Low level" companies
var FoodNStuff = new Company();
FoodNStuff.init("FoodNStuff", 1, 1);
FoodNStuff.addPositions([CompanyPositions.Employee]);)
FoodNStuff.addPositions([CompanyPositions.Employee]);
AddToCompanies(FoodNStuff);
var JoesGuns = new Company();

@ -1,7 +1,7 @@
//Netburner Faction class
function Faction(name) {
this.name = name;
this.augmentations = [];
this.augmentations = []; //Name of faction only
this.information = ""; //Introductory/informational text about the faction
//Player-related properties for faction
@ -15,7 +15,7 @@ Faction.prototype.setAugmentations = function(augs) {
}
}
Faction.prototype.setInformation(info) {
Faction.prototype.setInformation = function(info) {
this.information = info;
}
@ -116,7 +116,7 @@ joinFaction = function(faction) {
aElem.addEventListener("click", function() {
displayFactionContent(faction.name);
return false;
}
});
item.appendChild(aElem);
var factionsList = document.getElementById("factions-list");

@ -34,6 +34,7 @@ var Engine = {
worldContent: null,
createProgramContent: null,
factionsContent: null,
factionContent: null,
augmentationsContent: null,
tutorialContent: null,
@ -53,6 +54,7 @@ var Engine = {
World: "World",
CreateProgram: "CreateProgram",
Factions: "Factions",
Faction: "Faction",
Augmentations: "Augmentations",
Tutorial: "Tutorial",
},
@ -171,35 +173,42 @@ var Engine = {
Engine.displayWorldInfo();
Engine.currentPage = Engine.Page.World;
}
},
loadCreateProgramContent: function() {
Engine.hideAllContent();
Engine.Display.createProgramContent.style.visibility = "visible";
Engine.currentPage = Engine.Page.CreateProgram;
}
},
loadFactionsContent: function() {
Engine.hideAllContent();
Engine.Display.factionsContent.style.visibility = "visible";
Engine.currentPage = Engine.Page.Factions;
}
},
loadFactionContent: function() {
Engine.hideAllContent();
Engine.Display.factionContent.style.visibility = "visible";
Engine.currentPage = Engine.Page.Faction;
},
loadAugmentationsContent: function() {
Engine.hideAllContent();
Engine.Display.augmentationsContent.style.visibility = "visible";
Engine.currentPage = Engine.Page.Augmentations;
}
},
loadTutorialContent: function() {
Engine.hideAllContent();
Engine.Display.tutorialContent.style.visibility = "visible";
Engine.currentPage = Engine.Page.Tutorial;
}
},
//Helper function that hides all content
hideAllContent: function() {
@ -207,11 +216,26 @@ var Engine = {
Engine.Display.characterContent.style.visibility = "hidden";
Engine.Display.scriptEditorContent.style.visibility = "hidden";
Engine.Display.activeScriptsContent.style.visibility = "hidden";
Engine.Display.worldContent.style.visiblity = "hidden";
Engine.Display.worldContent.style.visibility = "hidden";
Engine.Display.createProgramContent.style.visibility = "hidden";
Engine.Display.factionsContent.style.visibility = "hidden";
Engine.Display.factionContent.style.visibility = "hidden";
Engine.Display.augmentationsContent.style.visibility = "hidden";
Engine.Display.tutorialContent.style.visibility = "hidden";
//Location lists
Engine.aevumLocationsList.style.display = "none";
Engine.aevumLocationsList.style.visibility = "hidden";
Engine.chongqingLocationsList.style.display = "none";
Engine.chongqingLocationsList.style.visibility = "hidden";
Engine.sector12LocationsList.style.display = "none";
Engine.sector12LocationsList.style.visibility = "hidden";
Engine.newTokyoLocationsList.style.display = "none";
Engine.newTokyoLocationsList.style.visibility = "hidden";
Engine.ishimaLocationsList.style.display = "none";
Engine.ishimaLocationsList.style.visibility = "hidden";
Engine.volhavenLocationsList.style.display = "none";
Engine.volhavenLocationsList.style.visibility = "hidden";
},
/* Display character info */
@ -246,27 +270,33 @@ var Engine = {
switch(Player.city) {
case CONSTANTS.Aevum:
Engine.aevumLocationsList.style.display = "inline";
Engine.aevumLocationsList.style.visibility = "visible";
break;
case CONSTANTS.ChongQing:
Engine.chongqingLocationsList.style.display = "inline";
Engine.chongqingLocationsList.style.visibility = "visible";
break;
case CONSTANTS.Sector12:
Engine.sector12LocationsList.style.display = "inline";
Engine.sector12LocationsList.style.visibility = "visible";
break;
case CONSTANTS.NewTokyo:
Engine.newTokyoLocationsList.style.display = "inline";
Engine.newTokyoLocationsList.style.visibility = "visible";
break;
case CONSTANTS.Ishima:
Engine.ishimaLocationsList.style.display = "inline";
Engine.ishimaLocationsList.style.visibility = "visible";
break;
case CONSTANTS.Volhaven:
Engine.volhavenLocationsList.style.display = "inline";
Engine.volhavenLocationsList.style.visibility = "visible";
break;
default:
console.log("Invalid city value in Player object!");
break;
}
}
},
/* Functions used to update information on the Active Scripts page */
ActiveScriptsList: null,
@ -481,7 +511,7 @@ var Engine = {
if (Engine.loadSave()) {
console.log("Loaded game from save");
CompanyPositions.init();
//Calculate the number of cycles have elapsed while offline
var thisUpdate = new Date().getTime();
var lastUpdate = Player.lastUpdate;
@ -494,9 +524,9 @@ var Engine = {
console.log("Initializing new game");
Player.init();
initForeignServers();
CompanyPositions.init();
initCompanies();
initFactions();
CompanyPositions.init();
}
//Main menu buttons and content
@ -552,7 +582,7 @@ var Engine = {
Engine.Clickables.tutorialMainMenuButton.addEventListener("click", function() {
Engine.loadTutorialContent();
return false;
}
});
//Active scripts list
Engine.ActiveScriptsList = document.getElementById("active-scripts-list");
@ -589,12 +619,16 @@ var Engine = {
Engine.Display.factionsContent = document.getElementById("factions-container");
Engine.Display.factionsContent.style.visibility = "hidden";
Engine.Display.factionContent = document.getElementById("faction-container");
Engine.Display.factionContent.style.visibility = "hidden";
Engine.Display.augmentationsContent = document.getElementById("augmentations-container");
Engine.Display.augmentationsContent.style.visiblity = "hidden";
Engine.Display.augmentationsContent.style.visibility = "hidden";
Engine.Display.tutorialContent = document.getElementById("tutorial-container");
Engine.Display.tutorialContent.style.visiblity = "hidden";
Engine.Display.tutorialContent.style.visibility = "hidden";
//Character info
Engine.Display.characterInfo = document.getElementById("character-info");
@ -606,6 +640,7 @@ var Engine = {
Engine.newTokyoLocationsList = document.getElementById("newtokyo-locations-list");
Engine.ishimaLocationsList = document.getElementById("ishima-locations-list");
Engine.volhavenLocationsList = document.getElementById("volhaven-locations-list");
//Script editor
Engine.Display.scriptEditorText = document.getElementById("script-editor-text");

@ -7,7 +7,7 @@
// off to that `fromJSON` fuunction, passing in the value.
function Reviver(key, value) {
var ctor;
//console.log("Reviver called with key: " + key + ", and value: " + value);
//console.log("Reviver called with key: " + key + ", and value: " + value);
if (typeof value === "object" &&
typeof value.ctor === "string" &&
typeof value.data !== "undefined") {