mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-19 14:13:48 +01:00
Merge pull request #359 from kopelli/remove-loading-screen
[refactor] Pulled 'removeLoadingScreen' out of Engine
This commit is contained in:
commit
b822a2447d
@ -4,6 +4,7 @@ import {removeChildrenFromElement} from "../utils/uiHelpers/removeC
|
|||||||
import {clearEventListeners} from "../utils/uiHelpers/clearEventListeners";
|
import {clearEventListeners} from "../utils/uiHelpers/clearEventListeners";
|
||||||
import {createElement} from "../utils/uiHelpers/createElement";
|
import {createElement} from "../utils/uiHelpers/createElement";
|
||||||
import {exceptionAlert} from "../utils/helpers/exceptionAlert";
|
import {exceptionAlert} from "../utils/helpers/exceptionAlert";
|
||||||
|
import {removeLoadingScreen} from "../utils/uiHelpers/removeLoadingScreen";
|
||||||
import numeral from "numeral/min/numeral.min";
|
import numeral from "numeral/min/numeral.min";
|
||||||
import {formatNumber,
|
import {formatNumber,
|
||||||
convertTimeMsToTimeElapsedString,
|
convertTimeMsToTimeElapsedString,
|
||||||
@ -1214,16 +1215,6 @@ let Engine = {
|
|||||||
}, 3000);
|
}, 3000);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeLoadingScreen: function() {
|
|
||||||
var loader = document.getElementById("loader");
|
|
||||||
if (!loader) {return;}
|
|
||||||
while(loader.firstChild) {
|
|
||||||
loader.removeChild(loader.firstChild);
|
|
||||||
}
|
|
||||||
loader.parentNode.removeChild(loader);
|
|
||||||
document.getElementById("entire-game-container").style.visibility = "visible";
|
|
||||||
},
|
|
||||||
|
|
||||||
//Used when initializing a game
|
//Used when initializing a game
|
||||||
//elems should be an array of all DOM elements under the header
|
//elems should be an array of all DOM elements under the header
|
||||||
closeMainMenuHeader: function(elems) {
|
closeMainMenuHeader: function(elems) {
|
||||||
@ -1362,7 +1353,7 @@ let Engine = {
|
|||||||
|
|
||||||
Player.lastUpdate = Engine._lastUpdate;
|
Player.lastUpdate = Engine._lastUpdate;
|
||||||
Engine.start(); //Run main game loop and Scripts loop
|
Engine.start(); //Run main game loop and Scripts loop
|
||||||
Engine.removeLoadingScreen();
|
removeLoadingScreen();
|
||||||
dialogBoxCreate("While you were offline, your scripts generated $" +
|
dialogBoxCreate("While you were offline, your scripts generated $" +
|
||||||
formatNumber(offlineProductionFromScripts, 2) + " and your Hacknet Nodes generated $" +
|
formatNumber(offlineProductionFromScripts, 2) + " and your Hacknet Nodes generated $" +
|
||||||
formatNumber(offlineProductionFromHacknetNodes, 2));
|
formatNumber(offlineProductionFromHacknetNodes, 2));
|
||||||
@ -1436,7 +1427,7 @@ let Engine = {
|
|||||||
|
|
||||||
//Start interactive tutorial
|
//Start interactive tutorial
|
||||||
iTutorialStart();
|
iTutorialStart();
|
||||||
Engine.removeLoadingScreen();
|
removeLoadingScreen();
|
||||||
}
|
}
|
||||||
//Initialize labels on game settings
|
//Initialize labels on game settings
|
||||||
setSettingsLabels();
|
setSettingsLabels();
|
||||||
|
11
utils/uiHelpers/removeLoadingScreen.ts
Normal file
11
utils/uiHelpers/removeLoadingScreen.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { getElementById } from "./getElementById";
|
||||||
|
import { removeElementById } from "./removeElementById";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Routes the player from the Loading screen to the main game content.
|
||||||
|
*/
|
||||||
|
export function removeLoadingScreen() {
|
||||||
|
// TODO: Have this manipulate CSS classes instead of direct styles
|
||||||
|
removeElementById("loader");
|
||||||
|
getElementById("entire-game-container").style.visibility = "visible";
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user