From bf893926b7026a1d02bf049cf773afae8883cad5 Mon Sep 17 00:00:00 2001 From: Daniel Xie Date: Fri, 27 Jan 2017 21:10:16 -0600 Subject: [PATCH] Fixed page tabs so all menu pages are working now --- css/menupages.css | 59 ++++++++++++++++++++++++++++++++++++++++++++ index.html | 8 +++--- src/Company.js | 24 +++++++++--------- src/Faction.js | 6 ++--- src/engine.js | 59 +++++++++++++++++++++++++++++++++++--------- utils/JSONReviver.js | 2 +- 6 files changed, 126 insertions(+), 32 deletions(-) diff --git a/css/menupages.css b/css/menupages.css index 47170ec29..cbc001748 100644 --- a/css/menupages.css +++ b/css/menupages.css @@ -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%; } \ No newline at end of file diff --git a/index.html b/index.html index ee91bb9ca..a6783c125 100644 --- a/index.html +++ b/index.html @@ -112,8 +112,7 @@



- + @@ -287,7 +286,7 @@
  • Millenium Fitness Gym
  • - @@ -342,6 +341,7 @@
    -
    + - + \ No newline at end of file diff --git a/src/Company.js b/src/Company.js index 18447ccf3..cbd47e8f4 100644 --- a/src/Company.js +++ b/src/Company.js @@ -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(); diff --git a/src/Faction.js b/src/Faction.js index a9b08e597..91aac9e3f 100644 --- a/src/Faction.js +++ b/src/Faction.js @@ -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"); diff --git a/src/engine.js b/src/engine.js index 2c2687fcf..b46a63e16 100644 --- a/src/engine.js +++ b/src/engine.js @@ -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"); diff --git a/utils/JSONReviver.js b/utils/JSONReviver.js index 18e504c50..0ac6bc72d 100644 --- a/utils/JSONReviver.js +++ b/utils/JSONReviver.js @@ -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") {