engine work

This commit is contained in:
Olivier Gagnon 2021-09-09 13:48:21 -04:00
parent 0a210555e9
commit f77ab4e871
5 changed files with 14 additions and 53 deletions

@ -1,6 +1,8 @@
@import "theme"; @import "theme";
#bladeburner-container { #bladeburner-container {
position: fixed;
padding: 6px;
a, a,
div, div,
p, p,

@ -15,7 +15,7 @@ interface IProps {
export function Root(props: IProps): React.ReactElement { export function Root(props: IProps): React.ReactElement {
return ( return (
<div id="bladeburner-container"> <>
<div style={{ height: "60%", display: "block", position: "relative" }}> <div style={{ height: "60%", display: "block", position: "relative" }}>
<div <div
style={{ style={{
@ -41,6 +41,6 @@ export function Root(props: IProps): React.ReactElement {
> >
<AllPages bladeburner={props.bladeburner} player={props.player} /> <AllPages bladeburner={props.bladeburner} player={props.player} />
</div> </div>
</div> </>
); );
} }

@ -1,28 +0,0 @@
import * as React from "react";
import * as ReactDOM from "react-dom";
import { IPlayer } from "../PersonObjects/IPlayer";
import { IEngine } from "../IEngine";
import { Root } from "./ui/Root";
import { Gang } from "./Gang";
import { Page, routing } from ".././ui/navigationTracking";
let gangContainer: HTMLElement;
(function () {
function set(): void {
const c = document.getElementById("gang-container");
if (c === null) throw new Error("Could not find element 'gang-container'");
gangContainer = c;
document.removeEventListener("DOMContentLoaded", set);
}
document.addEventListener("DOMContentLoaded", set);
})();
export function displayGangContent(engine: IEngine, gang: Gang, player: IPlayer): void {
if (!routing.isOn(Page.Gang)) {
return;
}
ReactDOM.render(<Root engine={engine} gang={gang} player={player} />, gangContainer);
}

@ -19,8 +19,8 @@ import { createDevMenu, closeDevMenu } from "./DevMenu";
import { Factions, initFactions } from "./Faction/Factions"; import { Factions, initFactions } from "./Faction/Factions";
import { processPassiveFactionRepGain, inviteToFaction } from "./Faction/FactionHelpers"; import { processPassiveFactionRepGain, inviteToFaction } from "./Faction/FactionHelpers";
import { FactionList } from "./Faction/ui/FactionList"; import { FactionList } from "./Faction/ui/FactionList";
import { displayGangContent } from "./Gang/Helpers";
import { Root as BladeburnerRoot } from "./Bladeburner/ui/Root"; import { Root as BladeburnerRoot } from "./Bladeburner/ui/Root";
import { Root as GangRoot } from "./Gang/ui/Root";
import { displayInfiltrationContent } from "./Infiltration/Helper"; import { displayInfiltrationContent } from "./Infiltration/Helper";
import { import {
getHackingWorkRepGain, getHackingWorkRepGain,
@ -390,7 +390,7 @@ const Engine = {
if (Player.inGang()) { if (Player.inGang()) {
Engine.Display.gangContent.style.display = "block"; Engine.Display.gangContent.style.display = "block";
routing.navigateTo(Page.Gang); routing.navigateTo(Page.Gang);
displayGangContent(this, Player.gang, Player); ReactDOM.render(<GangRoot engine={this} gang={Player.gang} player={Player} />, Engine.Display.gangContent);
} else { } else {
Engine.loadTerminalContent(); Engine.loadTerminalContent();
routing.navigateTo(Page.Terminal); routing.navigateTo(Page.Terminal);
@ -406,11 +406,10 @@ const Engine = {
}, },
loadCorporationContent: function () { loadCorporationContent: function () {
if (Player.corporation instanceof Corporation) { if (!(Player.corporation instanceof Corporation)) return;
Engine.hideAllContent(); Engine.hideAllContent();
routing.navigateTo(Page.Corporation); routing.navigateTo(Page.Corporation);
Player.corporation.createUI(Player); Player.corporation.createUI(Player);
}
}, },
loadBladeburnerContent: function () { loadBladeburnerContent: function () {
@ -489,9 +488,6 @@ const Engine = {
Engine.Display.cinematicTextContent.style.display = "none"; Engine.Display.cinematicTextContent.style.display = "none";
Engine.Display.stockMarketContent.style.display = "none"; Engine.Display.stockMarketContent.style.display = "none";
Engine.Display.missionContent.style.display = "none"; Engine.Display.missionContent.style.display = "none";
if (document.getElementById("gang-container")) {
document.getElementById("gang-container").style.display = "none";
}
if (Player.corporation instanceof Corporation) { if (Player.corporation instanceof Corporation) {
Player.corporation.clearUI(Player); Player.corporation.clearUI(Player);
@ -1251,7 +1247,7 @@ const Engine = {
Engine.Display.gangContent = document.getElementById("gang-container"); Engine.Display.gangContent = document.getElementById("gang-container");
Engine.Display.gangContent.style.display = "none"; Engine.Display.gangContent.style.display = "none";
Engine.Display.bladeburnerContent = document.getElementById("gang-container"); Engine.Display.bladeburnerContent = document.getElementById("bladeburner-container");
Engine.Display.bladeburnerContent.style.display = "none"; Engine.Display.bladeburnerContent.style.display = "none";
Engine.Display.missionContent = document.getElementById("mission-container"); Engine.Display.missionContent = document.getElementById("mission-container");

@ -284,9 +284,6 @@
<!-- Milestones content --> <!-- Milestones content -->
<div id="milestones-container" class="generic-menupage-container"></div> <div id="milestones-container" class="generic-menupage-container"></div>
<!-- Bladeburner -->
<div id="bladeburner-container" class="generic-menupage-container"></div>
<!-- Tutorial content --> <!-- Tutorial content -->
<div id="tutorial-container" class="generic-menupage-container"> <div id="tutorial-container" class="generic-menupage-container">
<h1>Tutorial (AKA Links to Documentation)</h1> <h1>Tutorial (AKA Links to Documentation)</h1>
@ -364,16 +361,10 @@
<!-- Location (visiting a location in World) --> <!-- Location (visiting a location in World) -->
<div id="location-container" class="generic-menupage-container"></div> <div id="location-container" class="generic-menupage-container"></div>
<div id="infiltration-container" class="generic-fullscreen-container"></div> <div id="infiltration-container" class="generic-fullscreen-container"></div>
<div id="stock-market-container" class="generic-menupage-container"></div>
<div id="stock-market-container" class="generic-menupage-container"> <div id="bladeburner-container" class="generic-menupage-container"></div>
<!-- React Component --> <div id="gang-container" class="generic-menupage-container"></div>
</div>
<div id="gang-container" class="generic-menupage-container">
<!-- React Component -->
</div>
<!-- Generic Yes/No Pop Up box --> <!-- Generic Yes/No Pop Up box -->
<div id="yes-no-box-container" class="popup-box-container"> <div id="yes-no-box-container" class="popup-box-container">