[refactor] Breaking out key codes

Trying to start breaking apart the large circular dependencies between
modules. Most of the dependencies are similar to this pattern where
there is one stand-alone member that is needed, so the entire module
gets brought along with.
This commit is contained in:
Steven Evans
2018-07-18 12:50:31 -04:00
parent 1412b01be5
commit 0bea4e0430
4 changed files with 35 additions and 31 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ import {Faction, Factions, factionExists,
import {Locations} from "./Location";
import {Player} from "./Player";
import {hackWorldDaemon, redPillFlag} from "./RedPill";
import {KEY} from "./Terminal";
import {KEY} from "../utils/helpers/keyCodes";
import {createProgressBarText} from "../utils/helpers/createProgressBarText";
import {dialogBoxCreate} from "../utils/DialogBox";
+2 -29
View File
@@ -35,6 +35,7 @@ import {TextFile, getTextFile} from "./TextFile";
import {containsAllStrings, longestCommonStart,
formatNumber} from "../utils/StringHelperFunctions";
import {KEY} from "../utils/helpers/keyCodes";
import {addOffset} from "../utils/helpers/addOffset";
import {isString} from "../utils/helpers/isString";
import {arrayToString} from "../utils/helpers/arrayToString";
@@ -75,34 +76,6 @@ function postNetburnerText() {
post("Bitburner v" + CONSTANTS.Version);
}
//Key Codes
var KEY = {
TAB: 9,
ENTER: 13,
CTRL: 17,
UPARROW: 38,
DOWNARROW: 40,
A: 65,
B: 66,
C: 67,
D: 68,
E: 69,
F: 70,
H: 72,
J: 74,
K: 75,
L: 76,
M: 77,
N: 78,
O: 79,
P: 80,
R: 82,
S: 83,
U: 85,
W: 87,
}
//Defines key commands in terminal
$(document).keydown(function(event) {
//Terminal
@@ -2084,4 +2057,4 @@ let Terminal = {
}
};
export {postNetburnerText, post, Terminal, KEY};
export {postNetburnerText, post, Terminal};
+2 -1
View File
@@ -63,7 +63,8 @@ import {StockMarket, StockSymbols,
initSymbolToStockMap, stockMarketCycle,
updateStockPrices,
displayStockMarketContent} from "./StockMarket";
import {Terminal, postNetburnerText, post, KEY} from "./Terminal";
import {Terminal, postNetburnerText} from "./Terminal";
import {KEY} from "../utils/helpers/keyCodes";
// These should really be imported with the module that is presenting that UI, but because they very much depend on the
// cascade order, we'll pull them all in here.