1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-23 08:51:48 +00:00
Hide tooltips when value is ""
Notify highlight when challenge can be complete
"Can complete" style overrides "already completed" style
Updates to docs
This commit is contained in:
Acamaeda 2020-11-28 02:44:17 -05:00
parent 50102b3be2
commit 142f6489d7
9 changed files with 16 additions and 9 deletions

View file

@ -1,7 +1,10 @@
# The Modding Tree changelog: # The Modding Tree changelog:
### v2.2.3 - ### v2.2.3 -
- Layers will be highlighted if you can finish a challenge.
- The "can complete challenge" color now overrides the "already completed" color.
- Button nodes now work as side "layers". - Button nodes now work as side "layers".
- Setting a tooltip to "" hides it entirely.
### v2.2.2 - 11/22/20 ### v2.2.2 - 11/22/20
- Fixed right half of the screen being unclickable in some circumstances. - Fixed right half of the screen being unclickable in some circumstances.

View file

@ -31,7 +31,7 @@ Individual achievement can have these features:
- done(): A function returning a boolean to determine if the achievement should be awarded. - done(): A function returning a boolean to determine if the achievement should be awarded.
- tooltip: Default tooltip for the achievement, appears when it is hovered over. Should convey the goal and any reward for completing the achievement. It can also be a function that returns updating text. Can use basic HTML. - tooltip: Default tooltip for the achievement, appears when it is hovered over. Should convey the goal and any reward for completing the achievement. It can also be a function that returns updating text. Can use basic HTML. Setting this to "" disables the tooltip.
- effect(): **optional**. A function that calculates and returns the current values of any bonuses from the achievement. Can return a value or an object containing multiple values. - effect(): **optional**. A function that calculates and returns the current values of any bonuses from the achievement. Can return a value or an object containing multiple values.

View file

@ -23,7 +23,7 @@ tabFormat: [
It is a list of components, which can be either just a name, or an array with arguments. If it's an array, the first item is the name of the component, the second is the data passed into it, and the third (optional) applies a CSS style to it with a "CSS object", where the keys are CSS attributes. It is a list of components, which can be either just a name, or an array with arguments. If it's an array, the first item is the name of the component, the second is the data passed into it, and the third (optional) applies a CSS style to it with a "CSS object", where the keys are CSS attributes.
These are the existing components, but you can create more in [v.js](/js/v.js): These are the existing components, but you can create more in [components.js](/js/components.js):
- display-text: Displays some text (can use basic HTML). The argument is the text to display. It can also be a function that returns updating text. - display-text: Displays some text (can use basic HTML). The argument is the text to display. It can also be a function that returns updating text.

View file

@ -121,6 +121,7 @@ You can make almost any value dynamic by using a function in its place, includin
- nodeStyle: **optional**. A CSS object, where the keys are CSS attributes, which styles this layer's node on the tree. - nodeStyle: **optional**. A CSS object, where the keys are CSS attributes, which styles this layer's node on the tree.
- tooltip() / tooltipLocked(): **optional**. Functions that return text, which is the tooltip for the node when the layer is unlocked or locked, respectively. By default the tooltips behave the same as in the original Prestige Tree. - tooltip() / tooltipLocked(): **optional**. Functions that return text, which is the tooltip for the node when the layer is unlocked or locked, respectively. By default the tooltips behave the same as in the original Prestige Tree.
If the value is "", the tooltip will be disabled.
## Other features ## Other features

View file

@ -492,6 +492,7 @@ addLayer("a", {
11: { 11: {
name: "Get me!", name: "Get me!",
done() {return true}, // This one is a freebie done() {return true}, // This one is a freebie
tooltip: "",
goalTooltip: "How did this happen?", // Shows when achievement is not completed goalTooltip: "How did this happen?", // Shows when achievement is not completed
doneTooltip: "You did it!", // Showed when the achievement is completed doneTooltip: "You did it!", // Showed when the achievement is completed
}, },

View file

@ -119,7 +119,7 @@ function loadVue() {
Vue.component('challenge', { Vue.component('challenge', {
props: ['layer', 'data'], props: ['layer', 'data'],
template: ` template: `
<div v-if="tmp[layer].challenges && tmp[layer].challenges[data]!== undefined && tmp[layer].challenges[data].unlocked && !(player.hideChallenges && maxedChallenge(layer, [data]))" v-bind:class="{hChallenge: true, done: hasChallenge(layer, data), canComplete: player[layer].activeChallenge == data&&!hasChallenge(layer, data)&&canCompleteChallenge(layer, data)}"> <div v-if="tmp[layer].challenges && tmp[layer].challenges[data]!== undefined && tmp[layer].challenges[data].unlocked && !(player.hideChallenges && maxedChallenge(layer, [data]))" v-bind:class="{hChallenge: true, done: hasChallenge(layer, data), canComplete: player[layer].activeChallenge == data && canCompleteChallenge(layer, data)}">
<br><h3 v-html="tmp[layer].challenges[data].name"></h3><br><br> <br><h3 v-html="tmp[layer].challenges[data].name"></h3><br><br>
<button v-bind:class="{ longUpg: true, can: true, [layer]: true }" v-bind:style="{'background-color': tmp[layer].color}" v-on:click="startChallenge(layer, data)">{{player[layer].activeChallenge==(data)?(canCompleteChallenge(layer, data)?"Finish":"Exit Early"):(hasChallenge(layer, data)?"Completed":"Start")}}</button><br><br> <button v-bind:class="{ longUpg: true, can: true, [layer]: true }" v-bind:style="{'background-color': tmp[layer].color}" v-on:click="startChallenge(layer, data)">{{player[layer].activeChallenge==(data)?(canCompleteChallenge(layer, data)?"Finish":"Exit Early"):(hasChallenge(layer, data)?"Completed":"Start")}}</button><br><br>
<span v-html="tmp[layer].challenges[data].challengeDescription"></span><br> <span v-html="tmp[layer].challenges[data].challengeDescription"></span><br>
@ -357,7 +357,7 @@ function loadVue() {
template: ` template: `
<div v-if="tmp[layer].achievements && tmp[layer].achievements[data]!== undefined && tmp[layer].achievements[data].unlocked" v-bind:class="{ [layer]: true, achievement: true, locked: !hasAchievement(layer, data), bought: hasAchievement(layer, data)}" <div v-if="tmp[layer].achievements && tmp[layer].achievements[data]!== undefined && tmp[layer].achievements[data].unlocked" v-bind:class="{ [layer]: true, achievement: true, locked: !hasAchievement(layer, data), bought: hasAchievement(layer, data)}"
v-bind:tooltip=" v-bind:tooltip="
hasAchievement(layer, data) ? (tmp[layer].achievements[data].doneTooltip ? tmp[layer].achievements[data].doneTooltip : (tmp[layer].achievements[data].tooltip ? tmp[layer].achievements[data].tooltip : 'You did it!')) (tmp[layer].achievements[data].tooltip == '') ? false : hasAchievement(layer, data) ? (tmp[layer].achievements[data].doneTooltip ? tmp[layer].achievements[data].doneTooltip : (tmp[layer].achievements[data].tooltip ? tmp[layer].achievements[data].tooltip : 'You did it!'))
: (tmp[layer].achievements[data].goalTooltip ? tmp[layer].achievements[data].goalTooltip : (tmp[layer].achievements[data].tooltip ? tmp[layer].achievements[data].tooltip : 'LOCKED')) : (tmp[layer].achievements[data].goalTooltip ? tmp[layer].achievements[data].goalTooltip : (tmp[layer].achievements[data].tooltip ? tmp[layer].achievements[data].tooltip : 'LOCKED'))
" "

View file

@ -69,7 +69,9 @@ function shouldNotify(layer){
} }
} }
} }
if (player[layer].activeChallenge && canCompleteChallenge(layer, player[layer].activeChallenge)) {
return true
}
if (tmp[layer].shouldNotify){ if (tmp[layer].shouldNotify){
return tmp[layer].shouldNotify return tmp[layer].shouldNotify
} }

View file

@ -22,7 +22,7 @@ addLayer("p", {
}, },
row: 0, // Row the layer is in on the tree (0 is the first row) row: 0, // Row the layer is in on the tree (0 is the first row)
hotkeys: [ hotkeys: [
{key: "p", description: "Reset for prestige points", onPress(){if (canReset(this.layer)) doReset(this.layer)}}, {key: "p", description: "P: Reset for prestige points", onPress(){if (canReset(this.layer)) doReset(this.layer)}},
], ],
layerShown(){return true} layerShown(){return true}
}) })

