2021-06-12 04:38:16 +00:00
|
|
|
<template>
|
|
|
|
<div style="display: flex">
|
2021-06-24 00:48:41 +00:00
|
|
|
<tooltip display="Disable respec confirmation">
|
2021-06-12 04:38:16 +00:00
|
|
|
<Toggle :value="confirmRespec" @change="setConfirmRespec" />
|
|
|
|
</tooltip>
|
|
|
|
<button @click="respec" :class="{ feature: true, respec: true, can: unlocked, locked: !unlocked }"
|
|
|
|
style="margin-right: 18px" :style="style">
|
|
|
|
<component :is="respecButtonDisplay" />
|
|
|
|
</button>
|
|
|
|
<Modal :show="confirming" @close="cancel">
|
2021-07-24 22:08:52 +00:00
|
|
|
<template v-slot:header>
|
2021-06-12 04:38:16 +00:00
|
|
|
<h2>Confirm Respec</h2>
|
2021-07-24 22:08:52 +00:00
|
|
|
</template>
|
|
|
|
<template v-slot:body>
|
|
|
|
<slot name="respec-warning">
|
|
|
|
<div>Are you sure you want to respec? This will force you to do a {{ name }} respec as well!</div>
|
|
|
|
</slot>
|
|
|
|
</template>
|
|
|
|
<template v-slot:footer>
|
2021-06-12 04:38:16 +00:00
|
|
|
<div class="modal-footer">
|
|
|
|
<div class="modal-flex-grow"></div>
|
2021-06-26 06:45:05 +00:00
|
|
|
<danger-button class="button modal-button" @click="confirm" skipConfirm>Yes</danger-button>
|
|
|
|
<button class="button modal-button" @click="cancel">Cancel</button>
|
2021-06-12 04:38:16 +00:00
|
|
|
</div>
|
2021-07-24 22:08:52 +00:00
|
|
|
</template>
|
2021-06-12 04:38:16 +00:00
|
|
|
</Modal>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-07-24 22:08:52 +00:00
|
|
|
import { layers } from '../../game/layers';
|
|
|
|
import player from '../../game/player';
|
2021-06-12 04:38:16 +00:00
|
|
|
import { coerceComponent } from '../../util/vue';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'respec-button',
|
|
|
|
inject: [ 'tab' ],
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
confirming: false
|
|
|
|
};
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
layer: String,
|
|
|
|
confirmRespec: Boolean,
|
|
|
|
display: [ String, Object ]
|
|
|
|
},
|
2021-07-24 22:08:52 +00:00
|
|
|
emits: [ 'set-confirm-respec', 'respec' ],
|
2021-06-12 04:38:16 +00:00
|
|
|
computed: {
|
|
|
|
style() {
|
|
|
|
return [
|
|
|
|
layers[this.layer || this.tab.layer].componentStyles?.['respec-button']
|
|
|
|
];
|
|
|
|
},
|
|
|
|
unlocked() {
|
|
|
|
return player[this.layer || this.tab.layer].unlocked;
|
|
|
|
},
|
|
|
|
respecButtonDisplay() {
|
|
|
|
if (this.display) {
|
|
|
|
return coerceComponent(this.display);
|
|
|
|
}
|
|
|
|
return coerceComponent("Respec");
|
|
|
|
},
|
|
|
|
name() {
|
|
|
|
return layers[this.layer || this.tab.layer].name || this.layer || this.tab.layer;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
setConfirmRespec(value) {
|
|
|
|
this.$emit("set-confirm-respec", value);
|
|
|
|
},
|
|
|
|
respec() {
|
|
|
|
if (this.confirmRespec) {
|
|
|
|
this.confirming = true;
|
|
|
|
} else {
|
|
|
|
this.$emit("respec");
|
|
|
|
}
|
|
|
|
},
|
|
|
|
confirm() {
|
|
|
|
this.$emit("respec");
|
|
|
|
this.confirming = false;
|
|
|
|
},
|
|
|
|
cancel() {
|
|
|
|
this.confirming = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.respec {
|
|
|
|
height: 40px;
|
|
|
|
width: 80px;
|
|
|
|
background: var(--points);
|
|
|
|
border: 2px solid rgba(0, 0, 0, 0.125);
|
|
|
|
}
|
|
|
|
|
|
|
|
.modal-footer {
|
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
|
|
|
|
.modal-flex-grow {
|
|
|
|
flex-grow: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.modal-button {
|
|
|
|
margin-left: 10px;
|
|
|
|
}
|
|
|
|
</style>
|