more conversion

This commit is contained in:
Olivier Gagnon 2021-08-31 03:18:44 -04:00
parent 1ae17677c0
commit 68885ceff5
7 changed files with 89 additions and 15 deletions

@ -0,0 +1,61 @@
import { Industry } from "./Industry";
import { IPlayer } from "../PersonObjects/IPlayer";
import { CorporationUnlockUpgrade } from "./data/CorporationUnlockUpgrades";
import { CorporationUpgrade } from "./data/CorporationUpgrades";
import { CorporationState } from "./CorporationState";
export interface ICorporation {
name: string;
divisions: Industry[];
funds: any;
revenue: any;
expenses: any;
fundingRound: number;
public: boolean;
totalShares: number;
numShares: number;
shareSalesUntilPriceUpdate: number;
shareSaleCooldown: number;
issueNewSharesCooldown: number;
dividendPercentage: number;
dividendTaxPercentage: number;
issuedShares: number;
sharePrice: number;
storedCycles: number;
unlockUpgrades: number[];
upgrades: number[];
upgradeMultipliers: number[];
state: CorporationState;
addFunds(amt: number): void;
getState(): string;
storeCycles(numCycles: number): void;
process(player: IPlayer): void;
determineValuation(): number;
getTargetSharePrice(): number;
updateSharePrice(): void;
immediatelyUpdateSharePrice(): void;
calculateShareSale(numShares: number): [number, number, number];
convertCooldownToString(cd: number): string;
unlock(upgrade: CorporationUnlockUpgrade): void;
upgrade(upgrade: CorporationUpgrade): void;
getProductionMultiplier(): number;
getStorageMultiplier(): number;
getDreamSenseGain(): number;
getAdvertisingMultiplier(): number;
getEmployeeCreMultiplier(): number;
getEmployeeChaMultiplier(): number;
getEmployeeIntMultiplier(): number;
getEmployeeEffMultiplier(): number;
getSalesMultiplier(): number;
getScientificResearchMultiplier(): number;
getStarterGuide(player: IPlayer): void;
createUI(player: IPlayer): void;
rerender(player: IPlayer): void;
clearUI(): void;
toJSON(): any;
}

@ -5,13 +5,15 @@ import { CityTab } from "./CityTab";
import { ExpandNewCityPopup } from "./ExpandNewCityPopup";
import { createPopup } from "../../ui/React/createPopup";
import { IDivision } from "../IDivision";
import { ICorporation } from "../ICorporation";
import { CorporationRouting } from "./Routing";
interface IProps {
routing: any;
routing: CorporationRouting;
onClicks: {[key: string]: () => void};
city: string; // currentCity
cityStateSetter: (city: string) => void;
corp: any;
corp: ICorporation;
}
export function CityTabs(props: IProps): React.ReactElement {

@ -6,16 +6,20 @@ import { HeaderTab } from "./HeaderTab";
import { IDivision } from "../IDivision";
import { NewIndustryPopup } from "./NewIndustryPopup";
import { createPopup } from "../../ui/React/createPopup";
import { ICorporation } from "../ICorporation";
import { CorporationRouting } from "./Routing";
import { IPlayer } from "../../PersonObjects/IPlayer";
interface IProps {
corp: any;
routing: any;
corp: ICorporation;
routing: CorporationRouting;
player: IPlayer;
}
export function HeaderTabs(props: IProps): React.ReactElement {
function overviewOnClick(): void {
props.routing.routeToOverviewPage();
props.corp.rerender();
props.corp.rerender(props.player);
}
function openNewIndustryPopup(): void {
@ -41,7 +45,7 @@ export function HeaderTabs(props: IProps): React.ReactElement {
key={division.name}
onClick={() => {
props.routing.routeTo(division.name);
props.corp.rerender();
props.corp.rerender(props.player);
}}
text={division.name}
/>)

@ -5,10 +5,12 @@ import React from "react";
import { IndustryOffice } from "./IndustryOffice";
import { IndustryOverview } from "./IndustryOverview";
import { IndustryWarehouse } from "./IndustryWarehouse";
import { ICorporation } from "../ICorporation";
import { CorporationRouting } from "./Routing";
interface IProps {
routing: any;
corp: any;
routing: CorporationRouting;
corp: ICorporation;
currentCity: string;
}

@ -11,10 +11,12 @@ import { OfficeSpace } from "../OfficeSpace";
import { CityName } from "../../Locations/data/CityNames";
import { IPlayer } from "../../PersonObjects/IPlayer";
import { ICorporation } from "../ICorporation";
import { CorporationRouting } from "./Routing";
interface IProps {
corp: any;
routing: any;
corp: ICorporation;
routing: CorporationRouting;
player: IPlayer;
}
@ -52,7 +54,7 @@ export function MainPanel(props: IProps): React.ReactElement {
if (division.offices[cityName] instanceof OfficeSpace) {
onClicks[cityName] = () => {
setCity(cityName);
props.corp.rerender();
props.corp.rerender(props.player);
}
}
}

@ -19,9 +19,10 @@ import { numeralWrapper } from "../../ui/numeralFormat";
import { convertTimeMsToTimeElapsedString } from "../../../utils/StringHelperFunctions";
import { createPopup } from "../../ui/React/createPopup";
import { IPlayer } from "../../PersonObjects/IPlayer";
import { ICorporation } from "../ICorporation";
interface IProps {
corp: any;
corp: ICorporation;
player: IPlayer;
}

@ -4,17 +4,19 @@ import React from "react";
import { HeaderTabs } from "./HeaderTabs";
import { MainPanel } from "./MainPanel";
import { IPlayer } from "../../PersonObjects/IPlayer";
import { ICorporation } from "../ICorporation";
import { CorporationRouting } from "./Routing";
interface IProps {
corp: any;
routing: any;
corp: ICorporation;
routing: CorporationRouting;
player: IPlayer;
}
export function CorporationRoot(props: IProps): React.ReactElement {
return (
<div>
<HeaderTabs corp={props.corp} routing={props.routing} />
<HeaderTabs corp={props.corp} routing={props.routing} player={props.player} />
<MainPanel corp={props.corp} routing={props.routing} player={props.player} />
</div>
)