View file

@ -20,7 +20,7 @@ var systemComponents = {
else {layers[layer].onClick()} else {layers[layer].onClick()}
}" }"
v-bind:tooltip=" (tmp[layer].isLayer) ? ( v-bind:tooltip="(tmp[layer].tooltip == '') ? false : (tmp[layer].isLayer) ? (
player[layer].unlocked ? (tmp[layer].tooltip ? tmp[layer].tooltip : formatWhole(player[layer].points) + ' ' + tmp[layer].resource) player[layer].unlocked ? (tmp[layer].tooltip ? tmp[layer].tooltip : formatWhole(player[layer].points) + ' ' + tmp[layer].resource)
: (tmp[layer].tooltipLocked ? tmp[layer].tooltipLocked : 'Reach ' + formatWhole(tmp[layer].requires) + ' ' + tmp[layer].baseResource + ' to unlock (You have ' + formatWhole(tmp[layer].baseAmount) + ' ' + tmp[layer].baseResource + ')') : (tmp[layer].tooltipLocked ? tmp[layer].tooltipLocked : 'Reach ' + formatWhole(tmp[layer].requires) + ' ' + tmp[layer].baseResource + ' to unlock (You have ' + formatWhole(tmp[layer].baseAmount) + ' ' + tmp[layer].baseResource + ')')
) )
@ -39,7 +39,7 @@ var systemComponents = {
locked: tmp[layer].isLayer ? !(player[layer].unlocked || tmp[layer].canReset) : !(tmp[layer].canClick), locked: tmp[layer].isLayer ? !(player[layer].unlocked || tmp[layer].canReset) : !(tmp[layer].canClick),
notify: tmp[layer].notify, notify: tmp[layer].notify,
resetNotify: tmp[layer].prestigeNotify, resetNotify: tmp[layer].prestigeNotify,
can: (player[layer].unlocked && tmp[layer].isLayer) || (!tmp[layer].isLayer && tmp[layer].canClick), can: ((player[layer].unlocked || tmp[layer].isLayer) && tmp[layer].isLayer) || (!tmp[layer].isLayer && tmp[layer].canClick),
}" }"
v-bind:style="[(tmp[layer].isLayer && layerunlocked(layer)) || (!tmp[layer].isLayer && tmp[layer].canClick) ? { v-bind:style="[(tmp[layer].isLayer && layerunlocked(layer)) || (!tmp[layer].isLayer && tmp[layer].canClick) ? {
'background-color': tmp[layer].color, 'background-color': tmp[layer].color,