Fix respecing buyables
This commit is contained in:
parent
6a13fdbfaa
commit
273b9e0118
5 changed files with 13 additions and 14 deletions
|
@ -53,12 +53,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
respec() {
|
respec() {
|
||||||
// If they're controlling confirmRespec, assume they're also controlling what's being respecced
|
layers[this.layer || this.tab.layer].buyables.respec?.();
|
||||||
if (this.confirmRespec != undefined) {
|
|
||||||
this.$emit("respec");
|
|
||||||
} else {
|
|
||||||
layers[this.layer || this.tab.layer].buyables.respec();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,12 +17,8 @@
|
||||||
<div slot="footer">
|
<div slot="footer">
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<div class="modal-flex-grow"></div>
|
<div class="modal-flex-grow"></div>
|
||||||
<button class="button modal-button danger" @click="cancel">
|
<danger-button class="button modal-button" @click="confirm" skipConfirm>Yes</danger-button>
|
||||||
Yes!
|
<button class="button modal-button" @click="cancel">Cancel</button>
|
||||||
</button>
|
|
||||||
<button class="button modal-button" @click="cancel">
|
|
||||||
Cancel
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
|
@ -18,7 +18,8 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
disabled: Boolean
|
disabled: Boolean,
|
||||||
|
skipConfirm: Boolean
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
confirming(newValue) {
|
confirming(newValue) {
|
||||||
|
@ -27,6 +28,10 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
click() {
|
click() {
|
||||||
|
if (this.skipConfirm) {
|
||||||
|
this.$emit('click');
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (this.confirming) {
|
if (this.confirming) {
|
||||||
this.$emit('click');
|
this.$emit('click');
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,7 @@ export default {
|
||||||
},
|
},
|
||||||
buyables: {
|
buyables: {
|
||||||
showRespec: true,
|
showRespec: true,
|
||||||
reset() { // Optional, reset things and give back your currency. Having this function makes a respec button appear
|
respec() { // Optional, reset things and give back your currency. Having this function makes a respec button appear
|
||||||
player[this.layer].points = player[this.layer].points.add(player[this.layer].spentOnBuyables) // A built-in thing to keep track of this but only keeps a single value
|
player[this.layer].points = player[this.layer].points.add(player[this.layer].spentOnBuyables) // A built-in thing to keep track of this but only keeps a single value
|
||||||
this.reset();
|
this.reset();
|
||||||
resetLayer(this.layer, true) // Force a reset
|
resetLayer(this.layer, true) // Force a reset
|
||||||
|
|
|
@ -242,6 +242,9 @@ export function addLayer(layer, player = null) {
|
||||||
} else {
|
} else {
|
||||||
layer.buyables.reset.forceCached = false;
|
layer.buyables.reset.forceCached = false;
|
||||||
}
|
}
|
||||||
|
if (layer.buyables.respec != undefined) {
|
||||||
|
layer.buyables.respec.forceCached = false;
|
||||||
|
}
|
||||||
for (let id in layer.buyables) {
|
for (let id in layer.buyables) {
|
||||||
if (isPlainObject(layer.buyables[id])) {
|
if (isPlainObject(layer.buyables[id])) {
|
||||||
layer.buyables[id].amount = function() {
|
layer.buyables[id].amount = function() {
|
||||||
|
|
Loading…
Reference in a new issue