diff --git a/js/Demo/demoLayers.js b/js/Demo/demoLayers.js
index 9b6e2a4..ccdc10d 100644
--- a/js/Demo/demoLayers.js
+++ b/js/Demo/demoLayers.js
@@ -109,6 +109,7 @@ addLayer("c", {
description: "Gain 1 Point every second.",
cost: new Decimal(1),
unlocked() { return player[this.layer].unlocked }, // The upgrade is only visible when this is true
+ branches: [12]
},
12: {
description: "Point generation is faster based on your unspent Lollipops.",
@@ -353,7 +354,8 @@ addLayer("c", {
["raw-html", function() {return "
C O N F I R M E D "}], "blank",
["microtabs", "stuff", {'width': '600px', 'height': '350px', 'background-color': 'brown', 'border-style': 'solid'}],
["display-text", "Adjust how many points H gives you!"],
- ["slider", ["otherThingy", 1, 30]],
+ ["slider", ["otherThingy", 1, 30]], "blank", ["upgrade-tree", [[11],
+ [12, 22, 22, 11]]]
]
}
diff --git a/js/components.js b/js/components.js
index 228947a..a3711d4 100644
--- a/js/components.js
+++ b/js/components.js
@@ -172,7 +172,7 @@ function loadVue() {
Vue.component('upgrade', {
props: ['layer', 'data'],
template: `
-
@@ -506,6 +506,22 @@ function loadVue() {
`
})
+ // Data is an array with the structure of the tree
+ Vue.component('upgrade-tree', {
+ props: ['layer', 'data'],
+ computed: {
+ key() {return this.$vnode.key}
+ },
+ template: `
+
+
+
+
+
+
+ `
+ })
+
// Updates the value in player[layer][data]
Vue.component('text-input', {
props: ['layer', 'data'],
diff --git a/js/technical/canvas.js b/js/technical/canvas.js
index 4ebe9a5..f6f8e63 100644
--- a/js/technical/canvas.js
+++ b/js/technical/canvas.js
@@ -45,10 +45,19 @@ function drawTree() {
drawTreeBranch(layer, tmp[layer].branches[branch])
}
}
+ for(id in layers[layer].upgrades) {
+ if (tmp[layer].upgrades[id].branches) {
+ for (branch in tmp[layer].upgrades[id].branches)
+ {
+ drawTreeBranch(id, tmp[layer].upgrades[id].branches[branch], "upgrade-" + layer + "-")
+ }
+
+ }
+ }
}
}
-function drawTreeBranch(num1, data) { // taken from Antimatter Dimensions & adjusted slightly
+function drawTreeBranch(num1, data, prefix) { // taken from Antimatter Dimensions & adjusted slightly
let num2 = data
let color_id = 1
if (Array.isArray(data)){
@@ -58,7 +67,10 @@ function drawTreeBranch(num1, data) { // taken from Antimatter Dimensions & adju
if(typeof(color_id) == "number")
color_id = colors_theme[color_id]
-
+ if (prefix) {
+ num1 = prefix + num1
+ num2 = prefix + num2
+ }
if (document.getElementById(num1) == null || document.getElementById(num2) == null)
return
diff --git a/js/utils.js b/js/utils.js
index d3d5bb2..6ef40f1 100644
--- a/js/utils.js
+++ b/js/utils.js
@@ -85,6 +85,7 @@ function buyUpg(layer, id) {
player[layer].upgrades.push(id);
if (upg.onPurchase != undefined)
run(upg.onPurchase, upg)
+ needCanvasUpdate = true
}
function buyMaxBuyable(layer, id) {
diff --git a/style.css b/style.css
index 9e27b1d..f748442 100644
--- a/style.css
+++ b/style.css
@@ -94,9 +94,12 @@ h1, h2, h3, b, input {
color: rgba(0, 0, 0, 0.5);
text-shadow: var(--hqProperty3);
padding: 0;
- margin: 0 10px 0 10px;
}
+.treeThing {
+ margin: 0 10px 0 10px;
+ vertical-align: middle;
+}
.smallNode {
height: 60px;