1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-22 00:21:32 +00:00

More achievement customization

This commit is contained in:
Acamaeda 2020-12-09 01:36:27 -05:00
parent d6259fc67d
commit 66dc5e4671
5 changed files with 11 additions and 4 deletions

View file

@ -1,11 +1,12 @@
# The Modding Tree changelog: # The Modding Tree changelog:
## v2.3: Cooler and Newer - 12/ ## v2.3: Cooler and Newer - 12/09/20
- Added achievement/milestone popups (thank you to Jacorb for this contribution!) - Added achievement/milestone popups (thank you to Jacorb for this contribution!)
(They have to be enabled with layer features) (They have to be enabled with layer features)
- The changelog tab is back, and can be set in mod.js. - The changelog tab is back, and can be set in mod.js.
- Layer nodes and respec buttons no longer stay focused after clicking them so you don't accidentally press them again with "enter". - Layer nodes and respec buttons will not be clicked by pressing "enter".
- The victory screen text is configurable. - The victory screen text is configurable.
- Added image and textStyle features to achievements.
- Added an argument to use specific rows in an "upgrades" component. - Added an argument to use specific rows in an "upgrades" component.
- Fixed the comma appearing in the main display when there was no effectDescription - Fixed the comma appearing in the main display when there was no effectDescription
- Added the ability to easily make a tab that is a collection of layers in subtabs. - Added the ability to easily make a tab that is a collection of layers in subtabs.

View file

@ -39,8 +39,12 @@ Individual achievement can have these features:
- onComplete() - **optional**. this function will be called when the achievement is completed. - onComplete() - **optional**. this function will be called when the achievement is completed.
- image: **optional**, puts the image from the given URL (relative or absolute) in the achievement
- style: **optional**. Applies CSS to this achievement, in the form of an object where the keys are CSS attributes, and the values are the values for those attributes (both as strings). - style: **optional**. Applies CSS to this achievement, in the form of an object where the keys are CSS attributes, and the values are the values for those attributes (both as strings).
- textStyle: **optional**. Applies CSS to the text, in the form of an object where the keys are CSS attributes, and the values are the values for those attributes (both as strings).
- layer: **assigned automagically**. It's the same value as the name of this layer, so you can do `player[this.layer].points` or similar. - layer: **assigned automagically**. It's the same value as the name of this layer, so you can do `player[this.layer].points` or similar.
- id: **assigned automagically**. It's the "key" which the achievement was stored under, for convenient access. The achievement in the example's id is 11. - id: **assigned automagically**. It's the "key" which the achievement was stored under, for convenient access. The achievement in the example's id is 11.

View file

@ -493,6 +493,7 @@ addLayer("a", {
rows: 2, rows: 2,
cols: 3, cols: 3,
11: { 11: {
image: "discord.png",
name: "Get me!", name: "Get me!",
done() {return true}, // This one is a freebie done() {return true}, // This one is a freebie
goalTooltip: "How did this happen?", // Shows when achievement is not completed goalTooltip: "How did this happen?", // Shows when achievement is not completed
@ -503,6 +504,7 @@ addLayer("a", {
done() {return false}, done() {return false},
goalTooltip: "Mwahahaha!", // Shows when achievement is not completed goalTooltip: "Mwahahaha!", // Shows when achievement is not completed
doneTooltip: "HOW????", // Showed when the achievement is completed doneTooltip: "HOW????", // Showed when the achievement is completed
textStyle: {'color': '#04e050'},
}, },
13: { 13: {
name: "EIEIO", name: "EIEIO",

View file

@ -369,7 +369,7 @@ function loadVue() {
" "
v-bind:style="tmp[layer].achievements[data].computedStyle"> v-bind:style="tmp[layer].achievements[data].computedStyle">
<span v-if= "tmp[layer].achievements[data].name"><br><h3 v-html="tmp[layer].achievements[data].name"></h3><br></span> <span v-if= "tmp[layer].achievements[data].name"><br><h3 v-bind:style="tmp[layer].achievements[data].textStyle" v-html="tmp[layer].achievements[data].name"></h3><br></span>
</div> </div>
` `
}) })

View file

@ -155,7 +155,7 @@ function constructAchievementStyles(layer){
if (isPlainObject(ach)) { if (isPlainObject(ach)) {
let style = [] let style = []
if (ach.image){ if (ach.image){
style.push({'background-image': ach.image}) style.push({'background-image': 'url("' + ach.image + '")'})
} }
if (!ach.unlocked) style.push({'visibility': 'hidden'}) if (!ach.unlocked) style.push({'visibility': 'hidden'})
style.push(ach.style) style.push(ach.style)