From ff2fc625f7464f7f59a7198160e114b5038a4f1d Mon Sep 17 00:00:00 2001 From: Harley White Date: Mon, 7 Jun 2021 19:40:34 -0400 Subject: [PATCH] Buyable and clickable trees --- changelog.md | 2 ++ docs/buyables.md | 6 +++++- docs/clickables.md | 4 ++++ docs/custom-tab-layouts.md | 2 +- js/components.js | 21 +++++++++++++++++++-- js/technical/canvas.js | 20 ++++++++++++++------ 6 files changed, 45 insertions(+), 10 deletions(-) diff --git a/changelog.md b/changelog.md index 4e6f6d4..c407070 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,7 @@ # The Modding Tree changelog: +- Added buyable and clickable trees. + ## v2.6.1 - 6/7/21 - Added global background style to mod.js. - Tree branches can have custom line widths. diff --git a/docs/buyables.md b/docs/buyables.md index f75d37e..baf568e 100644 --- a/docs/buyables.md +++ b/docs/buyables.md @@ -77,4 +77,8 @@ You can use these features along with it: - showRespec(): **optional**. A function determining whether or not to show the button, if respecBuyables is defined. Defaults to true if absent. -- respecMessage: **optional**. A custom confirmation message on respec, in place of the default one. \ No newline at end of file +- respecMessage: **optional**. A custom confirmation message on respec, in place of the default one. + + + +- branches: **optional**, This is primarially useful for buyable trees. An array of buyable ids. A line will appear from this buyable to all of the buyables in the list. Alternatively, an entry in the array can be a 2-element array consisting of the buyable id and a color value. The color value can either be a string with a hex color code, or a number from 1-3 (theme-affected colors). A third element in the array optionally specifies line width. \ No newline at end of file diff --git a/docs/clickables.md b/docs/clickables.md index d685dee..42d7e25 100644 --- a/docs/clickables.md +++ b/docs/clickables.md @@ -55,3 +55,7 @@ You can also use these features on the clickables object to add a button above a - masterButtonText: **optional**. Text to display on the Master Button. - showMasterButton(): **optional**. A function determining whether or not to show the button, if masterButtonPress is defined. Defaults to true if absent. + + + +- branches: **optional**, This is primarially useful for clickable trees. An array of clickable ids. A line will appear from this clickable to all of the clickables in the list. Alternatively, an entry in the array can be a 2-element array consisting of the clickable id and a color value. The color value can either be a string with a hex color code, or a number from 1-3 (theme-affected colors). A third element in the array optionally specifies line width. \ No newline at end of file diff --git a/docs/custom-tab-layouts.md b/docs/custom-tab-layouts.md index f1e4543..9c9f944 100644 --- a/docs/custom-tab-layouts.md +++ b/docs/custom-tab-layouts.md @@ -62,7 +62,7 @@ These are the existing components, but you can create more in [components.js](/j - tree: Displays a tree. The argument is an array of arrays containing the names of the nodes in the tree (first by row, then by column) [See here for more information on tree layouts and nodes!](trees-and-tree-customization.md) -- upgrade-tree: Displays a of upgrades from this layer. The argument is an array of arrays containing the ids of the upgrades in the tree (first by row, then by column) +- upgrade-tree, buyable-tree, clickable-tree: Displays a tree of upgrades/buyables/clickables from this layer. The argument is an array of arrays containing the ids of the upgrade/etc in the tree (first by row, then by column). A tree can only have one type of component in it. - toggle: A toggle button that toggles a bool value. The argument is a pair that identifies the location in player of the bool to toggle, e.g. `[layer, id]`. 'layer' also affects the color of the toggle. diff --git a/js/components.js b/js/components.js index 9443830..c51ab1e 100644 --- a/js/components.js +++ b/js/components.js @@ -273,7 +273,7 @@ function loadVue() {