mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 17:43:48 +01:00
[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:
parent
1412b01be5
commit
0bea4e0430
@ -7,7 +7,7 @@ import {Faction, Factions, factionExists,
|
|||||||
import {Locations} from "./Location";
|
import {Locations} from "./Location";
|
||||||
import {Player} from "./Player";
|
import {Player} from "./Player";
|
||||||
import {hackWorldDaemon, redPillFlag} from "./RedPill";
|
import {hackWorldDaemon, redPillFlag} from "./RedPill";
|
||||||
import {KEY} from "./Terminal";
|
import {KEY} from "../utils/helpers/keyCodes";
|
||||||
|
|
||||||
import {createProgressBarText} from "../utils/helpers/createProgressBarText";
|
import {createProgressBarText} from "../utils/helpers/createProgressBarText";
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
|
@ -35,6 +35,7 @@ import {TextFile, getTextFile} from "./TextFile";
|
|||||||
|
|
||||||
import {containsAllStrings, longestCommonStart,
|
import {containsAllStrings, longestCommonStart,
|
||||||
formatNumber} from "../utils/StringHelperFunctions";
|
formatNumber} from "../utils/StringHelperFunctions";
|
||||||
|
import {KEY} from "../utils/helpers/keyCodes";
|
||||||
import {addOffset} from "../utils/helpers/addOffset";
|
import {addOffset} from "../utils/helpers/addOffset";
|
||||||
import {isString} from "../utils/helpers/isString";
|
import {isString} from "../utils/helpers/isString";
|
||||||
import {arrayToString} from "../utils/helpers/arrayToString";
|
import {arrayToString} from "../utils/helpers/arrayToString";
|
||||||
@ -75,34 +76,6 @@ function postNetburnerText() {
|
|||||||
post("Bitburner v" + CONSTANTS.Version);
|
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
|
//Defines key commands in terminal
|
||||||
$(document).keydown(function(event) {
|
$(document).keydown(function(event) {
|
||||||
//Terminal
|
//Terminal
|
||||||
@ -2084,4 +2057,4 @@ let Terminal = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export {postNetburnerText, post, Terminal, KEY};
|
export {postNetburnerText, post, Terminal};
|
||||||
|
@ -63,7 +63,8 @@ import {StockMarket, StockSymbols,
|
|||||||
initSymbolToStockMap, stockMarketCycle,
|
initSymbolToStockMap, stockMarketCycle,
|
||||||
updateStockPrices,
|
updateStockPrices,
|
||||||
displayStockMarketContent} from "./StockMarket";
|
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
|
// 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.
|
// cascade order, we'll pull them all in here.
|
||||||
|
30
utils/helpers/keyCodes.ts
Normal file
30
utils/helpers/keyCodes.ts
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import { IMap } from "../../src/types";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Keyboard key codes
|
||||||
|
*/
|
||||||
|
export const KEY: IMap<number> = {
|
||||||
|
A: 65,
|
||||||
|
B: 66,
|
||||||
|
C: 67,
|
||||||
|
CTRL: 17,
|
||||||
|
D: 68,
|
||||||
|
DOWNARROW: 40,
|
||||||
|
E: 69,
|
||||||
|
ENTER: 13,
|
||||||
|
F: 70,
|
||||||
|
H: 72,
|
||||||
|
J: 74,
|
||||||
|
K: 75,
|
||||||
|
L: 76,
|
||||||
|
M: 77,
|
||||||
|
N: 78,
|
||||||
|
O: 79,
|
||||||
|
P: 80,
|
||||||
|
R: 82,
|
||||||
|
S: 83,
|
||||||
|
TAB: 9,
|
||||||
|
U: 85,
|
||||||
|
UPARROW: 38,
|
||||||
|
W: 87,
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user