From d2476ebde6c030bdc21e3184851b848523a85b87 Mon Sep 17 00:00:00 2001 From: Acamaeda Date: Tue, 29 Sep 2020 18:31:38 -0400 Subject: [PATCH] Added arbitrary HTML and CSS components, and made the main resource display a component --- index.html | 5 +---- js/layers.js | 2 +- js/v.js | 40 +++++++++++++++++++++++++--------------- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/index.html b/index.html index f570fc3..933ce7b 100644 --- a/index.html +++ b/index.html @@ -124,8 +124,7 @@



- You have

{{formatWhole(player[layer].points)}}

{{layers[layer].resource}}, {{layers[layer].effectDescription()}} -

+
You have {{formatWhole(tmp.layerAmt[layer])}} {{layers[layer].baseResource}}


@@ -139,8 +138,6 @@



- You have

{{formatWhole(player[layer].points)}}

{{layers[layer].resource}}, {{layers[layer].effectDescription()}} -

diff --git a/js/layers.js b/js/layers.js index ee79290..35e5786 100644 --- a/js/layers.js +++ b/js/layers.js @@ -99,7 +99,7 @@ var layers = { incr_order: [], // Array of layer names to have their order increased when this one is first unlocked // Optional, lets you format the tab yourself by listing components. You can create your own components in v.js. - tabFormat: [["colored-text", function() {return 'I have ' + format(player.points) + ' pointy points!'}, "red"], "blank", ["toggle", ["c", "beep"]], "milestones", "blank", "blank", "upgrades"] + tabFormat: ["main-display", ["prestige-button", function(){return "Melt your points into "}], ["raw-html", function() {return ""}], ["display-text", function() {return 'I have ' + format(player.points) + ' pointy points!'}, {"color": "red", "font-size": "32px", "font-family": "Comic Sans MS"}], "blank", ["toggle", ["c", "beep"]], "milestones", "blank", "blank", "upgrades"] }, f: { diff --git a/js/v.js b/js/v.js index 394fd66..926f452 100644 --- a/js/v.js +++ b/js/v.js @@ -81,31 +81,41 @@ function loadVue() { ` }) - + // data = function to return the text describing the reset before the amount gained (optional) Vue.component('prestige-button', { - props: ['layer'], - template: ` - - - ` - }) - - // data = content - Vue.component('display-text', { props: ['layer', 'data'], template: ` - {{data()}} + + + + ` }) - // text, colorful and with the shadowy effect. You can probably do other custom text effects if you want. - Vue.component('colored-text', { - props: ['layer', 'data', 'data2'], + // Displays the main resource for the layer + Vue.component('main-display', { + props: ['layer'], template: ` - {{data()}} +
You have

{{formatWhole(player[layer].points)}}

{{layers[layer].resource}}, {{layers[layer].effectDescription()}}

` }) + // data = a function returning the content, data2 = a CSS object with the formatting (optional) + Vue.component('display-text', { + props: ['layer', 'data' , 'data2'], + template: ` + {{data()}} + ` + }) + + // data = a function returning html content, with some limited functionality + Vue.component('raw-html', { + props: ['layer', 'data'], + template: ` + + ` + }) + // Blank lines Vue.component('blank', { props: ['layer', 'data'],