mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-18 21:53:50 +01:00
Refactored Dialog boxes so that an infinite amount can be opened
This commit is contained in:
parent
70e52553dd
commit
b53abeb280
@ -12,20 +12,43 @@
|
|||||||
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
|
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
|
||||||
}
|
}
|
||||||
|
|
||||||
#dialog-box-content {
|
/*
|
||||||
z-index: 1;
|
.dialog-box-container {
|
||||||
|
display: block;
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
margin: auto;
|
||||||
|
width: 50%;
|
||||||
|
height: 100%;
|
||||||
|
vertical-align: middle;
|
||||||
|
overflow: auto;
|
||||||
|
background-color: black;
|
||||||
|
background-color: rgba(0,0,0,0.4);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
.dialog-box-container {
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 2;
|
||||||
|
/*margin: auto;*/
|
||||||
|
width: 50%;
|
||||||
|
height: auto;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
margin: -10% 0 0 -25%;
|
||||||
|
overflow: auto;
|
||||||
|
background-color: black;
|
||||||
|
background-color: rgba(0,0,0,0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-box-content {
|
||||||
|
z-index: 2;
|
||||||
background-color: black;
|
background-color: black;
|
||||||
margin: 20% auto; /* 20% from the top and centered */
|
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border: 5px solid #FFFFFF;
|
border: 5px solid #FFFFFF;
|
||||||
width: 40%; /* Could be more or less, depending on screen size */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-box-text {
|
.dialog-box-close-button {
|
||||||
color: #66ff33;
|
|
||||||
}
|
|
||||||
|
|
||||||
#dialog-box-close-button {
|
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
float: right;
|
float: right;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
@ -38,8 +61,8 @@
|
|||||||
box-shadow: 1px 1px 3px #000;
|
box-shadow: 1px 1px 3px #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
#dialog-box-close-button:hover,
|
.dialog-box-close-button:hover,
|
||||||
#dialog-box-close-button:focus {
|
.dialog-box-close-button:focus {
|
||||||
color: white;
|
color: white;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
14
index.html
14
index.html
@ -643,20 +643,6 @@
|
|||||||
<a id="location-slums-heist" class="a-link-button tooltip"> Heist </a>
|
<a id="location-slums-heist" class="a-link-button tooltip"> Heist </a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Dialog Box, displays status text only -->
|
|
||||||
<div id="dialog-box-container" class="popup-box-container">
|
|
||||||
<div id="dialog-box-content" class="dialog-box">
|
|
||||||
<span id="dialog-box-close-button">×</span>
|
|
||||||
<p id="dialog-box-text-1" class="dialog-box-text"> </p>
|
|
||||||
<br>
|
|
||||||
<p id="dialog-box-text-2" class="dialog-box-text"> </p>
|
|
||||||
<br>
|
|
||||||
<p id="dialog-box-text-3" class="dialog-box-text"> </p>
|
|
||||||
<br>
|
|
||||||
<p id="dialog-box-text-4" class="dialog-box-text"> </p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Purchase Server Pop-up Box -->
|
<!-- Purchase Server Pop-up Box -->
|
||||||
<div id="purchase-server-box-container" class="popup-box-container">
|
<div id="purchase-server-box-container" class="popup-box-container">
|
||||||
<div id="purchase-server-box-content">
|
<div id="purchase-server-box-content">
|
||||||
|
@ -17,7 +17,7 @@ PlayerObject.prototype.applyForJob = function(entryPosType) {
|
|||||||
|
|
||||||
if (!this.isQualified(company, pos)) {
|
if (!this.isQualified(company, pos)) {
|
||||||
var reqText = getJobRequirementText(company, pos);
|
var reqText = getJobRequirementText(company, pos);
|
||||||
dialogBoxCreate("Unforunately, you do not qualify for this position", reqText);
|
dialogBoxCreate("Unforunately, you do not qualify for this position<br>" + reqText);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ PlayerObject.prototype.applyForJob = function(entryPosType) {
|
|||||||
pos.positionName == currPositionName) {
|
pos.positionName == currPositionName) {
|
||||||
var nextPos = getNextCompanyPosition(pos);
|
var nextPos = getNextCompanyPosition(pos);
|
||||||
var reqText = getJobRequirementText(company, nextPos);
|
var reqText = getJobRequirementText(company, nextPos);
|
||||||
dialogBoxCreate("Unfortunately, you do not qualify for a promotion", reqText);
|
dialogBoxCreate("Unfortunately, you do not qualify for a promotion<br>" + reqText);
|
||||||
|
|
||||||
return; //Same job, do nothing
|
return; //Same job, do nothing
|
||||||
}
|
}
|
||||||
@ -77,7 +77,8 @@ PlayerObject.prototype.applyForJob = function(entryPosType) {
|
|||||||
this.companyPosition = pos;
|
this.companyPosition = pos;
|
||||||
|
|
||||||
if (leaveCompany) {
|
if (leaveCompany) {
|
||||||
dialogBoxCreate("Congratulations! You were offered a new job at " + this.companyName + " as a " + pos.positionName + "!",
|
dialogBoxCreate("Congratulations! You were offered a new job at " + this.companyName + " as a " +
|
||||||
|
pos.positionName + "!<br>" +
|
||||||
"You lost 1000 reputatation at your old company " + oldCompanyName + " because you left.");
|
"You lost 1000 reputatation at your old company " + oldCompanyName + " because you left.");
|
||||||
} else {
|
} else {
|
||||||
dialogBoxCreate("Congratulations! You were offered a new job at " + this.companyName + " as a " + pos.positionName + "!");
|
dialogBoxCreate("Congratulations! You were offered a new job at " + this.companyName + " as a " + pos.positionName + "!");
|
||||||
@ -126,7 +127,7 @@ PlayerObject.prototype.applyForSecurityEngineerJob = function() {
|
|||||||
if (this.isQualified(company, CompanyPositions.SecurityEngineer)) {
|
if (this.isQualified(company, CompanyPositions.SecurityEngineer)) {
|
||||||
this.companyName = company.companyName;
|
this.companyName = company.companyName;
|
||||||
this.companyPosition = CompanyPositions.SecurityEngineer;
|
this.companyPosition = CompanyPositions.SecurityEngineer;
|
||||||
dialogBoxCreate("Congratulations, you were offered a position at ", this.companyName, " as a Security Engineer!" , "");
|
dialogBoxCreate("Congratulations, you were offered a position at ", this.companyName, " as a Security Engineer!");
|
||||||
Engine.loadLocationContent();
|
Engine.loadLocationContent();
|
||||||
} else {
|
} else {
|
||||||
dialogBoxCreate("Unforunately, you do not qualify for this position");
|
dialogBoxCreate("Unforunately, you do not qualify for this position");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
CONSTANTS = {
|
CONSTANTS = {
|
||||||
Version: "0.18.1",
|
Version: "0.18.2",
|
||||||
|
|
||||||
//Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
|
//Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
|
||||||
//and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
|
//and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
|
||||||
|
@ -1617,7 +1617,7 @@ purchaseTorRouter = function() {
|
|||||||
|
|
||||||
Player.getHomeComputer().serversOnNetwork.push(darkweb.ip);
|
Player.getHomeComputer().serversOnNetwork.push(darkweb.ip);
|
||||||
darkweb.serversOnNetwork.push(Player.getHomeComputer().ip);
|
darkweb.serversOnNetwork.push(Player.getHomeComputer().ip);
|
||||||
dialogBoxCreate("You have purchased a Tor router!", "You now have access to the dark web from your home computer", "Use the scan/netstat commands to search for the dark web connection.");
|
dialogBoxCreate("You have purchased a Tor router!<br>You now have access to the dark web from your home computer<br>Use the scan/netstat commands to search for the dark web connection.");
|
||||||
}
|
}
|
||||||
|
|
||||||
displayUniversityLocationContent = function(costMult) {
|
displayUniversityLocationContent = function(costMult) {
|
||||||
|
@ -63,7 +63,7 @@ function runScriptsLoop() {
|
|||||||
var scriptName = errorTextArray[2];
|
var scriptName = errorTextArray[2];
|
||||||
var errorMsg = errorTextArray[3];
|
var errorMsg = errorTextArray[3];
|
||||||
|
|
||||||
dialogBoxCreate("Script runtime error: ", "Server Ip: " + serverIp, "Script name: " + scriptName, errorMsg);
|
dialogBoxCreate("Script runtime error:<br>Server Ip: " + serverIp + "<br>Script name: " + scriptName + "<br>" + errorMsg);
|
||||||
|
|
||||||
//Find the corresponding workerscript and set its flags to kill it
|
//Find the corresponding workerscript and set its flags to kill it
|
||||||
for (var i = 0; i < workerScripts.length; ++i) {
|
for (var i = 0; i < workerScripts.length; ++i) {
|
||||||
@ -85,7 +85,7 @@ function runScriptsLoop() {
|
|||||||
var scriptName = errorTextArray[2];
|
var scriptName = errorTextArray[2];
|
||||||
var errorMsg = errorTextArray[3];
|
var errorMsg = errorTextArray[3];
|
||||||
|
|
||||||
dialogBoxCreate("Script runtime error: ", "Server Ip: " + serverIp, "Script name: " + scriptName, errorMsg);
|
dialogBoxCreate("Script runtime error: <br>Server Ip: " + serverIp + "<br>Script name: " + scriptName + "<br>" + errorMsg);
|
||||||
}
|
}
|
||||||
w.running = false;
|
w.running = false;
|
||||||
w.env.stopFlag = true;
|
w.env.stopFlag = true;
|
||||||
@ -100,7 +100,7 @@ function runScriptsLoop() {
|
|||||||
var scriptName = errorTextArray[2];
|
var scriptName = errorTextArray[2];
|
||||||
var errorMsg = errorTextArray[3];
|
var errorMsg = errorTextArray[3];
|
||||||
|
|
||||||
dialogBoxCreate("Script runtime error: ", "Server Ip: " + serverIp, "Script name: " + scriptName, errorMsg);
|
dialogBoxCreate("Script runtime error: <br>Server Ip: " + serverIp + "<br>Script name: " + scriptName + "<br>" + errorMsg);
|
||||||
|
|
||||||
//Find the corresponding workerscript and set its flags to kill it
|
//Find the corresponding workerscript and set its flags to kill it
|
||||||
for (var i = 0; i < workerScripts.length; ++i) {
|
for (var i = 0; i < workerScripts.length; ++i) {
|
||||||
|
@ -159,10 +159,46 @@ Script.prototype.reset = function() {
|
|||||||
this.onlineExpGained = 0;
|
this.onlineExpGained = 0;
|
||||||
this.logs = [];
|
this.logs = [];
|
||||||
|
|
||||||
this.moneyStolenMap.reset();
|
if (this.moneyStolenMap != null) {
|
||||||
this.numTimesHackMap.reset();
|
try {
|
||||||
this.numTimesGrowMap.reset();
|
this.moneyStolenMap.reset();
|
||||||
this.numTimesWeakenMap.reset();
|
} catch(e) {
|
||||||
|
this.moneyStolenMap = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.moneyStolenMap = new AllServersMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.numTimesHackMap != null) {
|
||||||
|
try {
|
||||||
|
this.numTimesHackMap.reset();
|
||||||
|
} catch(e) {
|
||||||
|
this.numTimesHackMap = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.numTimesHackMap = new AllServersMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.numTimesGrowMap != null) {
|
||||||
|
try {
|
||||||
|
this.numTimesGrowMap.reset();
|
||||||
|
} catch(e) {
|
||||||
|
this.numTimesGrowMap = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.numTimesGrowMap = new AllServersMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.numTimesWeakenMap != null) {
|
||||||
|
try {
|
||||||
|
this.numTimesWeakenMap.reset();
|
||||||
|
} catch(e) {
|
||||||
|
this.numTimesWeakenMap = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.numTimesWeakenMap = new AllServersMap();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Updates how much RAM the script uses when it is running.
|
//Updates how much RAM the script uses when it is running.
|
||||||
@ -435,3 +471,14 @@ AllServersMap.prototype.printConsole = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AllServersMap.prototype.toJSON = function() {
|
||||||
|
return Generic_toJSON("AllServersMap", this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
AllServersMap.fromJSON = function(value) {
|
||||||
|
return Generic_fromJSON(AllServersMap, value.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
Reviver.constructors.AllServersMap = AllServersMap;
|
@ -3,52 +3,54 @@
|
|||||||
//Close dialog box when clicking outside
|
//Close dialog box when clicking outside
|
||||||
$(document).click(function(event) {
|
$(document).click(function(event) {
|
||||||
if (dialogBoxOpened) {
|
if (dialogBoxOpened) {
|
||||||
if ( $(event.target).closest(".dialog-box").get(0) == null ) {
|
if (!$(event.target).closest('.dialog-box-container').length){
|
||||||
dialogBoxClose();
|
--dialogBoxCount;
|
||||||
|
$(".dialog-box-container").remove();
|
||||||
|
if (dialogBoxCount == 0) {
|
||||||
|
dialogBoxOpened = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//Dialog box close buttons
|
||||||
|
$(document).on('click', '.dialog-box-close-button', function( event ) {
|
||||||
|
console.log("clicked close button");
|
||||||
|
if (dialogBoxOpened) {
|
||||||
|
$(this).closest('.dialog-box-container').remove();
|
||||||
|
--dialogBoxCount;
|
||||||
|
if (dialogBoxCount == 0) {
|
||||||
|
dialogBoxOpened = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var dialogBoxOpened = false;
|
var dialogBoxOpened = false;
|
||||||
function dialogBoxInit() {
|
var dialogBoxCount = 0;
|
||||||
var closeButton = document.getElementById("dialog-box-close-button");
|
|
||||||
|
|
||||||
//Close Dialog box
|
dialogBoxCreate = function(txt) {
|
||||||
closeButton.addEventListener("click", function() {
|
console.log("created");
|
||||||
dialogBoxClose();
|
var container = document.createElement("div");
|
||||||
return false;
|
container.setAttribute("class", "dialog-box-container");
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", dialogBoxInit, false);
|
var content = document.createElement("div");
|
||||||
|
content.setAttribute("class", "dialog-box-content");
|
||||||
|
|
||||||
dialogBoxClose = function() {
|
var closeButton = document.createElement("span");
|
||||||
dialogBoxOpened = false;
|
closeButton.setAttribute("class", "dialog-box-close-button");
|
||||||
var dialogBox = document.getElementById("dialog-box-container");
|
closeButton.innerHTML = "×"
|
||||||
dialogBox.style.display = "none";
|
|
||||||
}
|
var textE = document.createElement("p");
|
||||||
|
textE.innerHTML = txt;
|
||||||
|
|
||||||
|
content.appendChild(closeButton);
|
||||||
|
content.appendChild(textE);
|
||||||
|
container.appendChild(content);
|
||||||
|
|
||||||
|
document.body.appendChild(container);
|
||||||
|
|
||||||
dialogBoxOpen = function() {
|
|
||||||
var dialogBox = document.getElementById("dialog-box-container");
|
|
||||||
dialogBox.style.display = "block";
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
dialogBoxOpened = true;
|
dialogBoxOpened = true;
|
||||||
|
++dialogBoxCount;
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
dialogBoxSetText = function(txt1, txt2="", txt3="", txt4="") {
|
|
||||||
var dialogBoxText1 = document.getElementById("dialog-box-text-1");
|
|
||||||
var dialogBoxText2 = document.getElementById("dialog-box-text-2");
|
|
||||||
var dialogBoxText3 = document.getElementById("dialog-box-text-3");
|
|
||||||
var dialogBoxText4 = document.getElementById("dialog-box-text-4");
|
|
||||||
dialogBoxText1.innerHTML = txt1;
|
|
||||||
dialogBoxText2.innerHTML = txt2;
|
|
||||||
dialogBoxText3.innerHTML = txt3;
|
|
||||||
dialogBoxText4.innerHTML = txt4;
|
|
||||||
}
|
|
||||||
|
|
||||||
dialogBoxCreate = function(txt1, txt2="", txt3="", txt4="") {
|
|
||||||
dialogBoxSetText(txt1, txt2, txt3, txt4);
|
|
||||||
dialogBoxOpen();
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user