Skip to content

Commit

Permalink
v1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jpknen authored Jul 30, 2024
1 parent f3d664d commit 7fdbbfd
Showing 1 changed file with 47 additions and 41 deletions.
88 changes: 47 additions & 41 deletions src/ui/mainwin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,62 +14,68 @@ const userActions = {
}
};

const widgets: WidgetDesc[] | undefined = [];
function Widgets(): WidgetDesc[] {

widgets.push({
type: "checkbox",
x: 5, y: 20, width: 60, height: 15,
isChecked: storage.sharedStorage.get("enabled"),
text: "Enabled",
onChange: userActions.enabled
});

widgets.push({
type: "label",
x: 5, y: 45, width: 190, height: 40,
textAlign: "centred",
text: "Only mechanics are able to repair\nbroken additions."
});

if (globals.isDebug) {
const widgets: WidgetDesc[] = [];

widgets.push({
type: "button",
x: 5, y: 70, width: 190, height: 20,
text: "log",
onClick: function () {
console.log(workers.data);
console.log(occupiedTiles.data);
}
type: "checkbox",
x: 5, y: 20, width: 60, height: 15,
isChecked: storage.sharedStorage.get("enabled"),
text: "Enabled",
onChange: userActions.enabled
});

widgets.push({
type: "button",
x: 5, y: 90, width: 190, height: 20,
text: "clear",
onClick: function () {
workers.data = {};
occupiedTiles.data = {};
UpdateWorkersData();
}
type: "label",
x: 5, y: 45, width: 190, height: 40,
textAlign: "centred",
text: "Only mechanics are able to repair\nbroken additions."
});

}
if (globals.isDebug) {

const winDesc: WindowDesc = {
classification: "animated_vandalism_repairing",
width: 200, height: globals.isDebug ? 115 : 70,
title: "Animated vandalism repairing",
widgets: widgets
};
widgets.push({
type: "button",
x: 5, y: 70, width: 190, height: 20,
text: "log",
onClick: () => {
console.log(workers.data);
console.log(occupiedTiles.data);
}
});

widgets.push({
type: "button",
x: 5, y: 90, width: 190, height: 20,
text: "clear",
onClick: () => {
workers.data = {};
occupiedTiles.data = {};
UpdateWorkersData();
}
});

}

return widgets;
}

export const mainWin = {
open(): void {
const win: Window = ui.getWindow("animated_vandalism_repairing")
const win: Window = ui.getWindow("animated_vandalism_repairing");
if (win) {
win.bringToFront();
return;
}
let winDesc: WindowDesc = {
classification: "animated_vandalism_repairing",
width: 200, height: globals.isDebug ? 115 : 70,
title: "Animated vandalism repairing",
widgets: Widgets()
};
ui.openWindow(winDesc);
}
};
};


0 comments on commit 7fdbbfd

Please sign in to comment.