Added board with basic time resource node
This commit is contained in:
parent
d47ce3525d
commit
f3b934337f
1 changed files with 65 additions and 4 deletions
|
@ -1,4 +1,13 @@
|
||||||
|
import player from "@/game/player";
|
||||||
|
import Decimal, { DecimalSource } from "@/lib/break_eternity";
|
||||||
import { RawLayer } from "@/typings/layer";
|
import { RawLayer } from "@/typings/layer";
|
||||||
|
import themes from "../themes";
|
||||||
|
|
||||||
|
type ResourceNodeData = {
|
||||||
|
resourceType: string;
|
||||||
|
amount: DecimalSource;
|
||||||
|
maxAmount: DecimalSource;
|
||||||
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
id: "main",
|
id: "main",
|
||||||
|
@ -6,6 +15,58 @@ export default {
|
||||||
<div v-if="player.devSpeed === 0">Game Paused</div>
|
<div v-if="player.devSpeed === 0">Game Paused</div>
|
||||||
<div v-else-if="player.devSpeed && player.devSpeed !== 1">Dev Speed: {{ format(player.devSpeed) }}x</div>
|
<div v-else-if="player.devSpeed && player.devSpeed !== 1">Dev Speed: {{ format(player.devSpeed) }}x</div>
|
||||||
<div>TODO: Board</div>
|
<div>TODO: Board</div>
|
||||||
|
<Board id="main" />
|
||||||
`,
|
`,
|
||||||
minimizable: false
|
minimizable: false,
|
||||||
|
componentStyles: {
|
||||||
|
board: {
|
||||||
|
position: "absolute",
|
||||||
|
top: "0",
|
||||||
|
left: "0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
boards: {
|
||||||
|
data: {
|
||||||
|
main: {
|
||||||
|
height: "100%",
|
||||||
|
startNodes() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
position: { x: 0, y: 0 },
|
||||||
|
type: "resource",
|
||||||
|
data: {
|
||||||
|
resourceType: "time",
|
||||||
|
amount: new Decimal(24 * 60 * 60),
|
||||||
|
maxAmount: new Decimal(24 * 60 * 60)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
},
|
||||||
|
types: {
|
||||||
|
resource: {
|
||||||
|
title(node) {
|
||||||
|
return (node.data as ResourceNodeData).resourceType;
|
||||||
|
},
|
||||||
|
draggable: true,
|
||||||
|
progress(node) {
|
||||||
|
const data = node.data as ResourceNodeData;
|
||||||
|
return Decimal.div(data.amount, data.maxAmount).toNumber();
|
||||||
|
},
|
||||||
|
fillColor() {
|
||||||
|
return themes[player.theme].variables["--background"];
|
||||||
|
},
|
||||||
|
progressColor(node) {
|
||||||
|
const data = node.data as ResourceNodeData;
|
||||||
|
switch (data.resourceType) {
|
||||||
|
case "time":
|
||||||
|
return "#0FF3";
|
||||||
|
default:
|
||||||
|
return "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} as RawLayer;
|
} as RawLayer;
|
||||||
|
|
Loading…
Reference in a new issue