mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-22 22:22:26 +01:00
more conversion
This commit is contained in:
parent
717b32b0b4
commit
a760ede129
@ -56,29 +56,6 @@ export class CorporationEventHandler {
|
||||
this.routing = routing;
|
||||
}
|
||||
|
||||
// Create a popup that lets the player discontinue a product
|
||||
createDiscontinueProductPopup(product, industry) {
|
||||
const popupId = "cmpy-mgmt-discontinue-product-popup";
|
||||
const txt = createElement("p", {
|
||||
innerText:"Are you sure you want to do this? Discontinuing a product " +
|
||||
"removes it completely and permanently. You will no longer " +
|
||||
"produce this product and all of its existing stock will be " +
|
||||
"removed and left unsold",
|
||||
});
|
||||
const confirmBtn = createElement("button", {
|
||||
class:"popup-box-button",innerText:"Discontinue",
|
||||
clickListener: () => {
|
||||
industry.discontinueProduct(product);
|
||||
removeElementById(popupId);
|
||||
this.rerender();
|
||||
return false;
|
||||
},
|
||||
});
|
||||
const cancelBtn = createPopupCloseButton(popupId, { innerText: "Cancel" });
|
||||
|
||||
createPopup(popupId, [txt, cancelBtn, confirmBtn]);
|
||||
}
|
||||
|
||||
// Create a popup that lets the player manage exports
|
||||
createExportMaterialPopup(mat) {
|
||||
const corp = this.corp;
|
||||
|
27
src/Corporation/ui/DiscontinueProductPopup.tsx
Normal file
27
src/Corporation/ui/DiscontinueProductPopup.tsx
Normal file
@ -0,0 +1,27 @@
|
||||
import React from 'react';
|
||||
import { removePopup } from "../../ui/React/createPopup";
|
||||
|
||||
interface IProps {
|
||||
product: any;
|
||||
industry: any;
|
||||
corp: any;
|
||||
popupId: string;
|
||||
}
|
||||
|
||||
// Create a popup that lets the player discontinue a product
|
||||
export function DiscontinueProductPopup(props: IProps): React.ReactElement {
|
||||
function discontinue() {
|
||||
props.industry.discontinueProduct(props.product);
|
||||
removePopup(props.popupId);
|
||||
props.corp.rerender();
|
||||
}
|
||||
|
||||
return (<>
|
||||
<p>
|
||||
Are you sure you want to do this? Discontinuing a product
|
||||
removes it completely and permanently. You will no longer
|
||||
produce this product and all of its existing stock will be
|
||||
removed and left unsold</p>
|
||||
<button className="popup-box-button" onClick={discontinue}>Discontinue</button>
|
||||
</>);
|
||||
}
|
@ -7,9 +7,11 @@ import { OfficeSpace } from "../OfficeSpace";
|
||||
import { Material } from "../Material";
|
||||
import { Product } from "../Product";
|
||||
import { Warehouse } from "../Warehouse";
|
||||
import { DiscontinueProductPopup } from "./DiscontinueProductPopup";
|
||||
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
import { dialogBoxCreate } from "../../../utils/DialogBox";
|
||||
import { createPopup } from "../../ui/React/createPopup";
|
||||
|
||||
import { isString } from "../../../utils/helpers/isString";
|
||||
|
||||
@ -71,8 +73,15 @@ function ProductComponent(props: IProductProps) {
|
||||
}
|
||||
const limitProductionButtonOnClick = eventHandler.createLimitProductProdutionPopup.bind(eventHandler, product, city);
|
||||
|
||||
// Discontinue Button
|
||||
const discontinueButtonOnClick = eventHandler.createDiscontinueProductPopup.bind(eventHandler, product, division);
|
||||
function openDiscontinueProductPopup() {
|
||||
const popupId = "cmpy-mgmt-discontinue-product-popup";
|
||||
createPopup(popupId, DiscontinueProductPopup, {
|
||||
product: product,
|
||||
industry: division,
|
||||
corp: props.corp,
|
||||
popupId: popupId,
|
||||
});
|
||||
}
|
||||
|
||||
// Market TA button
|
||||
const marketTaButtonOnClick = eventHandler.createProductMarketTaPopup.bind(eventHandler, product, division);
|
||||
@ -93,7 +102,7 @@ function ProductComponent(props: IProductProps) {
|
||||
<button className={"std-button"} onClick={limitProductionButtonOnClick}>
|
||||
{limitProductionButtonText}
|
||||
</button>
|
||||
<button className={"std-button"} onClick={discontinueButtonOnClick}>
|
||||
<button className={"std-button"} onClick={openDiscontinueProductPopup}>
|
||||
Discontinue
|
||||
</button>
|
||||
{
|
||||
@ -173,7 +182,7 @@ function ProductComponent(props: IProductProps) {
|
||||
<button className={"std-button"} onClick={limitProductionButtonOnClick}>
|
||||
{limitProductionButtonText}
|
||||
</button>
|
||||
<button className={"std-button"} onClick={discontinueButtonOnClick}>
|
||||
<button className={"std-button"} onClick={openDiscontinueProductPopup}>
|
||||
Discontinue
|
||||
</button>
|
||||
{
|
||||
|
@ -584,6 +584,13 @@ class DevMenuComponent extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
finishCorporationProducts() {
|
||||
if(!Player.corporation) return;
|
||||
Player.corporation.divisions.forEach(div => {
|
||||
Object.keys(div.products).forEach(prod => div.products[prod].prog = 99.9)
|
||||
});
|
||||
}
|
||||
|
||||
specificContract() {
|
||||
generateContract({
|
||||
problemType: this.state.codingcontract,
|
||||
@ -1169,6 +1176,11 @@ class DevMenuComponent extends Component {
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<button className="std-button" onClick={this.finishCorporationProducts}>Finish products</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user