From f3b934337f94d94a01f4307df38596967943b9fc Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Thu, 19 Aug 2021 00:26:34 -0500 Subject: [PATCH] Added board with basic time resource node --- src/data/layers/main.ts | 69 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 65 insertions(+), 4 deletions(-) diff --git a/src/data/layers/main.ts b/src/data/layers/main.ts index 0206502..f6a2046 100644 --- a/src/data/layers/main.ts +++ b/src/data/layers/main.ts @@ -1,11 +1,72 @@ +import player from "@/game/player"; +import Decimal, { DecimalSource } from "@/lib/break_eternity"; import { RawLayer } from "@/typings/layer"; +import themes from "../themes"; + +type ResourceNodeData = { + resourceType: string; + amount: DecimalSource; + maxAmount: DecimalSource; +}; export default { id: "main", display: ` -
Game Paused
-
Dev Speed: {{ format(player.devSpeed) }}x
+
Game Paused
+
Dev Speed: {{ format(player.devSpeed) }}x
TODO: Board
- `, - 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;